Example usage for javax.swing JLabel setText

List of usage examples for javax.swing JLabel setText

Introduction

In this page you can find the example usage for javax.swing JLabel setText.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "Defines the single line of text this component will display.")
public void setText(String text) 

Source Link

Document

Defines the single line of text this component will display.

Usage

From source file:projectresurrection.Music.java

public void subMenu(int type, String menu) {
    JPanel panel = (JPanel) ((JViewport) ((JScrollPane) pnlSub.getComponent(3)).getComponent(0))
            .getComponent(0);// ww  w.  j  av  a 2s  .c  o m
    JLabel header = (JLabel) pnlSub.getComponent(1);
    JLabel label;
    header.setText(menu);
    panel.removeAll();
    int y = 10;
    switch (type) {
    case 0:
        List albumList = new ArrayList(((Map) artists.get(menu)).keySet());
        Collections.sort(albumList);
        panel.setPreferredSize(new Dimension(349, (55 + (albumList.size() * 35))));
        label = new JLabel("All");
        label.setOpaque(true);
        label.setBackground(new Color(245, 245, 245));
        label.setFont(new Font("Tahoma", Font.PLAIN, 20));
        label.setBounds(10, y, 339, 35);
        label.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {
                subMenuAll(ARTISTS, menu);
                panel.revalidate();
                panel.repaint();
            }
        });
        panel.add(label);
        y += 35;
        for (int i = 0; i < albumList.size(); i++) {
            String album = albumList.get(i).toString();
            label = new JLabel(album);
            label.setOpaque(true);
            if (i % 2 == 1) {
                label.setBackground(new Color(245, 245, 245));
            }
            label.setFont(new Font("Tahoma", Font.PLAIN, 20));
            label.setBounds(10, y, 339, 35);
            label.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent arg0) {
                    subMenu(ALBUMS, album);
                    panel.revalidate();
                    panel.repaint();
                }
            });
            panel.add(label);
            y += 35;
        }
        break;
    case 1:
        List songList = new ArrayList();
        List albumSongs = new ArrayList(((Map) albums.get(menu)).keySet());
        Collections.sort(albumSongs);
        Map tracks = new HashMap();
        for (int i = 0; i < albumSongs.size(); i++) {
            String track = ((List) songs.get(albumSongs.get(i))).get(1).toString();
            if (tracks.containsKey(track)) {
                track = track + "(1)";
                int j = 2;
                while (tracks.containsKey(track)) {
                    track = track + "(" + j + ")";
                }
            }
            tracks.put(track, albumSongs.get(i));
        }
        List nums = new ArrayList(tracks.keySet());
        Collections.sort(nums);
        List hasTrack = new ArrayList();
        List noTrack = new ArrayList();
        for (int i = 0; i < nums.size(); i++) {
            if (nums.get(i).equals("-1")) {
                noTrack.add(tracks.get(nums.get(i)));
            } else {
                hasTrack.add(tracks.get(nums.get(i)));
            }
        }
        Collections.sort(noTrack);
        for (int i = 0; i < hasTrack.size(); i++) {
            songList.add(hasTrack.get(i));
        }
        for (int i = 0; i < noTrack.size(); i++) {
            songList.add(noTrack.get(i));
        }
        panel.setPreferredSize(new Dimension(349, (20 + (albumSongs.size() * 35))));
        List fileList = new ArrayList();
        for (int i = 0; i < songList.size(); i++) {
            fileList.add(((List) songs.get(songList.get(i))).get(0));
        }
        for (int i = 0; i < songList.size(); i++) {
            int num = i;
            String song = songList.get(i).toString();
            label = new JLabel(song);
            label.setOpaque(true);
            if (i % 2 == 0) {
                label.setBackground(new Color(245, 245, 245));
            }
            label.setFont(new Font("Tahoma", Font.PLAIN, 20));
            label.setBounds(10, y, 339, 35);
            label.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent arg0) {
                    player.setPlaylist(fileList, num);
                    pnlSub.setVisible(false);
                    pnlPlayer.setVisible(true);
                    try {
                        Thread.sleep(200);
                    } catch (Exception e) {
                    }
                    if (player.isPlaying() == false) {
                        player.toggle();
                    }
                }
            });
            panel.add(label);
            y += 35;
        }
        break;
    }
    panel.revalidate();
    panel.repaint();
}

From source file:projectresurrection.Music.java

public void subMenuAll(int type, String menu) {
    JPanel panel = (JPanel) ((JViewport) ((JScrollPane) pnlSub.getComponent(3)).getComponent(0))
            .getComponent(0);/*  w ww . j  a  va2  s  .  com*/
    JLabel header = (JLabel) pnlSub.getComponent(1);
    header.setText(menu + " - All");
    panel.removeAll();
    int y = 10;
    switch (type) {
    case 0:
        List songList = new ArrayList();
        List albumList = new ArrayList(((Map) artists.get(menu)).keySet());
        Collections.sort(albumList);
        for (int i = 0; i < albumList.size(); i++) {
            List albumSongs = new ArrayList(((Map) albums.get(albumList.get(i))).keySet());
            Map tracks = new HashMap();
            for (int j = 0; j < albumSongs.size(); j++) {
                String track = ((List) songs.get(albumSongs.get(j))).get(1).toString();
                tracks.put(track, albumSongs.get(j));
            }
            List nums = new ArrayList(tracks.keySet());
            Collections.sort(nums);
            List hasTrack = new ArrayList();
            List noTrack = new ArrayList();
            for (int j = 0; j < nums.size(); j++) {
                if (nums.get(j).equals("-1")) {
                    noTrack.add(tracks.get(nums.get(j)));
                } else {
                    hasTrack.add(tracks.get(nums.get(j)));
                }
            }
            for (int j = 0; j < hasTrack.size(); j++) {
                songList.add(hasTrack.get(j));
            }
            for (int j = 0; j < noTrack.size(); j++) {
                songList.add(noTrack.get(j));
            }
        }
        panel.setPreferredSize(new Dimension(349, (20 + (songList.size() * 35))));
        List fileList = new ArrayList();
        for (int i = 0; i < songList.size(); i++) {
            fileList.add(((List) songs.get(songList.get(i))).get(0));
        }
        for (int i = 0; i < songList.size(); i++) {
            int num = i;
            String song = songList.get(i).toString();
            JLabel label = new JLabel(song);
            label.setOpaque(true);
            if (i % 2 == 0) {
                label.setBackground(new Color(245, 245, 245));
            }
            label.setFont(new Font("Tahoma", Font.PLAIN, 20));
            label.setBounds(10, y, 339, 35);
            label.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent arg0) {
                    player.setPlaylist(fileList, num);
                    pnlSub.setVisible(false);
                    pnlPlayer.setVisible(true);
                    try {
                        Thread.sleep(200);
                    } catch (Exception e) {
                    }
                    if (player.isPlaying() == false) {
                        player.toggle();
                    }
                }
            });
            panel.add(label);
            y += 35;
        }
        break;
    }
    panel.revalidate();
    panel.repaint();
}

From source file:qic.ui.ManualPanel.java

@SuppressWarnings("serial")
public ManualPanel(Main main) {
    super(new BorderLayout(5, 5));

    table.setDoubleBuffered(true);/*from  w  ww. ja  va 2 s .co m*/

    JTextField searchTf = new JTextField(100);
    JButton runBtn = new JButton("Run");
    runBtn.setPreferredSize(new Dimension(200, 10));
    JLabel invalidTermsLblLbl = new JLabel();
    invalidTermsLblLbl.setFont(invalidTermsLblLbl.getFont().deriveFont(Font.BOLD));
    JLabel invalidTermsLbl = new JLabel();
    invalidTermsLbl.setForeground(Color.RED);
    JPanel northPanel = new JPanel();
    northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.X_AXIS));
    JLabel searchLbl = new JLabel(" Search: ");
    searchLbl.setFont(searchLbl.getFont().deriveFont(Font.BOLD));
    northPanel.add(searchLbl);
    northPanel.add(searchTf);
    northPanel.add(invalidTermsLblLbl);
    northPanel.add(invalidTermsLbl);
    northPanel.add(runBtn);
    this.add(northPanel, BorderLayout.NORTH);

    List<String> searchList = Util.loadSearchList(MANUAL_TXT_FILENAME);
    searchList.stream().forEach(searchJListModel::addElement);
    searchJList.setModel(searchJListModel);

    searchJList.addListSelectionListener(e -> {
        if (e.getValueIsAdjusting()) {
            searchTf.setText(trimToEmpty(searchJList.getSelectedValue()));
        }
    });
    searchJList.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent evt) {
            if (evt.getClickCount() == 2) {
                int index = searchJList.locationToIndex(evt.getPoint());
                if (index != -1) {
                    String search = trimToEmpty(searchJListModel.getElementAt(index));
                    searchTf.setText(search);
                    runBtn.doClick();
                }
            }
        }
    });

    searchJList.getInputMap().put(KeyStroke.getKeyStroke("DELETE"), "doSomething");
    searchJList.getActionMap().put("doSomething", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            int selectedIndex = searchJList.getSelectedIndex();
            if (selectedIndex != -1) {
                searchJListModel.remove(selectedIndex);
            }
        }
    });

    ActionListener runCommand = e -> {
        String tfText = searchTf.getText().trim();
        if (!tfText.isEmpty()) {
            Worker<Command> worker = new Worker<Command>(() -> {
                runBtn.setEnabled(false);
                Command result = null;
                try {
                    result = runQuery(main, tfText);
                } catch (Exception ex) {
                    runBtn.setEnabled(true);
                    SwingUtil.showError(ex);
                }
                return result;
            }, command -> {
                if (command != null) {
                    if (command.invalidSearchTerms.isEmpty()) {
                        addDataToTable(command);
                        saveSearchToList(tfText);
                        invalidTermsLbl.setText("");
                        invalidTermsLblLbl.setText("");
                        if (getBooleanProperty(MANUAL_AUTO_VERIFY, false)) {
                            long sleep = Config.getLongProperty(Config.MANUAL_AUTO_VERIFY_SLEEP, 5000);
                            table.runAutoVerify(sleep);
                        }
                    } else {
                        String invalidTermsStr = command.invalidSearchTerms.stream().collect(joining(", "));
                        invalidTermsLbl.setText(invalidTermsStr + " ");
                        invalidTermsLblLbl.setText(" Invalid: ");
                    }
                }
                runBtn.setEnabled(true);
            });
            worker.execute();
        }
    };

    searchTf.addActionListener(runCommand);
    runBtn.addActionListener(runCommand);

    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(table),
            new JScrollPane(searchJList));

    this.add(splitPane, BorderLayout.CENTER);
}

From source file:savant.plugin.builtin.AddSAFEGroup.java

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

    javax.swing.JLabel nameCaption = new javax.swing.JLabel();
    nameField = new javax.swing.JTextField();
    javax.swing.JLabel descriptionCaption = new javax.swing.JLabel();
    jScrollPane1 = new javax.swing.JScrollPane();
    descriptionField = new javax.swing.JTextArea();
    javax.swing.JButton cancelButton = new javax.swing.JButton();
    javax.swing.JButton createButton = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Create SAFE Group");

    nameCaption.setText("Name:");

    descriptionCaption.setText("Description:");

    descriptionField.setColumns(20);
    descriptionField.setRows(5);
    descriptionField.setText("Enter a group description here.");
    jScrollPane1.setViewportView(descriptionField);

    cancelButton.setText("Cancel");
    cancelButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelButtonActionPerformed(evt);
        }
    });

    createButton.setText("Create Group");
    createButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            createButtonActionPerformed(evt);
        }
    });

    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(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
                    .addComponent(nameField, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
                    .addComponent(nameCaption).addComponent(descriptionCaption)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            layout.createSequentialGroup().addComponent(createButton)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(cancelButton)))
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(nameCaption)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(nameField, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(descriptionCaption)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cancelButton).addComponent(createButton))
                    .addContainerGap()));

    pack();
}

From source file:savant.plugin.Tool.java

/**
 * Displays the command line in the given label.  Similar to, but somewhat prettier than
 * the command line generated by <code>buildCommandLine</code>.
 *//*w ww  . j  av  a2  s.com*/
void displayCommandLine(JLabel l) {
    String command = "<html>";
    command += baseCommand;
    for (ToolArgument a : arguments) {
        if (a.value == null) {
            if (a.required) {
                command += "<font color=\"red\"> " + a.flag + "</font>";
            }
        } else if (a.enabled) {
            if (a.type == ToolArgument.Type.MULTI) {
                String[] values = a.value.split(",");
                for (String val : values) {
                    command += " " + a.flag + " " + val;
                }
            } else {
                try {
                    command += " " + a.flag + " " + getStringValue(a);
                } catch (ParseException px) {
                    // An invalid range specification.
                    command += "<font color=\"red\"> " + a.flag + " " + a.value + "</font>";
                }
            }
        }
    }
    command += "</html>";
    l.setText(command);
}

From source file:savant.snp.SNPFinderPlugin.java

private void setupGUI(JPanel panel) {

    // add a toolbar
    JToolBar tb = new JToolBar();
    tb.setName("SNP Finder Toolbar");

    // add an ON/OFF checkbox
    JLabel lab_on = new JLabel("On/Off: ");
    JCheckBox cb_on = new JCheckBox();
    cb_on.setSelected(isSNPFinderOn);//from w w  w. j ava2  s  .com

    // what to do when a user clicks the checkbox
    cb_on.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            // switch the SNP finder on/off
            setIsOn(!isSNPFinderOn);
            addMessage("Turning SNP finder " + (isSNPFinderOn ? "on" : "off"));
        }
    });
    // add a  Bookmarking ON/OFF checkbox
    JLabel lab_bm = new JLabel("Add Bookmarks: ");
    JCheckBox cb_bm = new JCheckBox();
    cb_bm.setSelected(addBookmarks);

    // what to do when a user clicks the checkbox
    cb_bm.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            // switch the SNP finder on/off
            setBookmarking(!addBookmarks);
            addMessage("Turning Bookmarking " + (addBookmarks ? "on" : "off"));
        }
    });

    JLabel lab_sp = new JLabel("Heterozygosity: ");
    //add snp prior textfield
    final JTextField snpPriorField = new JTextField(String.valueOf(snpPrior), 4);
    snpPriorField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                setSNPPrior(Double.valueOf(snpPriorField.getText()));
            } catch (NumberFormatException ex) {
                snpPriorField.setText(String.valueOf(snpPrior));
            }
        }
    });
    int tfwidth = 35;
    int tfheight = 22;
    snpPriorField.setPreferredSize(new Dimension(tfwidth, tfheight));
    snpPriorField.setMaximumSize(new Dimension(tfwidth, tfheight));
    snpPriorField.setMinimumSize(new Dimension(tfwidth, tfheight));

    // add a sensitivity slider
    JLabel lab_confidence = new JLabel("Confidence: ");
    final JSlider sens_slider = new JSlider(0, 50);
    sens_slider.setValue(confidence);
    final JLabel lab_confidence_status = new JLabel("" + sens_slider.getValue());

    // what to do when a user slides the slider
    sens_slider.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            // set the snp finder's sensitivity
            lab_confidence_status.setText("" + sens_slider.getValue());
            setSensitivity(sens_slider.getValue());
        }
    });
    // don't report the new setting until the user stops sliding
    sens_slider.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            addMessage("Changed confidence to " + confidence);
        }
    });

    // add a transparency slider
    JLabel lab_trans = new JLabel("Transparency: ");
    final JSlider trans_slider = new JSlider(0, 100);
    trans_slider.setValue(transparency);
    final JLabel lab_transparency_status = new JLabel("" + trans_slider.getValue());

    // what to do when a user slides the slider
    trans_slider.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            // set the snp finder's transparency
            lab_transparency_status.setText("" + trans_slider.getValue());
            setTransparency(trans_slider.getValue());
        }
    });

    // don't report the new setting until the user stops sliding
    trans_slider.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            addMessage("Changed transparency to " + transparency);
        }
    });

    // add the components to the GUI
    panel.setLayout(new BorderLayout());
    tb.add(lab_on);
    tb.add(cb_on);
    tb.add(lab_bm);
    tb.add(cb_bm);
    tb.add(new JToolBar.Separator());
    tb.add(lab_sp);
    tb.add(snpPriorField);
    tb.add(new JToolBar.Separator());
    tb.add(lab_confidence);
    tb.add(sens_slider);
    tb.add(lab_confidence_status);

    tb.add(new JToolBar.Separator());

    tb.add(lab_trans);
    tb.add(trans_slider);
    tb.add(lab_transparency_status);

    panel.add(tb, BorderLayout.NORTH);

    // add a text area to the GUI
    info = new JTextArea();
    JScrollPane scrollPane = new JScrollPane(info);
    panel.add(scrollPane, BorderLayout.CENTER);

}

From source file:savant.sql.LoginDialog.java

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

    javax.swing.JLabel typeLabel = new javax.swing.JLabel();
    driverCombo = new javax.swing.JComboBox();
    javax.swing.JLabel uriLabel = new javax.swing.JLabel();
    uriField = new javax.swing.JTextField();
    javax.swing.JLabel userLabel = new javax.swing.JLabel();
    userField = new javax.swing.JTextField();
    javax.swing.JLabel passwordLabel = new javax.swing.JLabel();
    passwordField = new javax.swing.JPasswordField();
    cancelButton = new javax.swing.JButton();
    okButton = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("SQL Login");

    typeLabel.setText("Database Type");

    uriLabel.setText("Database URI");

    uriField.setColumns(80);

    userLabel.setText("User");

    userField.setColumns(12);

    passwordLabel.setText("Password");

    passwordField.setColumns(12);

    cancelButton.setText("Cancel");
    cancelButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelButtonActionPerformed(evt);
        }
    });

    okButton.setText("OK");
    okButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            okButtonActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
            javax.swing.GroupLayout.Alignment.TRAILING,
            layout.createSequentialGroup().addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(passwordLabel).addComponent(userLabel).addComponent(uriLabel)
                            .addComponent(typeLabel))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(driverCombo, 0, 508, Short.MAX_VALUE)
                            .addGroup(layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(passwordField, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(userField, javax.swing.GroupLayout.Alignment.LEADING,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(layout.createSequentialGroup().addComponent(cancelButton)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(okButton))
                                    .addComponent(uriField, javax.swing.GroupLayout.PREFERRED_SIZE, 505,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(typeLabel).addComponent(driverCombo,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(uriLabel).addComponent(uriField,
                                    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(userField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(userLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(passwordLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(okButton).addComponent(cancelButton))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    pack();
}

From source file:savant.ucsc.UCSCNavigationDialog.java

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

    javax.swing.JButton okButton = new javax.swing.JButton();
    cancelButton = new javax.swing.JButton();
    javax.swing.JPanel navigationPanel = new javax.swing.JPanel();
    javax.swing.JLabel cladeLabel = new javax.swing.JLabel();
    cladeCombo = new javax.swing.JComboBox();
    javax.swing.JLabel genomeLabel = new javax.swing.JLabel();
    genomeCombo = new javax.swing.JComboBox();
    javax.swing.JLabel groupLabel = new javax.swing.JLabel();
    groupCombo = new javax.swing.JComboBox();
    javax.swing.JLabel trackLabel = new javax.swing.JLabel();
    trackCombo = new javax.swing.JComboBox();
    javax.swing.JLabel formatLabelLabel = new javax.swing.JLabel();
    formatLabel = new javax.swing.JLabel();
    formatCombo = new javax.swing.JComboBox();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("UCSC Genome Database");
    getContentPane().setLayout(new java.awt.GridBagLayout());

    okButton.setText("OK");
    okButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            okButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 8);
    getContentPane().add(okButton, gridBagConstraints);

    cancelButton.setText("Cancel");
    cancelButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 8);
    getContentPane().add(cancelButton, gridBagConstraints);

    navigationPanel.setLayout(new java.awt.GridBagLayout());

    cladeLabel.setText("Clade:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 8);
    navigationPanel.add(cladeLabel, gridBagConstraints);

    cladeCombo.setMaximumSize(new java.awt.Dimension(300, 32767));
    cladeCombo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cladeComboActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    navigationPanel.add(cladeCombo, gridBagConstraints);

    genomeLabel.setText("Genome:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 8);
    navigationPanel.add(genomeLabel, gridBagConstraints);

    genomeCombo.setMaximumSize(new java.awt.Dimension(300, 32767));
    genomeCombo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            genomeComboActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    navigationPanel.add(genomeCombo, gridBagConstraints);

    groupLabel.setText("Group:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 8);
    navigationPanel.add(groupLabel, gridBagConstraints);

    groupCombo.setMaximumRowCount(9);
    groupCombo.setMaximumSize(new java.awt.Dimension(300, 32767));
    groupCombo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            groupComboActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    navigationPanel.add(groupCombo, gridBagConstraints);

    trackLabel.setText("Track:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 8);
    navigationPanel.add(trackLabel, gridBagConstraints);

    trackCombo.setMaximumSize(new java.awt.Dimension(300, 32767));
    trackCombo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            trackComboActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    navigationPanel.add(trackCombo, gridBagConstraints);

    formatLabelLabel.setText("Format:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 8);
    navigationPanel.add(formatLabelLabel, gridBagConstraints);

    formatLabel.setText("BED");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 8);
    navigationPanel.add(formatLabel, gridBagConstraints);

    formatCombo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            formatComboActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    navigationPanel.add(formatCombo, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 8);
    getContentPane().add(navigationPanel, gridBagConstraints);

    pack();
}

From source file:savant.view.dialog.LoadGenomeDialog.java

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

    withoutSequenceButtonGroup = new javax.swing.ButtonGroup();
    javax.swing.JLabel fromLabel = new javax.swing.JLabel();
    fromFileButton = new javax.swing.JButton();
    fromURLButton = new javax.swing.JButton();
    fromOtherButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator1 = new javax.swing.JSeparator();
    publishedGenomeRadio = new javax.swing.JRadioButton();
    javax.swing.JLabel speciesLabel = new javax.swing.JLabel();
    genomesCombo = new javax.swing.JComboBox();
    auxiliaryPanel = new javax.swing.JPanel();
    javax.swing.JSeparator jSeparator2 = new javax.swing.JSeparator();
    userSpecifiedRadio = new javax.swing.JRadioButton();
    javax.swing.JLabel nameLabel = new javax.swing.JLabel();
    nameField = new javax.swing.JTextField();
    javax.swing.JLabel lengthLabel = new javax.swing.JLabel();
    lengthField = new javax.swing.JTextField();
    javax.swing.JSeparator jSeparator3 = new javax.swing.JSeparator();
    okButton = new javax.swing.JButton();
    javax.swing.JButton cancelButton = new javax.swing.JButton();

    withoutSequenceButtonGroup.add(publishedGenomeRadio);
    withoutSequenceButtonGroup.add(userSpecifiedRadio);

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Load Genome");
    getContentPane().setLayout(new java.awt.GridBagLayout());

    fromLabel.setText("Load from:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(30, 30, 3, 3);
    getContentPane().add(fromLabel, gridBagConstraints);

    fromFileButton.setText("File");
    fromFileButton.setPreferredSize(new java.awt.Dimension(150, 29));
    fromFileButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            fromFileButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
    getContentPane().add(fromFileButton, gridBagConstraints);

    fromURLButton.setText("URL");
    fromURLButton.setPreferredSize(new java.awt.Dimension(150, 29));
    fromURLButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            fromURLButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
    getContentPane().add(fromURLButton, gridBagConstraints);

    fromOtherButton.setText("Other Datasource");
    fromOtherButton.setPreferredSize(new java.awt.Dimension(150, 29));
    fromOtherButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            fromOtherButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
    getContentPane().add(fromOtherButton, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.ipadx = 9;
    gridBagConstraints.ipady = 9;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 15, 3, 15);
    getContentPane().add(jSeparator1, gridBagConstraints);

    publishedGenomeRadio.setSelected(true);
    publishedGenomeRadio.setText("Published Genome");
    publishedGenomeRadio.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            publishedGenomeRadioActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 30, 3, 3);
    getContentPane().add(publishedGenomeRadio, gridBagConstraints);

    speciesLabel.setText("Genome:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(3, 30, 3, 3);
    getContentPane().add(speciesLabel, gridBagConstraints);

    genomesCombo.setToolTipText("Species of a published genome to load");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 30);
    getContentPane().add(genomesCombo, gridBagConstraints);

    auxiliaryPanel.setLayout(new java.awt.GridBagLayout());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.ipadx = 30;
    gridBagConstraints.ipady = 30;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 30);
    getContentPane().add(auxiliaryPanel, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.ipadx = 9;
    gridBagConstraints.ipady = 9;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 15, 3, 15);
    getContentPane().add(jSeparator2, gridBagConstraints);

    userSpecifiedRadio.setText("User-specified");
    userSpecifiedRadio.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            userSpecifiedRadioActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 30, 3, 3);
    getContentPane().add(userSpecifiedRadio, gridBagConstraints);

    nameLabel.setText("Name:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    getContentPane().add(nameLabel, gridBagConstraints);

    nameField.setToolTipText("Name of reference (must correspond to name in records)");
    nameField.setEnabled(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 90);
    getContentPane().add(nameField, gridBagConstraints);

    lengthLabel.setText("Length:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 9;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    getContentPane().add(lengthLabel, gridBagConstraints);

    lengthField.setToolTipText("Length in basepairs of reference");
    lengthField.setEnabled(false);
    lengthField.addFocusListener(new java.awt.event.FocusAdapter() {
        public void focusLost(java.awt.event.FocusEvent evt) {
            lengthFieldFocusLost(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 9;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 150);
    getContentPane().add(lengthField, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.ipadx = 9;
    gridBagConstraints.ipady = 9;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 15, 3, 15);
    getContentPane().add(jSeparator3, gridBagConstraints);

    okButton.setText("OK");
    okButton.setPreferredSize(new java.awt.Dimension(90, 29));
    okButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            okButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 5;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 3, 30, 30);
    getContentPane().add(okButton, gridBagConstraints);

    cancelButton.setText("Cancel");
    cancelButton.setPreferredSize(new java.awt.Dimension(90, 29));
    cancelButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
    gridBagConstraints.weightx = 0.5;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 3, 30, 3);
    getContentPane().add(cancelButton, gridBagConstraints);

    pack();
}

From source file:savant.view.dialog.PluginManagerDialog.java

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

    javax.swing.JLabel pluginsCaption = new javax.swing.JLabel();
    javax.swing.JButton fromFileButton = new javax.swing.JButton();
    javax.swing.JButton fromRepositoryButton = new javax.swing.JButton();
    browserPanel = new javax.swing.JPanel();
    closeButton = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setIconImage(null);
    setIconImages(null);

    pluginsCaption.setText("Installed Plugins");

    fromFileButton.setText("Install from File");
    fromFileButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            fromFileButtonActionPerformed(evt);
        }
    });

    fromRepositoryButton.setText("Install from Repository");
    fromRepositoryButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            fromRepositoryButtonActionPerformed(evt);
        }
    });

    browserPanel.setBackground(new java.awt.Color(255, 255, 255));
    browserPanel.setLayout(new java.awt.BorderLayout());

    closeButton.setText("Dismiss");
    closeButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            closeButtonActionPerformed(evt);
        }
    });

    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(browserPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 549, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(layout.createSequentialGroup().addComponent(pluginsCaption)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    302, Short.MAX_VALUE))
                                    .addGroup(layout.createSequentialGroup().addComponent(closeButton)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(fromRepositoryButton).addPreferredGap(
                                                    javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                            .addComponent(fromFileButton)))
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(pluginsCaption)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(browserPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(fromFileButton).addComponent(closeButton)
                            .addComponent(fromRepositoryButton))
                    .addContainerGap()));

    pack();
}