Example usage for javax.swing WindowConstants DISPOSE_ON_CLOSE

List of usage examples for javax.swing WindowConstants DISPOSE_ON_CLOSE

Introduction

In this page you can find the example usage for javax.swing WindowConstants DISPOSE_ON_CLOSE.

Prototype

int DISPOSE_ON_CLOSE

To view the source code for javax.swing WindowConstants DISPOSE_ON_CLOSE.

Click Source Link

Document

The dispose-window default window close operation.

Usage

From source file:de.tor.tribes.ui.windows.DSWorkbenchSplashScreen.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor./*from  w  w  w. j  ava2  s .  co  m*/
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">                          
private void initComponents() {

    jProfileDialog = new javax.swing.JDialog();
    jScrollPane2 = new javax.swing.JScrollPane();
    jTree1 = new javax.swing.JTree();
    jButton1 = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();
    jStatusOutput = new javax.swing.JProgressBar();

    jProfileDialog.setTitle("Profile");
    jProfileDialog.setModal(true);
    jProfileDialog.setUndecorated(true);

    jScrollPane2.setViewportView(jTree1);

    jButton1.setBackground(new java.awt.Color(239, 235, 223));
    jButton1.setText("Profil auswhlen");
    jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            fireSelectAccountEvent(evt);
        }
    });

    javax.swing.GroupLayout jProfileDialogLayout = new javax.swing.GroupLayout(jProfileDialog.getContentPane());
    jProfileDialog.getContentPane().setLayout(jProfileDialogLayout);
    jProfileDialogLayout.setHorizontalGroup(
            jProfileDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jProfileDialogLayout.createSequentialGroup().addContainerGap()
                            .addGroup(jProfileDialogLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 380,
                                            Short.MAX_VALUE)
                                    .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING))
                            .addContainerGap()));
    jProfileDialogLayout.setVerticalGroup(jProfileDialogLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jProfileDialogLayout.createSequentialGroup().addContainerGap()
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 187,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18).addComponent(jButton1)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setUndecorated(true);

    jLabel1.setMaximumSize(new java.awt.Dimension(516, 250));
    jLabel1.setMinimumSize(new java.awt.Dimension(516, 250));
    jLabel1.setPreferredSize(new java.awt.Dimension(516, 250));
    getContentPane().add(jLabel1, java.awt.BorderLayout.CENTER);

    jStatusOutput.setIndeterminate(true);
    jStatusOutput.setMinimumSize(new java.awt.Dimension(10, 20));
    jStatusOutput.setPreferredSize(new java.awt.Dimension(146, 20));
    jStatusOutput.setString("Lade Einstellungen...");
    jStatusOutput.setStringPainted(true);
    getContentPane().add(jStatusOutput, java.awt.BorderLayout.SOUTH);

    pack();
}

From source file:edu.ku.brc.specify.utilapps.DataModelClassGenerator.java

/**
 * @param dataClass/*from w  w  w  .  j av a2 s .  co m*/
 * @param tableId
 */
public DataModelClassGenerator(final Class<?> dataClass) {
    this.dataClass = dataClass;

    Class<?>[] baseClasses = { Boolean.class, Integer.class, Double.class, String.class, Float.class,
            Character.class, Short.class, Byte.class, BigDecimal.class, Date.class, Calendar.class };
    for (Class<?> cls : baseClasses) {
        baseClassHash.put(cls.getSimpleName(), true);
    }

    int cnt = 0;
    for (Field field : dataClass.getDeclaredFields()) {
        if (field.getType() == String.class || Collection.class.isAssignableFrom(field.getType())) {
            cnt++;
        }
    }
    Font font = new Font("Courier", Font.PLAIN, 10);

    logArea = new JTextArea();
    logArea.setFont(font);

    tableIdTxt = new JTextField(10);
    devTxt = new JTextField(10);

    PanelBuilder outer = new PanelBuilder(new FormLayout("p,2px,p,2px,f:p:g", "200px:g,4px,f:300px:g,4px,p"));

    PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,p,2px,l:p:g,2px,l:p",
            UIHelper.createDuplicateJGoodiesDef("p", "2px", cnt + 2)));
    CellConstraints cc = new CellConstraints();

    pb.add(new JLabel("Table Id"), cc.xy(1, 1));
    pb.add(tableIdTxt, cc.xywh(3, 1, 3, 1));

    pb.add(new JLabel("Dev"), cc.xy(1, 3));
    pb.add(devTxt, cc.xywh(3, 3, 3, 1));

    int y = 5;
    for (Field field : dataClass.getDeclaredFields()) {
        if (field.getType() == String.class) {
            UIRow row = new UIRow(DataType.String, field);
            pb.add(new JLabel(field.getName()), cc.xy(1, y));
            pb.add(row.getSizetxt(), cc.xywh(3, y, 1, 1));
            y += 2;
            rows.add(row);
            fieldRowhash.put(field, row);
        }

        if (Collection.class.isAssignableFrom(field.getType())) {
            UIRow row = new UIRow(DataType.Set, field);
            pb.add(new JLabel(field.getName()), cc.xy(1, y));
            pb.add(row.getSizetxt(), cc.xywh(3, y, 3, 1));
            pb.add(new JLabel("(Set)", SwingConstants.LEFT), cc.xy(7, y));
            y += 2;
            rows.add(row);
            fieldRowhash.put(field, row);
        }
    }

    JButton processBtn = UIHelper.createButton("Process");
    JButton cancelBtn = UIHelper.createButton("Cancel");

    processBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            process();
        }
    });

    cancelBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setVisible(false);
        }
    });
    pb.getPanel().setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    JPanel panel = ButtonBarFactory.buildGrowingBar(new JButton[] { processBtn, cancelBtn });

    outer.add(new JScrollPane(pb.getPanel(), ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), cc.xywh(1, 1, 5, 1));
    outer.add(new JScrollPane(logArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), cc.xywh(1, 3, 5, 1));
    outer.add(panel, cc.xy(5, 5));
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    JPanel p = new JPanel(new BorderLayout());
    p.add(outer.getPanel(), BorderLayout.CENTER);
    setContentPane(p);
    //setSize(500,500);
    pack();
    setSize(500, getSize().height);
}

From source file:net.sourceforge.entrainer.gui.socket.EntrainerSocketConnector.java

/**
 * Instantiates a new entrainer socket connector.
 *
 * @param ipAddress/*from www. j  a v  a2s .c o m*/
 *          the ip address
 * @param port
 *          the port
 * @throws UnknownHostException
 *           the unknown host exception
 */
public EntrainerSocketConnector(String ipAddress, int port) throws UnknownHostException {
    super("Entrainer Socket Connector");
    setIconImage(GuiUtil.getIcon("/Brain.png").getImage());
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    jsonMapper.configure(SerializationFeature.INDENT_OUTPUT, Boolean.TRUE);
    jsonMapper.setSerializationInclusion(Include.NON_NULL);

    this.port = port;
    if (ipAddress == null || ipAddress.trim().length() == 0)
        ipAddress = initIPAddress();
    this.ipAddress = ipAddress;
    if (ipAddress == null || ipAddress.trim().length() == 0)
        throw new RuntimeException("IP address has not been set");
    init();
}

From source file:info.puzz.trackprofiler.gui.TrackProfilerFrame.java

private void initGUI() {
    try {//  w w  w .  j  a  v a  2  s  .  c  o m
        BorderLayout thisLayout = new BorderLayout();
        this.getContentPane().setLayout(thisLayout);
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        this.setTitle("Track Profiler " + TrackProfilerAppContext.PROGRAM_VERSION); //$NON-NLS-1$//$NON-NLS-2$
        this.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent evt) {
                rootWindowClosing(evt);
            }
        });
        this.getContentPane().add(getJPanel1(), BorderLayout.CENTER);
        this.getContentPane().add(getTopToolBar(), BorderLayout.NORTH);
        this.getContentPane().add(getJPanel2(), BorderLayout.EAST);
        this.setLocation(new java.awt.Point(100, 100));
        pack();
        this.setSize(794, 537);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:fll.scheduler.SchedulerUI.java

public SchedulerUI() {
    super(BASE_TITLE);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    _progressDialog = new ProgressDialog(SchedulerUI.this, "Please Wait");
    _progressDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    setJMenuBar(createMenubar());/*w  w w  .j  ava2s  . c om*/

    final Container cpane = getContentPane();
    cpane.setLayout(new BorderLayout());

    mTabbedPane = new JTabbedPane();
    cpane.add(mTabbedPane, BorderLayout.CENTER);

    final JPanel scheduleDescriptionPanel = new JPanel(new BorderLayout());
    mTabbedPane.addTab("Description", scheduleDescriptionPanel);

    mDescriptionFilename = new JLabel("");
    scheduleDescriptionPanel.add(createDescriptionToolbar(), BorderLayout.PAGE_START);

    mScheduleDescriptionEditor = new SolverParamsEditor();
    final JScrollPane editorScroller = new JScrollPane(mScheduleDescriptionEditor);
    scheduleDescriptionPanel.add(editorScroller, BorderLayout.CENTER);

    // start out with default values
    mScheduleDescriptionEditor.setParams(new SolverParams());

    final JPanel schedulePanel = new JPanel(new BorderLayout());
    mTabbedPane.addTab("Schedule", schedulePanel);

    mScheduleFilename = new JLabel("");
    schedulePanel.add(createScheduleToolbar(), BorderLayout.PAGE_START);

    mScheduleTable = new JTable();
    mScheduleTable.setAutoCreateRowSorter(true);
    mScheduleTable.setDefaultRenderer(Date.class, schedTableRenderer);
    mScheduleTable.setDefaultRenderer(String.class, schedTableRenderer);
    mScheduleTable.setDefaultRenderer(Integer.class, schedTableRenderer);
    mScheduleTable.setDefaultRenderer(Object.class, schedTableRenderer);
    final JScrollPane dataScroller = new JScrollPane(mScheduleTable);

    violationTable = new JTable();
    violationTable.setDefaultRenderer(String.class, violationTableRenderer);
    violationTable.getSelectionModel().addListSelectionListener(violationSelectionListener);
    final JScrollPane violationScroller = new JScrollPane(violationTable);

    final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, dataScroller, violationScroller);
    schedulePanel.add(splitPane, BorderLayout.CENTER);

    // initial state
    mWriteSchedulesAction.setEnabled(false);
    mDisplayGeneralScheduleAction.setEnabled(false);
    mRunOptimizerAction.setEnabled(false);
    mReloadFileAction.setEnabled(false);

    pack();
}

