package org.Algy.dialogs; import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.SwingConstants; import javax.swing.JLabel; import javax.swing.Box; import java.awt.GridLayout; import javax.swing.BoxLayout; import java.awt.Component; import java.awt.Dialog.ModalityType; public class AboutDialog extends JDialog { private final JPanel contentPanel = new JPanel(); /** * Launch the application. */ public static void main(String[] args) { try { AboutDialog dialog = new AboutDialog(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } /** * Create the dialog. */ public AboutDialog() { setModalityType(ModalityType.DOCUMENT_MODAL); setTitle("About..."); setBounds(100, 100, 450, 300); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); { JLabel lblDesceng = new JLabel("http://www.github.com/Algy"); contentPanel.add(lblDesceng); } { JLabel lblAlgy = new JLabel("- Alchan Kim(a9413@snu.ac.kr)"); lblAlgy.setHorizontalAlignment(SwingConstants.TRAILING); contentPanel.add(lblAlgy); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("OK"); okButton.setHorizontalAlignment(SwingConstants.RIGHT); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } } }