Example usage for java.awt GridBagConstraints BOTH

List of usage examples for java.awt GridBagConstraints BOTH

Introduction

In this page you can find the example usage for java.awt GridBagConstraints BOTH.

Prototype

int BOTH

To view the source code for java.awt GridBagConstraints BOTH.

Click Source Link

Document

Resize the component both horizontally and vertically.

Usage

From source file:de.codesourcery.flocking.KDTree.java

public static void main(String[] args) {
    final KDTree<Vec2d> tree = new KDTree<Vec2d>();

    Random rnd = new Random(System.currentTimeMillis());
    for (int i = 0; i < 100; i++) {
        final double x = rnd.nextDouble() * MODEL_WIDTH;
        final double y = rnd.nextDouble() * MODEL_HEIGHT;
        tree.add(x, y, new Vec2d(x, y));
    }/* w ww. j  ava 2 s . c  om*/

    final MyPanel panel = new MyPanel(tree);

    panel.setPreferredSize(new Dimension((int) MODEL_WIDTH * 2, (int) MODEL_HEIGHT * 2));

    panel.addMouseListener(new MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent e) {
            final Vec2d p = panel.viewToModel(e.getX(), e.getY());
            panel.mark(p.x, p.y, 55);
        };
    });

    final JFrame frame = new JFrame("KDTreeTest");

    frame.addKeyListener(new KeyAdapter() {

        public void keyTyped(java.awt.event.KeyEvent e) {
        };
    });
    frame.getContentPane().setLayout(new GridBagLayout());
    final GridBagConstraints cnstrs = new GridBagConstraints();
    cnstrs.fill = GridBagConstraints.BOTH;
    cnstrs.gridx = GridBagConstraints.REMAINDER;
    cnstrs.gridy = GridBagConstraints.REMAINDER;
    cnstrs.weightx = 1.0;
    cnstrs.weighty = 1.0;
    frame.getContentPane().add(panel, cnstrs);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
}

From source file:com._17od.upm.gui.MainWindow.java

private void addComponentsToPane() {

    // Ensure the layout manager is a BorderLayout
    if (!(getContentPane().getLayout() instanceof GridBagLayout)) {
        getContentPane().setLayout(new GridBagLayout());
    }//w w  w  .  jav a 2  s .  com

    // Create the menubar
    setJMenuBar(createMenuBar());

    GridBagConstraints c = new GridBagConstraints();

    // The toolbar Row
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.insets = new Insets(0, 0, 0, 0);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.HORIZONTAL;
    Component toolbar = createToolBar();
    getContentPane().add(toolbar, c);

    // Keep the frame background color consistent
    getContentPane().setBackground(toolbar.getBackground());

    // The seperator Row
    c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.HORIZONTAL;
    getContentPane().add(new JSeparator(), c);

    // The search field row
    searchIcon = new JLabel(Util.loadImage("search.gif"));
    searchIcon.setDisabledIcon(Util.loadImage("search_d.gif"));
    searchIcon.setEnabled(false);
    c.gridx = 0;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(5, 1, 5, 1);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    getContentPane().add(searchIcon, c);

    searchField = new JTextField(15);
    searchField.setEnabled(false);
    searchField.setMinimumSize(searchField.getPreferredSize());
    searchField.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            // This method never seems to be called
        }

        public void insertUpdate(DocumentEvent e) {
            dbActions.filter();
        }

        public void removeUpdate(DocumentEvent e) {
            dbActions.filter();
        }
    });
    searchField.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                dbActions.resetSearch();
            } else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                // If the user hits the enter key in the search field and
                // there's only one item
                // in the listview then open that item (this code assumes
                // that the one item in
                // the listview has already been selected. this is done
                // automatically in the
                // DatabaseActions.filter() method)
                if (accountsListview.getModel().getSize() == 1) {
                    viewAccountMenuItem.doClick();
                }
            }
        }
    });
    c.gridx = 1;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(5, 1, 5, 1);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    getContentPane().add(searchField, c);

    resetSearchButton = new JButton(Util.loadImage("stop.gif"));
    resetSearchButton.setDisabledIcon(Util.loadImage("stop_d.gif"));
    resetSearchButton.setEnabled(false);
    resetSearchButton.setToolTipText(Translator.translate(RESET_SEARCH_TXT));
    resetSearchButton.setActionCommand(RESET_SEARCH_TXT);
    resetSearchButton.addActionListener(this);
    resetSearchButton.setBorder(BorderFactory.createEmptyBorder());
    resetSearchButton.setFocusable(false);
    c.gridx = 2;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(5, 1, 5, 1);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    getContentPane().add(resetSearchButton, c);

    // The accounts listview row
    accountsListview = new JList();
    accountsListview.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    accountsListview.setSelectedIndex(0);
    accountsListview.setVisibleRowCount(10);
    accountsListview.setModel(new SortedListModel());
    JScrollPane accountsScrollList = new JScrollPane(accountsListview, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    accountsListview.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            // If the listview gets focus, there is one ore more items in
            // the listview and there is nothing
            // already selected, then select the first item in the list
            if (accountsListview.getModel().getSize() > 0 && accountsListview.getSelectedIndex() == -1) {
                accountsListview.setSelectionInterval(0, 0);
            }
        }
    });
    accountsListview.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            dbActions.setButtonState();
        }
    });
    accountsListview.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                viewAccountMenuItem.doClick();
            }
        }
    });
    accountsListview.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                viewAccountMenuItem.doClick();
            }
        }
    });
    // Create a shortcut to delete account functionality with DEL(delete)
    // key

    accountsListview.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_DELETE) {

                try {
                    dbActions.reloadDatabaseBefore(new DeleteAccountAction());
                } catch (InvalidPasswordException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                } catch (ProblemReadingDatabaseFile e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                } catch (IOException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }

            }
        }
    });

    c.gridx = 0;
    c.gridy = 3;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new Insets(0, 1, 1, 1);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.BOTH;
    getContentPane().add(accountsScrollList, c);

    // The "File Changed" panel
    c.gridx = 0;
    c.gridy = 4;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new Insets(0, 1, 0, 1);
    c.ipadx = 3;
    c.ipady = 3;
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.BOTH;
    databaseFileChangedPanel = new JPanel();
    databaseFileChangedPanel.setLayout(new BoxLayout(databaseFileChangedPanel, BoxLayout.X_AXIS));
    databaseFileChangedPanel.setBackground(new Color(249, 172, 60));
    databaseFileChangedPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    JLabel fileChangedLabel = new JLabel("Database file changed");
    fileChangedLabel.setAlignmentX(LEFT_ALIGNMENT);
    databaseFileChangedPanel.add(fileChangedLabel);
    databaseFileChangedPanel.add(Box.createHorizontalGlue());
    JButton reloadButton = new JButton("Reload");
    reloadButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                dbActions.reloadDatabaseFromDisk();
            } catch (Exception ex) {
                dbActions.errorHandler(ex);
            }
        }
    });
    databaseFileChangedPanel.add(reloadButton);
    databaseFileChangedPanel.setVisible(false);
    getContentPane().add(databaseFileChangedPanel, c);

    // Add the statusbar
    c.gridx = 0;
    c.gridy = 5;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new Insets(0, 1, 1, 1);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.HORIZONTAL;
    getContentPane().add(statusBar, c);

}

From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java

private JPanel createLanguagePanel(int stentWidth) {
    // Language radios.
    MultiBitTitledPanel languagePanel = new MultiBitTitledPanel(
            controller.getLocaliser().getString("showPreferencesPanel.languageTitle"),
            ComponentOrientation.getOrientation(controller.getLocaliser().getLocale()));

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 0;/*from  w  ww . j a v  a 2 s  .  c om*/
    constraints.gridy = 3;
    constraints.weightx = 0.1;
    constraints.weighty = 0.05;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    JPanel indent = MultiBitTitledPanel.getIndentPanel(1);
    languagePanel.add(indent, constraints);

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 1;
    constraints.gridy = 3;
    constraints.weightx = 0.3;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    JPanel stent = MultiBitTitledPanel.createStent(stentWidth);
    languagePanel.add(stent, constraints);

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 2;
    constraints.gridy = 3;
    constraints.weightx = 0.05;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.CENTER;
    languagePanel.add(MultiBitTitledPanel.createStent(MultiBitTitledPanel.SEPARATION_BETWEEN_NAME_VALUE_PAIRS),
            constraints);

    ButtonGroup languageUsageGroup = new ButtonGroup();
    useDefaultLocale = new JRadioButton(controller.getLocaliser().getString("showPreferencesPanel.useDefault"));
    useDefaultLocale.setOpaque(false);
    useDefaultLocale.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());

    JRadioButton useSpecific = new JRadioButton(
            controller.getLocaliser().getString("showPreferencesPanel.useSpecific"));
    useSpecific.setOpaque(false);
    useSpecific.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());

    ItemListener itemListener = new ChangeLanguageUsageListener();
    useDefaultLocale.addItemListener(itemListener);
    useSpecific.addItemListener(itemListener);
    languageUsageGroup.add(useDefaultLocale);
    languageUsageGroup.add(useSpecific);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 4;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    languagePanel.add(useDefaultLocale, constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 5;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    languagePanel.add(useSpecific, constraints);

    // Language combo box.
    int numberOfLanguages = Integer
            .parseInt(controller.getLocaliser().getString("showPreferencesPanel.numberOfLanguages"));

    // Languages are added to the combo box in alphabetic order.
    languageDataSet = new TreeSet<LanguageData>();

    for (int i = 0; i < numberOfLanguages; i++) {
        String languageCode = controller.getLocaliser()
                .getString("showPreferencesPanel.languageCode." + (i + 1));
        String language = controller.getLocaliser().getString("showPreferencesPanel.language." + (i + 1));

        LanguageData languageData = new LanguageData();
        languageData.languageCode = languageCode;
        languageData.language = language;
        languageData.image = createImageIcon(languageCode);
        languageData.image.setDescription(language);
        languageDataSet.add(languageData);
    }

    Integer[] indexArray = new Integer[languageDataSet.size()];
    int index = 0;
    for (@SuppressWarnings("unused")
    LanguageData languageData : languageDataSet) {
        indexArray[index] = index;
        index++;
    }
    languageComboBox = new JComboBox(indexArray);
    languageComboBox.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());
    languageComboBox.setOpaque(false);
    LanguageComboBoxRenderer renderer = new LanguageComboBoxRenderer();

    FontMetrics fontMetrics = getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont());
    Dimension preferredSize = new Dimension(fontMetrics.stringWidth(A_LONG_LANGUAGE_NAME)
            + LANGUAGE_COMBO_WIDTH_DELTA + LANGUAGE_CODE_IMAGE_WIDTH,
            fontMetrics.getHeight() + COMBO_HEIGHT_DELTA);
    renderer.setPreferredSize(preferredSize);

    languageComboBox.setRenderer(renderer);

    // Get the languageCode value stored in the model.
    String userLanguageCode = controller.getModel().getUserPreference(CoreModel.USER_LANGUAGE_CODE);
    if (userLanguageCode == null || CoreModel.USER_LANGUAGE_IS_DEFAULT.equals(userLanguageCode)) {
        useDefaultLocale.setSelected(true);
        languageComboBox.setEnabled(false);
    } else {
        useSpecific.setSelected(true);
        int startingIndex = 0;
        Integer languageCodeIndex = 0;
        for (LanguageData languageData : languageDataSet) {
            if (languageData.languageCode.equals(userLanguageCode)) {
                languageCodeIndex = startingIndex;
                break;
            }
            startingIndex++;
        }
        if (languageCodeIndex != 0) {
            languageComboBox.setSelectedItem(languageCodeIndex);
            languageComboBox.setEnabled(true);
        }
    }

    // Store original value for use by submit action.
    originalUserLanguageCode = userLanguageCode;

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 6;
    constraints.weightx = 0.8;
    constraints.weighty = 0.6;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    languagePanel.add(languageComboBox, constraints);

    JPanel fill1 = new JPanel();
    fill1.setOpaque(false);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 4;
    constraints.gridy = 6;
    constraints.weightx = 20;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    languagePanel.add(fill1, constraints);

    return languagePanel;
}

From source file:org.openconcerto.erp.core.sales.credit.component.AvoirClientSQLComponent.java

public void addViews() {
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();
    textNumero = new JUniqueTextField(16);
    // Champ Module
    c.gridx = 0;//from   w w  w  .j  av  a  2 s . c om
    c.gridy++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    final JPanel addP = ComptaSQLConfElement.createAdditionalPanel();
    this.setAdditionalFieldsPanel(new FormLayouter(addP, 1));
    this.add(addP, c);

    c.gridy++;
    c.gridwidth = 1;

    this.textNom = new JTextField();
    this.date = new JDate(true);

    this.date.addValueListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            fireValidChange();

        }
    });

    // Ligne 1: Numero
    this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c);
    c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    c.gridx++;

    DefaultGridBagConstraints.lockMinimumSize(textNumero);
    this.add(this.textNumero, c);

    // Date
    c.gridx++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(new JLabel("Date", SwingConstants.RIGHT), c);
    c.gridx++;
    c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    this.add(this.date, c);

    // Ligne 2: Libell
    c.gridx = 0;
    c.gridy++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT), c);
    c.gridx++;
    // c.weightx = 1;
    this.add(this.textNom, c);

    // Commercial
    c.gridx++;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    this.comboCommercial = new ElementComboBox();
    this.comboCommercial.setMinimumSize(this.comboCommercial.getPreferredSize());
    this.add(new JLabel(getLabelFor("ID_COMMERCIAL"), SwingConstants.RIGHT), c);
    c.gridx++;
    // c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    this.add(this.comboCommercial, c);

    this.addSQLObject(this.comboCommercial, "ID_COMMERCIAL");

    // Ligne 3: Motif
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy++;
    c.weightx = 0;
    this.add(new JLabel(getLabelFor("MOTIF"), SwingConstants.RIGHT), c);
    c.gridx++;
    c.gridwidth = 3;
    // c.weightx = 1;

    JTextField textMotif = new JTextField();
    this.add(textMotif, c);

    // Client
    c.gridx = 0;
    c.gridy++;
    // c.weightx = 0;
    c.gridwidth = 1;
    this.add(new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT), c);
    c.gridx++;
    c.gridwidth = 3;
    // c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    this.add(this.comboClient, c);
    // Adresse spe
    c.gridx = 0;
    c.gridy++;
    c.fill = GridBagConstraints.HORIZONTAL;
    // c.weightx = 0;
    c.gridwidth = 1;
    this.add(new JLabel(getLabelFor("ID_ADRESSE"), SwingConstants.RIGHT), c);

    c.gridx++;
    c.gridwidth = 3;
    // c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    this.add(this.comboAdresse, c);
    final ComptaPropsConfiguration comptaPropsConfiguration = ((ComptaPropsConfiguration) Configuration
            .getInstance());

    // Contact
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    // c.weightx = 0;
    final JLabel labelContact = new JLabel(getLabelFor("ID_CONTACT"), SwingConstants.RIGHT);
    this.add(labelContact, c);

    c.gridx++;
    c.gridwidth = 3;
    // c.weightx = 1;
    c.fill = GridBagConstraints.NONE;

    this.add(selectContact, c);
    final SQLElement contactElement = getElement().getForeignElement("ID_CONTACT");
    selectContact.init(contactElement, contactElement.getComboRequest(true));
    this.addView(selectContact, "ID_CONTACT");
    this.defaultContactRowValues = new SQLRowValues(selectContact.getRequest().getPrimaryTable());
    selectContact.getAddComp().setDefaults(this.defaultContactRowValues);

    // Compte Service
    this.checkCompteServiceAuto = new JCheckBox(getLabelFor("COMPTE_SERVICE_AUTO"));
    this.addSQLObject(this.checkCompteServiceAuto, "COMPTE_SERVICE_AUTO");
    this.compteSelService = new ISQLCompteSelector();

    this.labelCompteServ = new JLabel("Compte Service");
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 1;
    // c.weightx = 0;
    this.labelCompteServ.setHorizontalAlignment(SwingConstants.RIGHT);
    this.add(this.labelCompteServ, c);

    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    // c.weightx = 1;
    this.add(this.compteSelService, c);

    this.addRequiredSQLObject(this.compteSelService, "ID_COMPTE_PCE_SERVICE");

    String valServ = DefaultNXProps.getInstance().getStringProperty("ArticleService");
    Boolean bServ = Boolean.valueOf(valServ);
    if (!bServ) {
        this.labelCompteServ.setVisible(false);
        this.compteSelService.setVisible(false);
    }

    this.checkCompteServiceAuto.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setCompteServiceVisible(!AvoirClientSQLComponent.this.checkCompteServiceAuto.isSelected());
        }
    });

    // setCompteServiceVisible(!(bServ != null && !bServ.booleanValue()));

    // Tarif
    if (this.getTable().getFieldsName().contains("ID_TARIF")) {
        // TARIF
        c.gridy++;
        c.gridx = 0;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        this.add(new JLabel("Tarif  appliquer", SwingConstants.RIGHT), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;

        c.weightx = 1;
        this.add(boxTarif, c);
        this.addView(boxTarif, "ID_TARIF");
        boxTarif.addValueListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                table.setTarif(boxTarif.getSelectedRow(), false);
            }
        });
    }

    // Table
    this.table = new AvoirItemTable();
    c.gridx = 0;
    c.gridy++;
    c.fill = GridBagConstraints.BOTH;
    c.gridheight = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weighty = 1;
    // c.weightx = 0;
    this.add(this.table, c);
    this.addView(this.table.getRowValuesTable(), "");

    // Panel du bas
    final JPanel panelBottom = getBottomPanel();
    c.gridy++;
    c.weighty = 0;
    this.add(panelBottom, c);

    // Infos

    c.gridheight = 1;
    c.gridx = 0;
    c.gridy++;
    this.add(new JLabel(getLabelFor("INFOS")), c);

    c.gridy++;
    c.fill = GridBagConstraints.BOTH;
    c.weighty = 0;
    c.gridwidth = 4;
    ITextArea infos = new ITextArea(4, 4);
    infos.setBorder(null);
    JScrollPane scrollPane = new JScrollPane(infos);
    DefaultGridBagConstraints.lockMinimumSize(scrollPane);
    this.add(scrollPane, c);

    //
    // Impression
    this.panelGestDoc = new PanelOOSQLComponent(this);
    c.fill = GridBagConstraints.NONE;
    c.gridy++;
    c.anchor = GridBagConstraints.EAST;
    this.add(panelGestDoc, c);

    this.addSQLObject(this.textNom, "NOM");
    if (getTable().contains("INFOS")) {
        this.addSQLObject(infos, "INFOS");
    }
    this.addSQLObject(this.boxAdeduire, "A_DEDUIRE");
    this.addSQLObject(textMotif, "MOTIF");
    this.addSQLObject(this.comboAdresse, "ID_ADRESSE");

    this.addRequiredSQLObject(this.textNumero, "NUMERO");
    this.addRequiredSQLObject(this.date, "DATE");
    this.addRequiredSQLObject(this.comboClient, "ID_CLIENT");

    this.boxAdeduire.addActionListener(this);

    this.comboClient.addModelListener("wantedID", this.listenerModeReglDefaut);
    this.comboClient.addModelListener("wantedID", this.changeClientListener);
    DefaultGridBagConstraints.lockMinimumSize(comboClient);
    DefaultGridBagConstraints.lockMinimumSize(this.comboAdresse);
    DefaultGridBagConstraints.lockMinimumSize(this.comboBanque);
    DefaultGridBagConstraints.lockMinimumSize(comboCommercial);

}

From source file:org.languagetool.gui.Main.java

private void createGUI() {
    loadRecentFiles();//from  ww  w  .  ja va  2s  . c  o m
    frame = new JFrame("LanguageTool " + JLanguageTool.VERSION);

    setLookAndFeel();
    openAction = new OpenAction();
    saveAction = new SaveAction();
    saveAsAction = new SaveAsAction();
    checkAction = new CheckAction();
    autoCheckAction = new AutoCheckAction(true);
    showResultAction = new ShowResultAction(true);

    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    frame.addWindowListener(new CloseListener());
    URL iconUrl = JLanguageTool.getDataBroker().getFromResourceDirAsUrl(TRAY_ICON);
    frame.setIconImage(new ImageIcon(iconUrl).getImage());

    textArea = new JTextArea();
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    textArea.addKeyListener(new ControlReturnTextCheckingListener());

    textLineNumber = new TextLineNumber(textArea, 2);
    numberedTextAreaPane = new JScrollPane(textArea);
    numberedTextAreaPane.setRowHeaderView(textLineNumber);

    resultArea = new JTextPane();
    undoRedo = new UndoRedoSupport(this.textArea, messages);
    frame.setJMenuBar(createMenuBar());

    GridBagConstraints buttonCons = new GridBagConstraints();

    JPanel insidePanel = new JPanel();
    insidePanel.setOpaque(false);
    insidePanel.setLayout(new GridBagLayout());

    buttonCons.gridx = 0;
    buttonCons.gridy = 0;
    buttonCons.anchor = GridBagConstraints.LINE_START;
    insidePanel.add(new JLabel(messages.getString("textLanguage") + " "), buttonCons);

    //create a ComboBox with flags, do not include hidden languages
    languageBox = LanguageComboBox.create(messages, EXTERNAL_LANGUAGE_SUFFIX, true, false);
    buttonCons.gridx = 1;
    buttonCons.gridy = 0;
    buttonCons.anchor = GridBagConstraints.LINE_START;
    insidePanel.add(languageBox, buttonCons);

    JCheckBox autoDetectBox = new JCheckBox(messages.getString("atd"));
    buttonCons.gridx = 2;
    buttonCons.gridy = 0;
    buttonCons.gridwidth = GridBagConstraints.REMAINDER;
    buttonCons.anchor = GridBagConstraints.LINE_START;
    insidePanel.add(autoDetectBox, buttonCons);

    buttonCons.gridx = 0;
    buttonCons.gridy = 1;
    buttonCons.gridwidth = GridBagConstraints.REMAINDER;
    buttonCons.fill = GridBagConstraints.HORIZONTAL;
    buttonCons.anchor = GridBagConstraints.LINE_END;
    buttonCons.weightx = 1.0;
    insidePanel.add(statusLabel, buttonCons);

    Container contentPane = frame.getContentPane();
    GridBagLayout gridLayout = new GridBagLayout();
    contentPane.setLayout(gridLayout);
    GridBagConstraints cons = new GridBagConstraints();

    cons.gridx = 0;
    cons.gridy = 1;
    cons.fill = GridBagConstraints.HORIZONTAL;
    cons.anchor = GridBagConstraints.FIRST_LINE_START;
    JToolBar toolbar = new JToolBar("Toolbar", JToolBar.HORIZONTAL);
    toolbar.setFloatable(false);
    contentPane.add(toolbar, cons);

    JButton openButton = new JButton(openAction);
    openButton.setHideActionText(true);
    openButton.setFocusable(false);
    toolbar.add(openButton);

    JButton saveButton = new JButton(saveAction);
    saveButton.setHideActionText(true);
    saveButton.setFocusable(false);
    toolbar.add(saveButton);

    JButton saveAsButton = new JButton(saveAsAction);
    saveAsButton.setHideActionText(true);
    saveAsButton.setFocusable(false);
    toolbar.add(saveAsButton);

    JButton spellButton = new JButton(this.checkAction);
    spellButton.setHideActionText(true);
    spellButton.setFocusable(false);
    toolbar.add(spellButton);

    JToggleButton autoSpellButton = new JToggleButton(autoCheckAction);
    autoSpellButton.setHideActionText(true);
    autoSpellButton.setFocusable(false);
    toolbar.add(autoSpellButton);

    JButton clearTextButton = new JButton(new ClearTextAction());
    clearTextButton.setHideActionText(true);
    clearTextButton.setFocusable(false);
    toolbar.add(clearTextButton);

    cons.insets = new Insets(5, 5, 5, 5);
    cons.fill = GridBagConstraints.BOTH;
    cons.weightx = 10.0f;
    cons.weighty = 10.0f;
    cons.gridx = 0;
    cons.gridy = 2;
    cons.weighty = 5.0f;
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, numberedTextAreaPane, new JScrollPane(resultArea));
    mainPanel.setLayout(new GridLayout(0, 1));
    contentPane.add(mainPanel, cons);
    mainPanel.add(splitPane);

    cons.fill = GridBagConstraints.HORIZONTAL;
    cons.gridx = 0;
    cons.gridy = 3;
    cons.weightx = 1.0f;
    cons.weighty = 0.0f;
    cons.insets = new Insets(4, 12, 4, 12);
    contentPane.add(insidePanel, cons);

    ltSupport = new LanguageToolSupport(this.frame, this.textArea, this.undoRedo);
    ResultAreaHelper.install(messages, ltSupport, resultArea);
    languageBox.selectLanguage(ltSupport.getLanguage());
    languageBox.setEnabled(!ltSupport.getConfig().getAutoDetect());
    autoDetectBox.setSelected(ltSupport.getConfig().getAutoDetect());
    taggerShowsDisambigLog = ltSupport.getConfig().getTaggerShowsDisambigLog();

    languageBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                // we cannot re-use the existing LT object anymore
                frame.applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault()));
                Language lang = languageBox.getSelectedLanguage();
                ComponentOrientation componentOrientation = ComponentOrientation
                        .getOrientation(lang.getLocale());
                textArea.applyComponentOrientation(componentOrientation);
                resultArea.applyComponentOrientation(componentOrientation);
                ltSupport.setLanguage(lang);
            }
        }
    });
    autoDetectBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            boolean selected = e.getStateChange() == ItemEvent.SELECTED;
            languageBox.setEnabled(!selected);
            ltSupport.getConfig().setAutoDetect(selected);
            if (selected) {
                Language detected = ltSupport.autoDetectLanguage(textArea.getText());
                languageBox.selectLanguage(detected);
            }
        }
    });
    ltSupport.addLanguageToolListener(new LanguageToolListener() {
        @Override
        public void languageToolEventOccurred(LanguageToolEvent event) {
            if (event.getType() == LanguageToolEvent.Type.CHECKING_STARTED) {
                String msg = org.languagetool.tools.Tools.i18n(messages, "checkStart");
                statusLabel.setText(msg);
                if (event.getCaller() == getFrame()) {
                    setWaitCursor();
                    checkAction.setEnabled(false);
                }
            } else if (event.getType() == LanguageToolEvent.Type.CHECKING_FINISHED) {
                if (event.getCaller() == getFrame()) {
                    checkAction.setEnabled(true);
                    unsetWaitCursor();
                }
                String msg = org.languagetool.tools.Tools.i18n(messages, "checkDone",
                        event.getSource().getMatches().size(), event.getElapsedTime());
                statusLabel.setText(msg);
            } else if (event.getType() == LanguageToolEvent.Type.LANGUAGE_CHANGED) {
                languageBox.selectLanguage(ltSupport.getLanguage());
            } else if (event.getType() == LanguageToolEvent.Type.RULE_ENABLED) {
                //this will trigger a check and the result will be updated by
                //the CHECKING_FINISHED event
            } else if (event.getType() == LanguageToolEvent.Type.RULE_DISABLED) {
                String msg = org.languagetool.tools.Tools.i18n(messages, "checkDoneNoTime",
                        event.getSource().getMatches().size());
                statusLabel.setText(msg);
            }
        }
    });
    frame.applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault()));
    Language lang = ltSupport.getLanguage();
    ComponentOrientation componentOrientation = ComponentOrientation.getOrientation(lang.getLocale());
    textArea.applyComponentOrientation(componentOrientation);
    resultArea.applyComponentOrientation(componentOrientation);

    ResourceBundle textLanguageMessageBundle = JLanguageTool.getMessageBundle(ltSupport.getLanguage());
    textArea.setText(textLanguageMessageBundle.getString("guiDemoText"));

    Configuration config = ltSupport.getConfig();
    if (config.getFontName() != null || config.getFontStyle() != Configuration.FONT_STYLE_INVALID
            || config.getFontSize() != Configuration.FONT_SIZE_INVALID) {
        String fontName = config.getFontName();
        if (fontName == null) {
            fontName = textArea.getFont().getFamily();
        }
        int fontSize = config.getFontSize();
        if (fontSize == Configuration.FONT_SIZE_INVALID) {
            fontSize = textArea.getFont().getSize();
        }
        Font font = new Font(fontName, config.getFontStyle(), fontSize);
        textArea.setFont(font);
    }

    frame.pack();
    frame.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    frame.setLocationByPlatform(true);
    splitPane.setDividerLocation(200);
    MainWindowStateBean state = localStorage.loadProperty("gui.state", MainWindowStateBean.class);
    if (state != null) {
        if (state.getBounds() != null) {
            frame.setBounds(state.getBounds());
            ResizeComponentListener.setBoundsProperty(frame, state.getBounds());
        }
        if (state.getDividerLocation() != null) {
            splitPane.setDividerLocation(state.getDividerLocation());
        }
        if (state.getState() != null) {
            frame.setExtendedState(state.getState());
        }
    }
    ResizeComponentListener.attachToWindow(frame);
    maybeStartServer();
}

From source file:org.broad.igv.cbio.FilterGeneNetworkUI.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    tabbedPane = new JTabbedPane();
    dialogPane = new JPanel();
    panel1 = new JPanel();
    addRow = new JButton();
    contentPane = new JPanel();
    scrollPane1 = new JScrollPane();
    geneTable = new JTable();
    buttonBar = new JPanel();
    totNumGenes = new JLabel();
    keepIsolated = new JCheckBox();
    okButton = new JButton();
    refFilter = new JButton();
    cancelButton = new JButton();
    helpButton = new JButton();
    saveButton = new JButton();
    thresholds = new JPanel();
    contentPanel = new JPanel();
    label2 = new JLabel();
    label3 = new JLabel();
    delInput = new JTextField();
    label4 = new JLabel();
    expUpInput = new JTextField();
    label7 = new JLabel();
    expDownInput = new JTextField();
    ampInput = new JTextField();
    label1 = new JLabel();
    mutInput = new JTextField();
    label6 = new JLabel();
    label8 = new JLabel();
    separator1 = new JSeparator();
    separator3 = new JSeparator();
    separator2 = new JSeparator();
    panel2 = new JPanel();
    textArea1 = new JTextArea();

    //======== this ========
    setMinimumSize(new Dimension(600, 22));
    setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
    Container contentPane2 = getContentPane();
    contentPane2.setLayout(new BorderLayout());

    //======== tabbedPane ========
    {/*  w ww . jav a2 s.  c  o  m*/
        tabbedPane.setPreferredSize(new Dimension(550, 346));
        tabbedPane.setMinimumSize(new Dimension(550, 346));
        tabbedPane.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                tabbedPaneStateChanged(e);
            }
        });

        //======== dialogPane ========
        {
            dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
            dialogPane.setMinimumSize(new Dimension(443, 300));
            dialogPane.setPreferredSize(new Dimension(443, 300));
            dialogPane.setLayout(new GridBagLayout());
            ((GridBagLayout) dialogPane.getLayout()).columnWidths = new int[] { 0, 0 };
            ((GridBagLayout) dialogPane.getLayout()).rowHeights = new int[] { 0, 0, 0, 0, 0, 0 };
            ((GridBagLayout) dialogPane.getLayout()).columnWeights = new double[] { 1.0, 1.0E-4 };
            ((GridBagLayout) dialogPane.getLayout()).rowWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0,
                    1.0E-4 };

            //======== panel1 ========
            {
                panel1.setLayout(new GridBagLayout());
                ((GridBagLayout) panel1.getLayout()).columnWidths = new int[] { 0, 0, 0 };
                ((GridBagLayout) panel1.getLayout()).rowHeights = new int[] { 0, 0 };
                ((GridBagLayout) panel1.getLayout()).columnWeights = new double[] { 0.0, 0.0, 1.0E-4 };
                ((GridBagLayout) panel1.getLayout()).rowWeights = new double[] { 0.0, 1.0E-4 };

                //---- addRow ----
                addRow.setText("Add Filter");
                addRow.setMaximumSize(new Dimension(200, 28));
                addRow.setMinimumSize(new Dimension(100, 28));
                addRow.setPreferredSize(new Dimension(150, 28));
                addRow.setVisible(false);
                addRow.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        addRowActionPerformed(e);
                    }
                });
                panel1.add(addRow, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                        GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
            }
            dialogPane.add(panel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

            //======== contentPane ========
            {
                contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
            }
            dialogPane.add(contentPane, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

            //======== scrollPane1 ========
            {

                //---- geneTable ----
                geneTable.setAutoCreateRowSorter(true);
                scrollPane1.setViewportView(geneTable);
            }
            dialogPane.add(scrollPane1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

            //======== buttonBar ========
            {
                buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
                buttonBar.setLayout(new GridBagLayout());
                ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] { 0, 85, 85, 80 };
                ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] { 1.0, 0.0, 0.0, 0.0 };

                //---- totNumGenes ----
                totNumGenes.setText("Total Genes: #");
                buttonBar.add(totNumGenes, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

                //---- keepIsolated ----
                keepIsolated.setText("Keep Isolated Genes");
                keepIsolated.setVisible(false);
                buttonBar.add(keepIsolated, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

                //---- okButton ----
                okButton.setText("View Network");
                okButton.setToolTipText("Display the network in a web browser");
                okButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        okButtonActionPerformed(e);
                    }
                });
                buttonBar.add(okButton, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                        GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));

                //---- refFilter ----
                refFilter.setText("Refresh Filter");
                refFilter.setVisible(false);
                refFilter.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        refFilterActionPerformed(e);
                    }
                });
                buttonBar.add(refFilter, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                        GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

                //---- cancelButton ----
                cancelButton.setText("Cancel");
                cancelButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cancelButtonActionPerformed(e);
                    }
                });
                buttonBar.add(cancelButton, new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

                //---- helpButton ----
                helpButton.setText("Help");
                helpButton.setVisible(false);
                buttonBar.add(helpButton, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

                //---- saveButton ----
                saveButton.setText("Save Table");
                saveButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        saveButtonActionPerformed(e);
                    }
                });
                buttonBar.add(saveButton, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0,
                        GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));
            }
            dialogPane.add(buttonBar, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
        }
        tabbedPane.addTab("Filter", dialogPane);

        //======== thresholds ========
        {
            thresholds.setPreferredSize(new Dimension(550, 196));
            thresholds.setMinimumSize(new Dimension(550, 196));
            thresholds.setLayout(null);

            //======== contentPanel ========
            {
                contentPanel.setBorder(new EtchedBorder());
                contentPanel.setLayout(null);

                //---- label2 ----
                label2.setText("Amplification:");
                label2.setHorizontalAlignment(SwingConstants.RIGHT);
                label2.setLabelFor(ampInput);
                label2.setToolTipText("Amplification score, on a log-normalized scale");
                label2.setPreferredSize(new Dimension(90, 18));
                contentPanel.add(label2);
                label2.setBounds(140, 96, label2.getPreferredSize().width, 18);

                //---- label3 ----
                label3.setText("Deletion:");
                label3.setHorizontalAlignment(SwingConstants.RIGHT);
                label3.setLabelFor(delInput);
                label3.setToolTipText("Deletion score, on a log-normalized scale");
                label3.setPreferredSize(new Dimension(60, 16));
                contentPanel.add(label3);
                label3.setBounds(360, 96, label3.getPreferredSize().width, 18);

                //---- delInput ----
                delInput.setText("0.7");
                delInput.setMinimumSize(new Dimension(34, 28));
                delInput.setPreferredSize(new Dimension(45, 28));
                delInput.setMaximumSize(new Dimension(50, 2147483647));
                contentPanel.add(delInput);
                delInput.setBounds(new Rectangle(new Point(240, 162), delInput.getPreferredSize()));

                //---- label4 ----
                label4.setText("Up:");
                label4.setHorizontalAlignment(SwingConstants.RIGHT);
                label4.setLabelFor(expUpInput);
                label4.setToolTipText("Expression score, log-normalized scale");
                label4.setPreferredSize(new Dimension(100, 18));
                contentPanel.add(label4);
                label4.setBounds(130, 168, label4.getPreferredSize().width, 18);

                //---- expUpInput ----
                expUpInput.setText("0.1");
                expUpInput.setMinimumSize(new Dimension(34, 28));
                expUpInput.setPreferredSize(new Dimension(45, 28));
                contentPanel.add(expUpInput);
                expUpInput.setBounds(new Rectangle(new Point(430, 91), expUpInput.getPreferredSize()));

                //---- label7 ----
                label7.setText("Down:");
                label7.setHorizontalAlignment(SwingConstants.RIGHT);
                label7.setLabelFor(expDownInput);
                label7.setToolTipText("Expression score, log-normalized scale");
                label7.setPreferredSize(new Dimension(120, 16));
                contentPanel.add(label7);
                label7.setBounds(300, 168, label7.getPreferredSize().width, 18);

                //---- expDownInput ----
                expDownInput.setText("0.1");
                expDownInput.setPreferredSize(new Dimension(45, 28));
                expDownInput.setMinimumSize(new Dimension(34, 28));
                expDownInput.setMaximumSize(new Dimension(50, 2147483647));
                contentPanel.add(expDownInput);
                expDownInput.setBounds(new Rectangle(new Point(430, 162), expDownInput.getPreferredSize()));

                //---- ampInput ----
                ampInput.setText("0.7");
                ampInput.setMinimumSize(new Dimension(34, 28));
                ampInput.setPreferredSize(new Dimension(45, 28));
                contentPanel.add(ampInput);
                ampInput.setBounds(new Rectangle(new Point(240, 91), ampInput.getPreferredSize()));

                //---- label1 ----
                label1.setText("Mutation:");
                label1.setHorizontalAlignment(SwingConstants.RIGHT);
                label1.setLabelFor(mutInput);
                label1.setToolTipText("Minimum number of mutations found");
                label1.setPreferredSize(new Dimension(66, 18));
                contentPanel.add(label1);
                label1.setBounds(50, 26, label1.getPreferredSize().width, 18);

                //---- mutInput ----
                mutInput.setText("1");
                mutInput.setAutoscrolls(false);
                mutInput.setMinimumSize(new Dimension(34, 28));
                mutInput.setPreferredSize(new Dimension(45, 28));
                contentPanel.add(mutInput);
                mutInput.setBounds(new Rectangle(new Point(240, 21), mutInput.getPreferredSize()));

                //---- label6 ----
                label6.setText("Copy Number:");
                contentPanel.add(label6);
                label6.setBounds(30, 96, label6.getPreferredSize().width, 18);

                //---- label8 ----
                label8.setText("Expression:");
                label8.setHorizontalAlignment(SwingConstants.RIGHT);
                contentPanel.add(label8);
                label8.setBounds(30, 168, 86, 18);
                contentPanel.add(separator1);
                separator1.setBounds(0, 135, 500, 10);
                contentPanel.add(separator3);
                separator3.setBounds(0, 65, 500, 10);

                //---- separator2 ----
                separator2.setPreferredSize(new Dimension(10, 210));
                separator2.setOrientation(SwingConstants.VERTICAL);
                contentPanel.add(separator2);
                separator2.setBounds(new Rectangle(new Point(120, 0), separator2.getPreferredSize()));

                { // compute preferred size
                    Dimension preferredSize = new Dimension();
                    for (int i = 0; i < contentPanel.getComponentCount(); i++) {
                        Rectangle bounds = contentPanel.getComponent(i).getBounds();
                        preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                        preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                    }
                    Insets insets = contentPanel.getInsets();
                    preferredSize.width += insets.right;
                    preferredSize.height += insets.bottom;
                    contentPanel.setMinimumSize(preferredSize);
                    contentPanel.setPreferredSize(preferredSize);
                }
            }
            thresholds.add(contentPanel);
            contentPanel.setBounds(12, 80, 500, 210);

            //======== panel2 ========
            {
                panel2.setLayout(null);

                { // compute preferred size
                    Dimension preferredSize = new Dimension();
                    for (int i = 0; i < panel2.getComponentCount(); i++) {
                        Rectangle bounds = panel2.getComponent(i).getBounds();
                        preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                        preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                    }
                    Insets insets = panel2.getInsets();
                    preferredSize.width += insets.right;
                    preferredSize.height += insets.bottom;
                    panel2.setMinimumSize(preferredSize);
                    panel2.setPreferredSize(preferredSize);
                }
            }
            thresholds.add(panel2);
            panel2.setBounds(new Rectangle(new Point(55, 25), panel2.getPreferredSize()));

            //---- textArea1 ----
            textArea1.setText(
                    "Samples are considered to have a given \"event\" if the value is above the thresholds below.");
            textArea1.setEditable(false);
            textArea1.setLineWrap(true);
            textArea1.setBackground(UIManager.getColor("Button.background"));
            thresholds.add(textArea1);
            textArea1.setBounds(15, 10, 430, 40);

            { // compute preferred size
                Dimension preferredSize = new Dimension();
                for (int i = 0; i < thresholds.getComponentCount(); i++) {
                    Rectangle bounds = thresholds.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = thresholds.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                thresholds.setMinimumSize(preferredSize);
                thresholds.setPreferredSize(preferredSize);
            }
        }
        tabbedPane.addTab("Thresholds", thresholds);

    }
    contentPane2.add(tabbedPane, BorderLayout.NORTH);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:com.rapidminer.gui.graphs.GraphViewer.java