From source file:com.tiempometa.muestradatos.JProgramTags.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY
    // //GEN-BEGIN:initComponents
    ResourceBundle bundle = ResourceBundle.getBundle("com.tiempometa.muestradatos.muestradatos");
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    label1 = new JLabel();
    statusLabel = new JLabel();
    nextChipnumberTextField = new JTextField();
    programButton = new JButton();
    bibLabel = new JLabel();
    label3 = new JLabel();
    tidTextField = new JTextField();
    label4 = new JLabel();
    epcTextField = new JTextField();
    label5 = new JLabel();
    programmedEpcTextField = new JTextField();
    scrollPane1 = new JScrollPane();
    tagReadTable = new JTable();
    lockCheckbox = new JCheckBox();
    label2 = new JLabel();
    accessPasswordTextField = new JTextField();
    label6 = new JLabel();
    killPasswordTextField = new JTextField();
    checkBox1 = new JCheckBox();
    buttonBar = new JPanel();
    closeButton = new JButton();
    CellConstraints cc = new CellConstraints();

    // ======== this ========
    setTitle(bundle.getString("JProgramTags.this.title"));
    setIconImage(/*w ww .j a  v  a2 s  .  c  om*/
            new ImageIcon(getClass().getResource("/com/tiempometa/resources/tiempometa_icon_large_alpha.png"))
                    .getImage());
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    // ======== dialogPane ========
    {
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setLayout(new BorderLayout());

        // ======== contentPanel ========
        {
            contentPanel.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.setLayout(new FormLayout(
                    new ColumnSpec[] { new ColumnSpec(Sizes.dluX(12)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(86)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(73)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(68)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(97)) },
                    new RowSpec[] { new RowSpec(Sizes.dluY(10)), FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(15)), FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(17)), FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC }));

            // ---- label1 ----
            label1.setText(bundle.getString("JProgramTags.label1.text"));
            label1.setFont(new Font("Tahoma", Font.PLAIN, 36));
            contentPanel.add(label1, cc.xywh(3, 5, 3, 1));

            // ---- statusLabel ----
            statusLabel.setText(bundle.getString("JProgramTags.statusLabel.text"));
            statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
            statusLabel.setBackground(Color.yellow);
            statusLabel.setOpaque(true);
            statusLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
            contentPanel.add(statusLabel, cc.xywh(9, 3, 3, 5));

            // ---- nextChipnumberTextField ----
            nextChipnumberTextField.setFont(new Font("Tahoma", Font.PLAIN, 36));
            contentPanel.add(nextChipnumberTextField, cc.xy(7, 5));

            // ---- programButton ----
            programButton.setText(bundle.getString("JProgramTags.programButton.text"));
            programButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            programButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    programButtonActionPerformed(e);
                }
            });
            contentPanel.add(programButton, cc.xywh(3, 7, 3, 1));

            // ---- bibLabel ----
            bibLabel.setForeground(Color.red);
            bibLabel.setFont(new Font("Tahoma", Font.BOLD, 36));
            bibLabel.setHorizontalAlignment(SwingConstants.CENTER);
            contentPanel.add(bibLabel, cc.xy(11, 9));

            // ---- label3 ----
            label3.setText(bundle.getString("JProgramTags.label3.text"));
            label3.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label3, cc.xy(7, 11));

            // ---- tidTextField ----
            tidTextField.setEditable(false);
            tidTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(tidTextField, cc.xywh(9, 11, 3, 1));

            // ---- label4 ----
            label4.setText(bundle.getString("JProgramTags.label4.text"));
            label4.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label4, cc.xy(7, 13));

            // ---- epcTextField ----
            epcTextField.setEditable(false);
            epcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(epcTextField, cc.xywh(9, 13, 3, 1));

            // ---- label5 ----
            label5.setText(bundle.getString("JProgramTags.label5.text"));
            label5.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label5, cc.xy(7, 15));

            // ---- programmedEpcTextField ----
            programmedEpcTextField.setEditable(false);
            programmedEpcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(programmedEpcTextField, cc.xywh(9, 15, 3, 1));

            // ======== scrollPane1 ========
            {
                scrollPane1.setViewportView(tagReadTable);
            }
            contentPanel.add(scrollPane1, cc.xywh(3, 17, 9, 1));

            // ---- lockCheckbox ----
            lockCheckbox.setText(bundle.getString("JProgramTags.lockCheckbox.text"));
            lockCheckbox.setSelected(true);
            lockCheckbox.setFont(new Font("Tahoma", Font.PLAIN, 14));
            lockCheckbox.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    checkBox2ItemStateChanged(e);
                }
            });
            contentPanel.add(lockCheckbox, cc.xy(3, 19));

            // ---- label2 ----
            label2.setText(bundle.getString("JProgramTags.label2.text"));
            label2.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label2, cc.xy(5, 19));

            // ---- accessPasswordTextField ----
            accessPasswordTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(accessPasswordTextField, cc.xy(7, 19));

            // ---- label6 ----
            label6.setText(bundle.getString("JProgramTags.label6.text"));
            label6.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label6, cc.xy(5, 21));

            // ---- killPasswordTextField ----
            killPasswordTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(killPasswordTextField, cc.xy(7, 21));

            // ---- checkBox1 ----
            checkBox1.setText(bundle.getString("JProgramTags.checkBox1.text"));
            checkBox1.setEnabled(false);
            contentPanel.add(checkBox1, cc.xy(9, 21));
        }
        dialogPane.add(contentPanel, BorderLayout.EAST);

        // ======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            buttonBar.setLayout(
                    new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC },
                            RowSpec.decodeSpecs("pref")));

            // ---- closeButton ----
            closeButton.setText("Cerrar");
            closeButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            closeButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    closeButtonActionPerformed(e);
                }
            });
            buttonBar.add(closeButton, cc.xy(2, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    setSize(700, 625);
    setLocationRelativeTo(getOwner());
    // //GEN-END:initComponents
}

From source file:kr.ac.kaist.swrc.jhannanum.demo.GUIDemo.java

/**
 * Sets the GUI up and launch the demo./* w  w w  .  j a va2 s  .  c o  m*/
 */
public void run() {
    ///////////////////////////////////////////////////////////////////
    // Basic setting for the mainFrame                                    
    ///////////////////////////////////////////////////////////////////
    mainFrame = new JFrame();

    Toolkit kit = mainFrame.getToolkit();
    Dimension windowSize = kit.getScreenSize();

    mainFrame.setBounds(windowSize.width / 20, windowSize.height / 20, windowSize.width * 18 / 20,
            windowSize.height * 18 / 20);
    mainFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    mainFrame.setTitle("HanNanum Korean Morphological Analyzer - A Plug-in Component based System (GUI Demo)");

    Font font = new Font("MonoSpaced", Font.PLAIN, 12);
    UIManager.put("TextArea.font", font);

    ///////////////////////////////////////////////////////////////////
    // Layout setting for the mainFrame                  
    ///////////////////////////////////////////////////////////////////
    mainFrame.setLayout(new BorderLayout());
    mainFrame.getContentPane().add(createPaneCenter(), BorderLayout.CENTER);
    mainFrame.getContentPane().add(createPaneNorth(), BorderLayout.NORTH);

    ///////////////////////////////////////////////////////////////////
    // Menu Setting                                 
    ///////////////////////////////////////////////////////////////////      
    menuBar = new JMenuBar();
    menuFile = new JMenu("File");
    menuItemFileOpen = new JMenuItem("Open", KeyEvent.VK_O);
    menuHelp = new JMenu("Help");
    menuItemHelp = new JMenuItem("Help", KeyEvent.VK_H);

    menuItemFileOpen.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.ALT_MASK));
    menuItemHelp.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK));

    menuBar.add(menuFile);
    menuBar.add(menuHelp);
    menuFile.add(menuItemFileOpen);
    menuHelp.add(menuItemHelp);
    mainFrame.setJMenuBar(menuBar);

    ///////////////////////////////////////////////////////////////////
    // Event Handler Setting                                 
    ///////////////////////////////////////////////////////////////////
    menuItemFileOpen.addActionListener(new SharedActionHandler());
    menuItemHelp.addActionListener(new SharedActionHandler());
    buttonActivate.addActionListener(new SharedActionHandler());
    buttonAnalysis.addActionListener(new SharedActionHandler());
    buttonReset.addActionListener(new SharedActionHandler());
    radioMultiThread.addActionListener(new SharedActionHandler());
    radioSingleThread.addActionListener(new SharedActionHandler());

    listPluginMajor2.addMouseListener(new PluginListMouseListener(listPluginMajor2, listModelMajor2));
    listPluginMajor3.addMouseListener(new PluginListMouseListener(listPluginMajor3, listModelMajor3));
    listPluginSupplement1
            .addMouseListener(new PluginListMouseListener(listPluginSupplement1, listModelSupplement1));
    listPluginSupplement2
            .addMouseListener(new PluginListMouseListener(listPluginSupplement2, listModelSupplement2));
    listPluginSupplement3
            .addMouseListener(new PluginListMouseListener(listPluginSupplement3, listModelSupplement3));

    listPluginMajor2.setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE2, PluginInfo.MAJOR));
    listPluginMajor3.setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE3, PluginInfo.MAJOR));
    listPluginSupplement1
            .setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE1, PluginInfo.SUPPLEMENT));
    listPluginSupplement2
            .setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE2, PluginInfo.SUPPLEMENT));
    listPluginSupplement3
            .setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE3, PluginInfo.SUPPLEMENT));

    listPluginSupplement1.setDropMode(DropMode.ON_OR_INSERT);
    listPluginSupplement2.setDropMode(DropMode.ON_OR_INSERT);
    listPluginSupplement3.setDropMode(DropMode.ON_OR_INSERT);
    listPluginMajor2.setDropMode(DropMode.ON_OR_INSERT);
    listPluginMajor3.setDropMode(DropMode.ON_OR_INSERT);

    listPluginMajor2.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listPluginMajor3.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listPluginSupplement1.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listPluginSupplement2.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listPluginSupplement3.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    listPluginMajor2.setDragEnabled(true);
    listPluginMajor3.setDragEnabled(true);
    listPluginSupplement1.setDragEnabled(true);
    listPluginSupplement2.setDragEnabled(true);
    listPluginSupplement3.setDragEnabled(true);

    tree.setDragEnabled(true);
    tempPlugin = new PluginInfo("", 0, 0);

    workflow = new Workflow();

    // Show the main frame on the screen
    mainFrame.setVisible(true);

    for (int i = 0; i < tree.getRowCount(); i++) {
        tree.expandRow(i);
    }

    splitPaneTop.setDividerLocation(0.3);
    splitPaneBottom.setDividerLocation(0.5);
}

From source file:jboost.visualization.HistogramFrame.java

private void initGUI() {

    post("Initializing GUI...");

    try {//ww  w  .  j  av  a 2s  . c o m
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        {
            jMenuBar1 = new JMenuBar();
            setJMenuBar(jMenuBar1);
            jMenuBar1.add(getJMenu1());
            jMenuBar1.add(getJMenu2());
        }
        {
            jSplitPane2 = new JSplitPane();
            jSplitPane2.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
            jSplitPane2.setDividerLocation(850);
            jSplitPane2.setFocusCycleRoot(true);
            jSplitPane2.add(getJSplitPane1(), JSplitPane.LEFT);
            jSplitPane2.add(getJPanel3(), JSplitPane.RIGHT);
        }

        this.add(jSplitPane2);
        pack();
        this.setSize(1000, 500);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.igormaznitsa.zxpspritecorrector.files.FileNameDialog.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from w w w . ja  v a 2 s. c  o m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    buttonCancel = new javax.swing.JButton();
    buttonOk = new javax.swing.JButton();
    jPanel1 = new javax.swing.JPanel();
    textFileName0 = new javax.swing.JTextField();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    textZxFileName0 = new javax.swing.JFormattedTextField();
    textZxFileType0 = new javax.swing.JFormattedTextField();
    jPanel2 = new javax.swing.JPanel();
    jLabel4 = new javax.swing.JLabel();
    textFileName1 = new javax.swing.JTextField();
    jLabel5 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    textZxFileName1 = new javax.swing.JFormattedTextField();
    textZxFileType1 = new javax.swing.JFormattedTextField();
    jPanel3 = new javax.swing.JPanel();
    jLabel10 = new javax.swing.JLabel();
    textFileName3 = new javax.swing.JTextField();
    jLabel11 = new javax.swing.JLabel();
    jLabel12 = new javax.swing.JLabel();
    textZxFileName3 = new javax.swing.JFormattedTextField();
    textZxFileType3 = new javax.swing.JFormattedTextField();
    jPanel4 = new javax.swing.JPanel();
    jLabel7 = new javax.swing.JLabel();
    textFileName2 = new javax.swing.JTextField();
    jLabel8 = new javax.swing.JLabel();
    jLabel9 = new javax.swing.JLabel();
    textZxFileName2 = new javax.swing.JFormattedTextField();
    textZxFileType2 = new javax.swing.JFormattedTextField();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    buttonCancel.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/zxpspritecorrector/icons/cross.png"))); // NOI18N
    buttonCancel.setText("Cancel");
    buttonCancel.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonCancelActionPerformed(evt);
        }
    });

    buttonOk.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/zxpspritecorrector/icons/tick.png"))); // NOI18N
    buttonOk.setText("Ok");
    buttonOk.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonOkActionPerformed(evt);
        }
    });

    jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Block CPU0"));

    jLabel1.setText("File name:");

    jLabel2.setText("ZX File name:");

    jLabel3.setText("ZX File type:");

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup().addGap(6, 6, 6).addComponent(jLabel3)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(textZxFileType0, javax.swing.GroupLayout.PREFERRED_SIZE, 130,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGroup(jPanel1Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel2).addComponent(jLabel1))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                                    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(textFileName0).addComponent(textZxFileName0))))
                    .addContainerGap()));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(textFileName0, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2).addComponent(textZxFileName0,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3).addComponent(textZxFileType0,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(20, Short.MAX_VALUE)));

    jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] { jLabel1, jLabel2,
            jLabel3, textFileName0, textZxFileName0, textZxFileType0 });

    jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Block CPU1"));

    jLabel4.setText("File name:");

    jLabel5.setText("ZX File name:");

    jLabel6.setText("ZX File type:");

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup().addGap(6, 6, 6).addComponent(jLabel6)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(textZxFileType1, javax.swing.GroupLayout.PREFERRED_SIZE, 133,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                            .addGroup(jPanel2Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel5).addComponent(jLabel4))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                                    jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(textFileName1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    511, Short.MAX_VALUE)
                                            .addComponent(textZxFileName1))))
                    .addContainerGap()));
    jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(textFileName1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5).addComponent(textZxFileName1,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel6).addComponent(textZxFileType1,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(20, Short.MAX_VALUE)));

    jPanel2Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] { jLabel4, jLabel5,
            jLabel6, textFileName1, textZxFileName1, textZxFileType1 });

    jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Block CPU3"));

    jLabel10.setText("File name:");

    jLabel11.setText("ZX File name:");

    jLabel12.setText("ZX File type:");

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(jPanel3Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addGroup(jPanel3Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup().addGap(6, 6, 6).addComponent(jLabel12)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(textZxFileType3, javax.swing.GroupLayout.PREFERRED_SIZE, 131,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                            .addGroup(jPanel3Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel11).addComponent(jLabel10))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                                    jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(textFileName3, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    511, Short.MAX_VALUE)
                                            .addComponent(textZxFileName3))))
                    .addContainerGap()));
    jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(textFileName3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel11).addComponent(textZxFileName3,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel12).addComponent(textZxFileType3,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(20, Short.MAX_VALUE)));

    jPanel3Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] { jLabel10, jLabel11,
            jLabel12, textFileName3, textZxFileName3, textZxFileType3 });

    jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Block CPU2"));

    jLabel7.setText("File name:");

    jLabel8.setText("ZX File name:");

    jLabel9.setText("ZX File type:");

    javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(jPanel4Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup().addGap(6, 6, 6).addComponent(jLabel9)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(textZxFileType2, javax.swing.GroupLayout.PREFERRED_SIZE, 134,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                            .addGroup(jPanel4Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel8).addComponent(jLabel7))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                                    jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(textFileName2, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    511, Short.MAX_VALUE)
                                            .addComponent(textZxFileName2))))
                    .addContainerGap()));
    jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(textFileName2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8).addComponent(textZxFileName2,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel9).addComponent(textZxFileType2,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(20, Short.MAX_VALUE)));

    jPanel4Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] { jLabel7, jLabel8,
            jLabel9, textFileName2, textZxFileName2, textZxFileType2 });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                            Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(buttonOk)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(buttonCancel)))
                    .addContainerGap()));

    layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { buttonCancel, buttonOk });

    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(buttonOk).addComponent(buttonCancel))
                    .addContainerGap()));

    layout.linkSize(javax.swing.SwingConstants.VERTICAL,
            new java.awt.Component[] { jPanel1, jPanel2, jPanel3, jPanel4 });

    pack();
}