private JComponent createControlPanel() {
    // === mouse behaviour ===
    if (graphMouse != null) {
        vv.setGraphMouse(graphMouse);//from   w  ww .j  a  v a 2 s  .c o  m
        vv.addKeyListener(graphMouse.getModeKeyListener());
        graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);
    }
    transformAction.setEnabled(false);
    pickingAction.setEnabled(true);

    vv.addGraphMouseListener(new GraphMouseListener<V>() {

        @Override
        public void graphClicked(V vertex, MouseEvent arg1) {
        }

        @Override
        public void graphPressed(V arg0, MouseEvent arg1) {
        }

        @Override
        public void graphReleased(V vertex, MouseEvent arg1) {
            if (currentMode.equals(ModalGraphMouse.Mode.TRANSFORMING)) {
                if (graphCreator.getObjectViewer() != null) {
                    vv.getPickedVertexState().clear();
                    vv.getPickedVertexState().pick(vertex, true);
                    graphCreator.getObjectViewer().showObject(graphCreator.getObject(vertex));
                }
            }
        }
    });

    JPanel controls = new JPanel();
    GridBagLayout gbLayout = new GridBagLayout();
    controls.setLayout(gbLayout);
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.insets = new Insets(4, 4, 4, 4);
    c.weightx = 1;
    c.weighty = 0;

    // zooming
    JToolBar zoomBar = new ExtendedJToolBar();
    zoomBar.setLayout(new FlowLayout(FlowLayout.CENTER));
    zoomBar.add(new ZoomInAction(this, IconSize.SMALL));
    zoomBar.add(new ZoomOutAction(this, IconSize.SMALL));
    zoomBar.setBorder(BorderFactory.createTitledBorder("Zoom"));
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(zoomBar, c);
    controls.add(zoomBar);

    // mode
    JToolBar modeBar = new ExtendedJToolBar();
    modeBar.setLayout(new FlowLayout(FlowLayout.CENTER));
    modeBar.add(transformAction);
    modeBar.add(pickingAction);
    modeBar.setBorder(BorderFactory.createTitledBorder("Mode"));
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(modeBar, c);
    controls.add(modeBar);

    // layout selection
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(layoutSelection, c);
    controls.add(layoutSelection);

    // show node labels
    JCheckBox nodeLabels = new JCheckBox("Node Labels", graphCreator.showVertexLabelsDefault());
    nodeLabels.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            togglePaintVertexLabels();
        }
    });
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(nodeLabels, c);
    controls.add(nodeLabels);

    // show edge labels
    JCheckBox edgeLabels = new JCheckBox("Edge Labels", graphCreator.showEdgeLabelsDefault());
    edgeLabels.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            togglePaintEdgeLabels();
        }
    });
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(edgeLabels, c);
    controls.add(edgeLabels);

    // option components
    for (int i = 0; i < graphCreator.getNumberOfOptionComponents(); i++) {
        JComponent optionComponent = graphCreator.getOptionComponent(this, i);
        if (optionComponent != null) {
            c.gridwidth = GridBagConstraints.REMAINDER;
            gbLayout.setConstraints(optionComponent, c);
            controls.add(optionComponent);
        }
    }

    // save image
    JButton imageButton = new JButton("Save Image...");
    imageButton.setToolTipText("Saves an image of the current graph.");
    imageButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final Component tosave = vv;
            new ExportImageAction(false) {

                private static final long serialVersionUID = 1L;

                @Override
                protected PrintableComponent getPrintableComponent() {
                    return new SimplePrintableComponent(tosave, "Graph");
                }

            }.actionPerformed(e);
        }
    });
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(imageButton, c);
    controls.add(imageButton);

    // help
    JButton help = new JButton("Help");
    help.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(vv, INSTRUCTIONS);
        }
    });
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(help, c);
    controls.add(help);

    JPanel fillPanel = new JPanel();
    c.weighty = 1.0d;
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(fillPanel, c);
    controls.add(fillPanel);

    return controls;
}

From source file:org.pentaho.reporting.libraries.designtime.swing.table.ArrayCellEditorDialog.java

private void configurePanelWithoutSelection() {
    final JLabel columnsLabel = new JLabel(
            Messages.getInstance().getString("ArrayCellEditorDialog.SelectedItems"));
    final ListSelectionModel selectionModel = table.getSelectionModel();

    final Action addGroupAction = new AddEntryAction(tableModel);
    final Action removeGroupAction = new RemoveEntryAction(tableModel, selectionModel);
    final Action sortUpAction = new SortBulkUpAction(tableModel, selectionModel, table);
    final Action sortDownAction = new SortBulkDownAction(tableModel, selectionModel, table);

    final JPanel tablesPane = new JPanel();
    tablesPane.setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridx = 2;/*w w w  .j a va 2  s. c o  m*/
    gbc.gridy = 2;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(columnsLabel, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 3;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(new BorderlessButton(sortUpAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 4;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(new BorderlessButton(sortDownAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 5;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(new BorderlessButton(addGroupAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 6;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(new BorderlessButton(removeGroupAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 3;
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridwidth = 5;
    gbc.insets = new Insets(0, 5, 5, 0);
    tablesPane.add(new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), gbc);

    contentPane.removeAll();
    contentPane.add(tablesPane);
    contentPane.invalidate();
    contentPane.revalidate();
    contentPane.repaint();
}

From source file:com.lp.client.frame.component.PanelDokumentenablage.java

private void jbInit() throws Throwable {
    if (LPMain.getInstance().getDesktop()
            .darfAnwenderAufZusatzfunktionZugreifen(MandantFac.ZUSATZFUNKTION_DOKUMENTENABLAGE)) {
        if (!(new HeliumDocPath()).equals(fullDocPath)) {
            bHatDokumentenablage = true;
        }//  w  ww. j a  va 2 s  .c o m
    }
    if (bShowExitButton) {
        String[] aWhichButtonIUse = new String[] { PanelBasis.ACTION_NEW, PanelBasis.ACTION_UPDATE,
                PanelBasis.ACTION_SAVE, PanelBasis.ACTION_DISCARD };
        enableToolsPanelButtons(aWhichButtonIUse);
        createAndSaveAndShowButton("/com/lp/client/res/scanner.png", "TWAIN-Import", BUTTON_SCAN, null);
    }
    dropArea.setCenterText(LPMain.getTextRespectUISPr("lp.datei.draganddrop.ablegen"));
    dropArea.setBackground(Color.LIGHT_GRAY);
    dropArea.setSupportFiles(true);
    dropArea.addDropListener(this);
    dropArea.setMinimumSize(new Dimension(200, 100));

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);

    JPanel leftPane = new JPanel();
    JPanel rightPane = new JPanel();

    JLayeredPane rightLayered = new JLayeredPane();
    rightLayered.setLayout(new GridBagLayout());
    rightLayered.add(rightPane, new GridBagConstraints(1, 1, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    // rightLayered.setLayer(rightPane, 0, 1);
    if (bShowExitButton && bHatDokumentenablage)
        rightLayered.add(dropArea, new GridBagConstraints(1, 2, 1, 1, 1, 1, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    // rightLayered.setLayer(dropArea, 1, 1);

    rightPane.setLayout(new GridBagLayout());

    tree = new WrapperJTree(treeModel);
    tree.setEditable(false);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setShowsRootHandles(true);
    tree.setRowHeight(0);

    tree.setCellRenderer(new ToolTipCellRenderer());
    ToolTipManager.sharedInstance().registerComponent(tree);

    tree.addTreeSelectionListener(this);

    refresh();

    personalDto = DelegateFactory.getInstance().getPersonalDelegate()
            .personalFindByPrimaryKey(LPMain.getTheClient().getIDPersonal());
    dokumentbelegartDto = DelegateFactory.getInstance().getJCRDocDelegate()
            .dokumentbelegartfindbyMandant(LPMain.getTheClient().getMandant());
    for (int i = 0; i < dokumentbelegartDto.length; i++) {
        if (!JCRDocFac.DEFAULT_ARCHIV_BELEGART.equals(dokumentbelegartDto[i].getCNr()))
            wcbBelegart.addItem(dokumentbelegartDto[i].getCNr());
    }
    dokumentgruppierungDto = DelegateFactory.getInstance().getJCRDocDelegate()
            .dokumentgruppierungfindbyMandant(LPMain.getTheClient().getMandant());
    for (int i = 0; i < dokumentgruppierungDto.length; i++) {
        if (!JCRDocFac.DEFAULT_ARCHIV_GRUPPE.equals(dokumentgruppierungDto[i].getCNr())
                || !JCRDocFac.DEFAULT_KOPIE_GRUPPE.equals(dokumentgruppierungDto[i].getCNr())
                || !JCRDocFac.DEFAULT_VERSANDAUFTRAG_GRUPPE.equals(dokumentgruppierungDto[i].getCNr())) {
            wcbGruppierung.addItem(dokumentgruppierungDto[i].getCNr());
        }
    }

    // Listen for when the selection changes.
    tree.addTreeExpansionListener(this);

    wcbVersteckteAnzeigen.setEnabled(true);
    wcbVersteckteAnzeigen.addActionListener(actionListener);

    wtfSuche.setEditable(true);
    wbuSuche.setEnabled(true);
    wbuSuche.addActionListener(actionListener);
    wbuPartner = new WrapperButton();

    wbuPartner.setText(LPMain.getTextRespectUISPr("button.partner"));
    wbuPartner.setToolTipText(LPMain.getTextRespectUISPr("button.partner.tooltip"));

    wbuPartner.setActionCommand(ACTION_SPECIAL_PARTNER);
    wbuPartner.addActionListener(this);
    wbuChooseDoc.setActionCommand(ACTION_SPECIAL_CHOOSE);
    wbuChooseDoc.addActionListener(this);
    wbuShowDoc.setActionCommand(ACTION_SPECIAL_SHOW);
    wbuShowDoc.addActionListener(this);
    wbuSaveDoc.setActionCommand(ACTION_SPECIAL_SAVE);
    wbuSaveDoc.addActionListener(this);

    wtfPartner = new WrapperTextField();
    wtfPartner.setColumnsMax(Facade.MAX_UNBESCHRAENKT);
    wtfPartner.setActivatable(false);
    wtfAnleger.setActivatable(false);
    wdfZeitpunkt.setActivatable(false);
    wtfBelegnummer.setActivatable(false);
    wtfTable.setActivatable(false);
    wtfRow.setActivatable(false);
    wtfFilename.setActivatable(false);
    wtfFilename.setColumnsMax(100);
    wtfMIME.setActivatable(false);
    wcbVersteckt.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            wtfSchlagworte.setMandatoryField(!wcbVersteckt.isSelected());
        }
    });

    if (bHatStufe0) {
        wcbSicherheitsstufe.addItem(JCRDocFac.SECURITY_NONE);
    }
    if (bHatStufe1) {
        wcbSicherheitsstufe.addItem(JCRDocFac.SECURITY_LOW);
    }
    if (bHatStufe2) {
        wcbSicherheitsstufe.addItem(JCRDocFac.SECURITY_MEDIUM);
    }
    if (bHatStufe3) {
        wcbSicherheitsstufe.addItem(JCRDocFac.SECURITY_HIGH);
    }
    if (bHatStufe99) {
        wcbSicherheitsstufe.addItem(JCRDocFac.SECURITY_ARCHIV);
    }

    wtfTable.setMandatoryField(true);
    wtfName.setMandatoryField(true);
    wtfName.setColumnsMax(200);
    wtfBelegnummer.setMandatoryField(true);
    wtfRow.setMandatoryField(true);
    wtfFilename.setMandatoryField(true);
    wtfMIME.setMandatoryField(true);
    wtfAnleger.setMandatoryField(true);
    wtfSchlagworte.setMandatoryField(true);
    wtfSchlagworte.setColumnsMax(300);
    wdfZeitpunkt.setMandatoryField(true);
    wtfPartner.setMandatoryField(true);

    treeView = new JScrollPane(tree);
    treeView.setMinimumSize(new Dimension(200, 10));
    treeView.setPreferredSize(new Dimension(200, 10));

    iZeile = 0;
    if (!bShowExitButton) {
        jpaWorkingOn.add(wtfSuche, new GridBagConstraints(0, iZeile, 1, 1, 0.2, 0.0, GridBagConstraints.WEST,
                GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
        jpaWorkingOn.add(wbuSuche, new GridBagConstraints(1, iZeile, 1, 1, 0.1, 0.0, GridBagConstraints.WEST,
                GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
        iZeile++;
    }
    jpaWorkingOn.add(wcbVersteckteAnzeigen, new GridBagConstraints(0, iZeile, 1, 1, 1, 0.0,
            GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    iZeile++;
    leftPane.add(treeView);

    jpaWorkingOn.add(splitPane, new GridBagConstraints(0, iZeile, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    iZeile = 0;
    rightPane.add(wlaName, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    rightPane.add(wtfName, new GridBagConstraints(1, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    rightPane.add(wlaTable, new GridBagConstraints(4, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wtfTable, new GridBagConstraints(5, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    iZeile++;
    rightPane.add(wlaSchlagworte, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wtfSchlagworte, new GridBagConstraints(1, iZeile, 6, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    iZeile++;
    rightPane.add(wlaZeitpunkt, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wdfZeitpunkt, new GridBagConstraints(1, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wlaSicherheitsstufe, new GridBagConstraints(4, iZeile, 1, 1, 1.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wcbSicherheitsstufe, new GridBagConstraints(5, iZeile, 1, 1, 1.0, 0.0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wcbVersteckt, new GridBagConstraints(6, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    iZeile++;
    rightPane.add(wlaBelegnummer, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wtfBelegnummer, new GridBagConstraints(1, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wlaRow, new GridBagConstraints(4, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wtfRow, new GridBagConstraints(5, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    iZeile++;
    rightPane.add(wlaFilename, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wtfFilename, new GridBagConstraints(1, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wlaMIME, new GridBagConstraints(4, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wtfMIME, new GridBagConstraints(5, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    iZeile++;
    rightPane.add(wlaBelegart, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wcbBelegart, new GridBagConstraints(1, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wlaGruppierung, new GridBagConstraints(4, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wcbGruppierung, new GridBagConstraints(5, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    iZeile++;
    rightPane.add(wbuPartner, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wtfPartner, new GridBagConstraints(1, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wlaAnleger, new GridBagConstraints(4, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wtfAnleger, new GridBagConstraints(5, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    iZeile++;

    rightPane.add(wbuChooseDoc, new GridBagConstraints(0, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    rightPane.add(wbuShowDoc, new GridBagConstraints(3, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    rightPane.add(wbuSaveDoc, new GridBagConstraints(5, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    iZeile++;
    rightPane.add(wlaVorschau, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    iZeile++;
    rightPane.add(wmcMedia, new GridBagConstraints(0, iZeile, 7, 4, 1.0, 0.5, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    splitPane.setLeftComponent(treeView);
    splitPane.setRightComponent(rightLayered);
}

From source file:base.BasePlayer.AddGenome.java

public AddGenome() {
    super(new BorderLayout());

    makeGenomes();/*from  w  w w .  j  a  v a  2  s  . co m*/
    tree = new JTree(root);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    sizeError.setForeground(Draw.redColor);
    sizeError.setVisible(true);
    treemodel = (DefaultTreeModel) tree.getModel();
    remscroll = new JScrollPane(remtable);
    tree.setCellRenderer(new DefaultTreeCellRenderer() {
        private static final long serialVersionUID = 1L;
        private Icon collapsedIcon = UIManager.getIcon("Tree.collapsedIcon");
        private Icon expandedIcon = UIManager.getIcon("Tree.expandedIcon");
        //   private Icon leafIcon = UIManager.getIcon("Tree.leafIcon");
        private Icon addIcon = UIManager.getIcon("Tree.closedIcon");

        //        private Icon saveIcon = UIManager.getIcon("OptionPane.informationIcon");
        @Override
        public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
                boolean expanded, boolean isLeaf, int row, boolean focused) {
            Component c = super.getTreeCellRendererComponent(tree, value, selected, expanded, isLeaf, row,
                    focused);

            if (!isLeaf) {

                //setFont(getFont().deriveFont(Font.PLAIN));
                if (expanded) {
                    setIcon(expandedIcon);
                } else {
                    setIcon(collapsedIcon);
                }

                /*   if(((DefaultMutableTreeNode) value).getUserObject().toString().equals("Annotations")) {
                      this.setFocusable(false);
                      setFont(getFont().deriveFont(Font.BOLD));
                      setIcon(null);
                   }
                */
            } else {
                if (((DefaultMutableTreeNode) value).getUserObject().toString().equals("Annotations")) {

                    //      setFont(getFont().deriveFont(Font.PLAIN));
                    setIcon(null);
                } else if (((DefaultMutableTreeNode) value).getUserObject().toString().startsWith("Add new")) {

                    //       setFont(getFont().deriveFont(Font.PLAIN));

                    setIcon(addIcon);
                } else {
                    //      setFont(getFont().deriveFont(Font.ITALIC));
                    setIcon(null);
                    //   setIcon(leafIcon);
                }

            }

            return c;
        }
    });
    tree.addMouseListener(this);
    tree.addTreeSelectionListener(new TreeSelectionListener() {

        public void valueChanged(TreeSelectionEvent e) {
            try {
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();

                if (node == null)
                    return;

                selectedNode = node;

                if (node.isLeaf()) {
                    checkUpdates.setEnabled(false);
                } else {
                    checkUpdates.setEnabled(true);
                }
                if (node.toString().startsWith("Add new") || node.toString().equals("Annotations")) {
                    remove.setEnabled(false);
                } else {
                    remove.setEnabled(true);
                }
                genometable.clearSelection();
                download.setEnabled(false);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    });
    tree.setToggleClickCount(1);
    tree.setRootVisible(false);
    treescroll = new JScrollPane(tree);
    checkGenomes();
    genomeFileText = new JLabel("Select reference fasta-file");
    annotationFileText = new JLabel("Select annotation gff3-file");
    genomeName = new JTextField("Give name of the genome");
    openRef = new JButton("Browse");
    openAnno = new JButton("Browse");
    add = new JButton("Add");
    download = new JButton("Download");
    checkEnsembl = new JButton("Ensembl fetch");
    checkEnsembl.setMinimumSize(Main.buttonDimension);
    checkEnsembl.addActionListener(this);
    getLinks = new JButton("Get file links.");
    remove = new JButton("Remove");
    checkUpdates = new JButton("Check updates");
    download.setEnabled(false);
    getLinks.setEnabled(false);
    getLinks.addActionListener(this);
    remove.setEnabled(false);
    download.addActionListener(this);
    remove.addActionListener(this);
    panel.setBackground(Draw.sidecolor);
    checkUpdates.addActionListener(this);
    this.setBackground(Draw.sidecolor);
    frame.getContentPane().setBackground(Draw.sidecolor);
    GridBagConstraints c = new GridBagConstraints();

    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets(2, 4, 2, 4);
    c.gridwidth = 2;
    genometable.setSelectionMode(0);
    genometable.setShowGrid(false);
    remtable.setSelectionMode(0);
    remtable.setShowGrid(false);
    JScrollPane scroll = new JScrollPane();
    scroll.getViewport().setBackground(Color.white);
    scroll.getViewport().add(genometable);

    remscroll.getViewport().setBackground(Color.white);

    genometable.addMouseListener(this);
    remtable.addMouseListener(this);
    //   panel.add(welcomeLabel,c);
    //   c.gridy++;
    c.anchor = GridBagConstraints.NORTHWEST;
    panel.add(new JLabel("Download genome reference and annotation"), c);
    c.gridx++;
    c.anchor = GridBagConstraints.NORTHEAST;
    panel.add(checkEnsembl, c);
    c.anchor = GridBagConstraints.NORTHWEST;
    c.weightx = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;
    c.gridy++;
    //c.fill = GridBagConstraints.NONE;
    panel.add(scroll, c);
    c.gridy++;
    c.fill = GridBagConstraints.NONE;
    panel.add(download, c);
    c.gridx = 1;
    panel.add(sizeError, c);
    c.gridx = 1;
    panel.add(getLinks, c);
    c.gridy++;
    c.gridx = 0;
    c.fill = GridBagConstraints.BOTH;
    panel.add(new JLabel("Add/Remove installed genomes manually"), c);
    c.gridy++;
    panel.add(treescroll, c);
    c.gridy++;

    c.fill = GridBagConstraints.NONE;
    c.gridwidth = 1;
    remove.setMinimumSize(Main.buttonDimension);
    panel.add(remove, c);
    c.gridx = 1;
    panel.add(checkUpdates, c);
    checkUpdates.setMinimumSize(Main.buttonDimension);
    checkUpdates.setEnabled(false);
    c.gridwidth = 2;
    c.gridx = 0;
    c.gridy++;
    try {
        if (Main.genomeDir != null) {
            genomedirectory.setText(Main.genomeDir.getCanonicalPath());
        }

        genomedirectory.setEditable(false);
        genomedirectory.setBackground(Color.white);
        genomedirectory.setForeground(Color.black);
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    panel.add(new JLabel("Genome directory:"), c);
    c.gridy++;
    panel.add(genomedirectory, c);
    /*   c.fill = GridBagConstraints.BOTH;
       c.gridy++;
       panel.add(new JLabel("Add genome manually"),c);
       c.gridy++;   
       c.gridwidth = 2;      
       panel.add(new JSeparator(),c);
       c.gridwidth = 1;
       c.gridy++;
       panel.add(genomeFileText, c);
       c.fill = GridBagConstraints.NONE;
       c.gridx = 1;
       panel.add(openRef, c);      
               
       c.gridx = 0;
       openRef.addActionListener(this);
       c.gridy++;
       panel.add(annotationFileText,c);
       c.gridx=1;
       panel.add(openAnno, c);
       c.gridy++;
               
       panel.add(add,c);
            
       openAnno.addActionListener(this);
       add.addActionListener(this);
       add.setEnabled(false);
       */
    add(panel, BorderLayout.NORTH);
    if (Main.drawCanvas != null) {
        setFonts(Main.menuFont);
    }
    /*   html.append("<a href=http:Homo_sapiens_GRCh37:Ensembl_genes> Homo sapiens GRCh37 with Ensembl</a> or <a href=http:Homo_sapiens_GRCh37:RefSeq_genes>RefSeq</a> gene annotations<br>");
       html.append("<a href=http:Homo_sapiens_GRCh38:Ensembl_genes> Homo sapiens GRCh38 with Ensembl</a> or <a href=http:Homo_sapiens_GRCh38:RefSeq_genes>RefSeq</a> gene annotations<br><br>");
               
       html.append("<a href=http:Mus_musculus_GRCm38:Ensembl_genes> Mus musculus GRCm38 with Ensembl</a> or <a href=http:Mus_musculus_GRCm38:RefSeq_genes>RefSeq</a> gene annotations<br>");
       html.append("<a href=http:Rattus_norvegicus:Ensembl_genes> Rattus norvegicus with Ensembl gene annotations</a><br>");
       html.append("<a href=http:Saccharomyces_cerevisiae:Ensembl_genes> Saccharomyces cerevisiae with Ensembl gene annotation</a><br>");               
       html.append("<a href=http:Ciona_intestinalis:Ensembl_genes> Ciona intestinalis with Ensembl gene annotation</a><br>");
       Object[] row = {"Homo_sapiens_GRCh37"};
       Object[] row = {"Homo_sapiens_GRCh38"};
               
       model.addRow(row);
       /*   genomeName.setPreferredSize(new Dimension(300,20));
       this.add(genomeName);
       this.add(new JSeparator());
               
       this.add(openRef);
       openRef.addActionListener(this);
       this.add(genomeFileText);
       this.add(openAnno);
       openAnno.addActionListener(this);
       this.add(annotationFileText);
       this.add(add);
       add.addActionListener(this);
       if(annotation) {
          openRef.setVisible(false);
          genomeFileText.setVisible(false);
          genomeName.setEditable(false);
       }
       genomeFileText.setEditable(false);
       annotationFileText.setEditable(false);*/
}