From source file:com.github.benchdoos.weblocopener.updater.gui.UpdateDialog.java

private void createGUI() {
    setContentPane(contentPane);//from  w  w w.j ava2 s. c  om
    getRootPane().setDefaultButton(buttonOK);
    if (IS_WINDOWS_XP) {
        //for windows xp&server 2003
        setIconImage(Toolkit.getDefaultToolkit()
                .getImage(UpdateDialog.class.getResource("/images/updaterIcon64_white.png")));
    } else {
        setIconImage(Toolkit.getDefaultToolkit()
                .getImage(UpdateDialog.class.getResource("/images/updaterIcon64.png")));

    }

    createDefaultActionListeners();

    // call onCancel() when cross is clicked
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            onCancel();
        }
    });

    // call onCancel() on ESCAPE
    contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

    updateInfoButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onUpdateInfoButton();
        }
    });

    updateInfoButton.setCursor(new Cursor(Cursor.HAND_CURSOR));

    manualDownloadButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            openSetupUrl();
        }

        private void openSetupUrl() {
            log.debug("Calling to download setup manually");
            URL url = null;
            if (updater != null) {
                if (updater.getAppVersion() != null) {
                    try {
                        log.debug("Trying to open [" + updater.getAppVersion().getDownloadUrl() + "]");
                        url = new URL(updater.getAppVersion().getDownloadUrl());
                        UrlValidator urlValidator = new UrlValidator();
                        UserUtils.openWebUrl(url);
                    } catch (MalformedURLException e1) {
                        openWebsite(url);
                    }
                } else
                    UserUtils.openWebUrl(ApplicationConstants.UPDATE_WEB_URL);

            } else
                UserUtils.openWebUrl(ApplicationConstants.UPDATE_WEB_URL);
        }

        private void openWebsite(URL url) {
            log.warn("Could not open setup url: [" + url + "]\n" + "Opening "
                    + ApplicationConstants.UPDATE_WEB_URL);
            UserUtils.openWebUrl(ApplicationConstants.UPDATE_WEB_URL);
        }
    });

    pack();
    setLocation(FrameUtils.getFrameOnCenterLocationPoint(this));
    setSize(new Dimension(400, 170));
    setResizable(false);
}