Example usage for java.awt GridBagConstraints NORTHWEST

List of usage examples for java.awt GridBagConstraints NORTHWEST

Introduction

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

Prototype

int NORTHWEST

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

Click Source Link

Document

Put the component at the top-left corner of its display area.

Usage

From source file:fxts.stations.ui.SideLayout.java

/**
 * Adjusts the x, y, width, and height fields to the correct
 * values depending on the constraint geometry and pads.
 *
 * @param aConstraints the constraints to be applied
 * @param aRectangle   the <code>Rectangle</code> to be adjusted
 *///from ww  w .  j a v a2 s .  c  om
protected void adjustForGravity(SideConstraints aConstraints, Rectangle aRectangle) {
    int diffx, diffy;
    if (!mRightToLeft) {
        aRectangle.x += aConstraints.insets.left;
    } else {
        aRectangle.x -= aRectangle.width - aConstraints.insets.right;
    }
    aRectangle.width -= aConstraints.insets.left + aConstraints.insets.right;
    aRectangle.y += aConstraints.insets.top;
    aRectangle.height -= aConstraints.insets.top + aConstraints.insets.bottom;
    diffx = 0;
    if (aConstraints.fill != SideConstraints.HORIZONTAL && aConstraints.fill != SideConstraints.BOTH
            && aRectangle.width > aConstraints.minWidth + aConstraints.ipadx) {
        diffx = aRectangle.width - (aConstraints.minWidth + aConstraints.ipadx);
        aRectangle.width = aConstraints.minWidth + aConstraints.ipadx;
    }
    diffy = 0;
    if (aConstraints.fill != SideConstraints.VERTICAL && aConstraints.fill != SideConstraints.BOTH
            && aRectangle.height > aConstraints.minHeight + aConstraints.ipady) {
        diffy = aRectangle.height - (aConstraints.minHeight + aConstraints.ipady);
        aRectangle.height = aConstraints.minHeight + aConstraints.ipady;
    }
    switch (aConstraints.anchor) {
    case GridBagConstraints.CENTER:
        aRectangle.x += diffx / 2;
        aRectangle.y += diffy / 2;
        break;
    case SideConstraints.PAGE_START:
    case GridBagConstraints.NORTH:
        aRectangle.x += diffx / 2;
        break;
    case GridBagConstraints.NORTHEAST:
        aRectangle.x += diffx;
        break;
    case GridBagConstraints.EAST:
        aRectangle.x += diffx;
        aRectangle.y += diffy / 2;
        break;
    case GridBagConstraints.SOUTHEAST:
        aRectangle.x += diffx;
        aRectangle.y += diffy;
        break;
    case SideConstraints.PAGE_END:
    case GridBagConstraints.SOUTH:
        aRectangle.x += diffx / 2;
        aRectangle.y += diffy;
        break;
    case GridBagConstraints.SOUTHWEST:
        aRectangle.y += diffy;
        break;
    case GridBagConstraints.WEST:
        aRectangle.y += diffy / 2;
        break;
    case GridBagConstraints.NORTHWEST:
        break;
    case SideConstraints.LINE_START:
        if (mRightToLeft) {
            aRectangle.x += diffx;
        }
        aRectangle.y += diffy / 2;
        break;
    case SideConstraints.LINE_END:
        if (!mRightToLeft) {
            aRectangle.x += diffx;
        }
        aRectangle.y += diffy / 2;
        break;
    case SideConstraints.FIRST_LINE_START:
        if (mRightToLeft) {
            aRectangle.x += diffx;
        }
        break;
    case SideConstraints.FIRST_LINE_END:
        if (!mRightToLeft) {
            aRectangle.x += diffx;
        }
        break;
    case SideConstraints.LAST_LINE_START:
        if (mRightToLeft) {
            aRectangle.x += diffx;
        }
        aRectangle.y += diffy;
        break;
    case SideConstraints.LAST_LINE_END:
        if (!mRightToLeft) {
            aRectangle.x += diffx;
        }
        aRectangle.y += diffy;
        break;
    default:
        throw new IllegalArgumentException("illegal anchor value");
    }
}

From source file:org.executequery.gui.editor.QueryEditor.java

private void init() throws Exception {

    // construct the two query text area and results panels
    statusBar = new QueryEditorStatusBar();
    statusBar.setBorder(BorderFactory.createEmptyBorder(0, -1, -2, -2));

    editorPanel = new QueryEditorTextPanel(this);
    resultsPanel = new QueryEditorResultsPanel(this);

    delegate = new QueryEditorDelegate(this);

    popup = new QueryEditorPopupMenu(delegate);
    editorPanel.addEditorPaneMouseListener(popup);

    baseEditorPanel = new JPanel(new BorderLayout());
    baseEditorPanel.add(editorPanel, BorderLayout.CENTER);
    baseEditorPanel.add(statusBar, BorderLayout.SOUTH);
    baseEditorPanel/*from  w  w w . j  a v a  2 s . c  o m*/
            .setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, GUIUtilities.getDefaultBorderColour()));

    // add to a base panel - when last tab closed visible set
    // to false on the tab pane and split collapses - want to avoid this
    resultsBase = new JPanel(new BorderLayout());
    resultsBase.add(resultsPanel, BorderLayout.CENTER);

    if (new SplitPaneFactory().usesCustomSplitPane()) {

        splitPane = new EditorSplitPane(JSplitPane.VERTICAL_SPLIT, baseEditorPanel, resultsBase);
    } else {
        splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, baseEditorPanel, resultsBase);
    }

    splitPane.setDividerSize(4);
    splitPane.setResizeWeight(0.5);

    // ---------------------------------------
    // the tool bar and conn combo
    toolBar = new QueryEditorToolBar(editorPanel.getTextPaneActionMap(), editorPanel.getTextPaneInputMap());

    Vector<DatabaseConnection> connections = ConnectionManager.getActiveConnections();
    connectionsCombo = new OpenConnectionsComboBox(this, connections);

    maxRowCountCheckBox = new JCheckBox();
    maxRowCountCheckBox.setToolTipText("Enable/disable max records");
    maxRowCountCheckBox.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            maxRowCountCheckBoxSelected();
        }
    });

    maxRowCountField = new MaxRowCountField(this);

    toolsPanel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(0, 0, 0, 0);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridy++;
    gbc.gridx++;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    toolsPanel.add(toolBar, gbc);
    gbc.gridy++;
    gbc.weightx = 0;
    gbc.gridwidth = 1;
    gbc.insets.top = 7;
    gbc.insets.left = 5;
    gbc.insets.right = 10;
    toolsPanel.add(createLabel("Connection:", 'C'), gbc);
    gbc.gridx++;
    gbc.weightx = 1.0;
    gbc.insets.top = 2;
    gbc.insets.bottom = 2;
    gbc.insets.left = 0;
    gbc.insets.right = 0;
    toolsPanel.add(connectionsCombo, gbc);

    gbc.gridx++;
    gbc.weightx = 0;
    gbc.insets.left = 0;
    gbc.insets.top = 7;
    gbc.insets.right = 10;
    gbc.insets.left = 10;
    toolsPanel.add(createLabel("Filter:", 'l'), gbc);
    gbc.gridx++;
    gbc.weightx = 0.8;
    gbc.insets.top = 2;
    gbc.insets.bottom = 2;
    gbc.insets.right = 2;
    gbc.insets.left = 0;
    gbc.fill = GridBagConstraints.BOTH;
    toolsPanel.add(createResultSetFilterTextField(), gbc);

    gbc.gridx++;
    gbc.weightx = 0;
    gbc.insets.top = 5;
    gbc.insets.left = 10;
    toolsPanel.add(maxRowCountCheckBox, gbc);
    gbc.gridx++;
    gbc.insets.left = 0;
    gbc.insets.top = 7;
    gbc.insets.right = 10;
    toolsPanel.add(createLabel("Max Rows:", 'R'), gbc);
    gbc.gridx++;
    gbc.weightx = 0.3;
    gbc.insets.top = 2;
    gbc.insets.bottom = 2;
    gbc.insets.right = 2;
    gbc.fill = GridBagConstraints.BOTH;
    toolsPanel.add(maxRowCountField, gbc);

    splitPane.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3));

    JPanel base = new JPanel(new BorderLayout());
    base.add(toolsPanel, BorderLayout.NORTH);
    base.add(splitPane, BorderLayout.CENTER);

    gbc.gridy = 1;
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.insets.top = 0;
    gbc.insets.bottom = 0;
    gbc.insets.left = 0;
    gbc.insets.right = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.anchor = GridBagConstraints.SOUTHEAST;
    add(base, gbc);

    // register for connection and keyword events
    EventMediator.registerListener(this);

    addDeleteLineActionMapping();

    setEditorPreferences();

    statusBar.setCaretPosition(1, 1);
    statusBar.setInsertionMode("INS");
}

From source file:org.openconcerto.erp.core.finance.accounting.ui.EtatJournauxPanel.java

private JPanel creerJournalMoisPanel(final Date date, long debit, long credit, final Journal jrnl) {

    final JPanel panelMoisCompte = new JPanel();
    panelMoisCompte.setLayout(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(2, 2, 1, 2);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.gridx = 0;/* w  w w. j  av a  2  s  .  c  om*/
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 1;
    c.weighty = 0;

    panelMoisCompte.setBorder(BorderFactory.createTitledBorder(dateFormat.format(date)));

    // Date du mois
    panelMoisCompte.add(new JLabel(dateFormat.format(date)), c);

    // Totaux du mois
    c.gridx++;
    panelMoisCompte.add(new JLabel(" dbit : " + GestionDevise.currencyToString(debit)), c);
    c.gridx++;
    panelMoisCompte.add(new JLabel(" crdit : " + GestionDevise.currencyToString(credit)), c);

    // Bouton dtails
    JButton boutonShow = new JButton("+/-");
    boutonShow.setOpaque(false);
    boutonShow.setHorizontalAlignment(SwingConstants.LEFT);

    c.weightx = 0;
    c.gridx++;
    panelMoisCompte.add(boutonShow, c);

    boutonShow.addActionListener(new ActionListener() {
        private boolean isShow = false;
        private ListPanelEcritures listEcriture;

        public void actionPerformed(ActionEvent e) {

            System.err.println(this.isShow);

            // Afficher la JTable du compte
            if (!this.isShow) {
                final SQLElement element = Configuration.getInstance().getDirectory().getElement("ECRITURE");
                final SQLTable ecrTable = element.getTable();

                Calendar cal = Calendar.getInstance();

                cal.setTime(date);
                cal.set(Calendar.DATE, 1);
                Date inf = cal.getTime();

                cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DATE));
                Date sup = cal.getTime();

                System.out.println("Inf : " + inf + " Sup : " + sup);
                Where w = new Where(ecrTable.getField("ID_JOURNAL"), "=", jrnl.getId());
                Where w2 = new Where(ecrTable.getField("DATE"), inf, sup);

                if (!UserManager.getInstance().getCurrentUser().getRights()
                        .haveRight(ComptaUserRight.ACCES_NOT_RESCTRICTED_TO_411)) {
                    // TODO Show Restricted acces in UI
                    w = w.and(new Where(ecrTable.getField("COMPTE_NUMERO"), "LIKE", "411%"));
                }

                this.listEcriture = new ListPanelEcritures(element, w.and(w2));
                this.listEcriture.setModificationVisible(false);
                this.listEcriture.setAjoutVisible(false);
                this.listEcriture.setSuppressionVisible(false);
                this.listEcriture.getListe().setSQLEditable(false);

                Dimension d;
                // Taille limite  200 maximum
                if (this.listEcriture.getListe().getPreferredSize().height > 200) {
                    d = new Dimension(this.listEcriture.getListe().getPreferredSize().width, 200);
                } else {
                    d = new Dimension(this.listEcriture.getListe().getPreferredSize().width,
                            this.listEcriture.getListe().getPreferredSize().height + 30);
                }
                this.listEcriture.getListe().setPreferredSize(d);

                // c.gridy = 2;
                c.gridx = 0;
                c.gridy = 1;

                c.gridwidth = 4;
                c.weightx = 1;
                c.weighty = 1;
                c.fill = GridBagConstraints.BOTH;

                this.listEcriture.getListe().setSQLEditable(false);

                panelMoisCompte.add(this.listEcriture, c);
                this.listEcriture.getListe().getJTable().addMouseListener(new MouseAdapter() {
                    public void mousePressed(MouseEvent e) {
                        if (e.getButton() == MouseEvent.BUTTON3) {
                            JPopupMenu menu = new JPopupMenu();
                            menu.add(new AbstractAction("Voir la source") {
                                public void actionPerformed(ActionEvent e) {

                                    SQLRow row = base.getTable("ECRITURE")
                                            .getRow(listEcriture.getListe().getSelectedId());

                                    MouvementSQLElement.showSource(row.getInt("ID_MOUVEMENT"));
                                }
                            });

                            menu.show(e.getComponent(), e.getPoint().x, e.getPoint().y);

                        }
                    }
                });

            } else {

                panelMoisCompte.remove(this.listEcriture);
                System.out.println("Hide ListEcriture");

                panelMoisCompte.repaint();
                panelMoisCompte.revalidate();
            }

            this.isShow = !this.isShow;
            SwingUtilities.getRoot(panelMoisCompte).repaint();
        }
    });

    return panelMoisCompte;
}

From source file:com.sec.ose.osi.ui.frm.main.identification.patternmatch.JPanPatternMatchMain.java

/**
 * This method initializes jPanel   //from www.  ja  v a  2 s  .  c  o  m
 *    
 * @return javax.swing.JPanel   
 */
public JPanel getJPanelBottom() {
    if (jPanelBottom == null) {
        GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
        gridBagConstraints8.anchor = GridBagConstraints.NORTHWEST;
        gridBagConstraints8.insets = new Insets(10, 0, 0, 0);
        gridBagConstraints8.gridx = 1;
        gridBagConstraints8.gridy = 2;
        gridBagConstraints8.weightx = 1.0;
        gridBagConstraints8.weighty = 1.0;
        gridBagConstraints8.fill = GridBagConstraints.NONE;
        GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
        gridBagConstraints7.anchor = GridBagConstraints.WEST;
        gridBagConstraints7.insets = new Insets(10, 0, 0, 0);
        gridBagConstraints7.gridx = 1;
        gridBagConstraints7.gridy = 1;
        gridBagConstraints7.weightx = 0.0;
        gridBagConstraints7.fill = GridBagConstraints.VERTICAL;
        GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
        gridBagConstraints6.anchor = GridBagConstraints.WEST;
        gridBagConstraints6.insets = new Insets(10, 0, 0, 15);
        gridBagConstraints6.gridx = 1;
        gridBagConstraints6.gridy = 0;
        gridBagConstraints6.fill = GridBagConstraints.NONE;
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.anchor = GridBagConstraints.NORTHEAST;
        gridBagConstraints5.gridx = 0;
        gridBagConstraints5.gridy = 2;
        gridBagConstraints5.weightx = 0.0;
        gridBagConstraints5.weighty = 0.0;
        gridBagConstraints5.insets = new Insets(13, 0, 0, 5);
        GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
        gridBagConstraints4.anchor = GridBagConstraints.EAST;
        gridBagConstraints4.gridx = 0;
        gridBagConstraints4.gridy = 1;
        gridBagConstraints4.insets = new Insets(10, 0, 0, 5);
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.anchor = GridBagConstraints.EAST;
        gridBagConstraints1.gridx = -1;
        gridBagConstraints1.gridy = -1;
        gridBagConstraints1.insets = new Insets(10, 15, 0, 5);
        jPanelBottom = new JPanel();
        jPanelBottom.setLayout(new GridBagLayout());
        jPanelBottom.add(jLabelBinding, gridBagConstraints1);
        jPanelBottom.add(jLabelComponent, gridBagConstraints4);
        jPanelBottom.add(jLabelLicense, gridBagConstraints5);
        jPanelBottom.add(getJComboBoxBinding(), gridBagConstraints6);
        jPanelBottom.add(getJComboBoxComponentForOpt3(), gridBagConstraints7);
        jPanelBottom.add(getJComboBoxLicenseForOpt3(), gridBagConstraints8);
    }
    return jPanelBottom;
}

From source file:org.zaproxy.zap.view.NodeSelectDialog.java

/**
 * This method initializes jPanel   //from w w w.  j av a 2 s . co  m
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanel() {
    if (jPanel == null) {
        GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
        java.awt.GridBagConstraints gridBagConstraints13 = new GridBagConstraints();

        javax.swing.JLabel jLabel2 = new JLabel();

        java.awt.GridBagConstraints gridBagConstraints3 = new GridBagConstraints();

        java.awt.GridBagConstraints gridBagConstraints2 = new GridBagConstraints();

        jPanel = new JPanel();
        jPanel.setLayout(new GridBagLayout());
        jPanel.setPreferredSize(DisplayUtils.getScaledDimension(400, 400));
        jPanel.setMinimumSize(DisplayUtils.getScaledDimension(400, 400));
        gridBagConstraints2.gridx = 1;
        gridBagConstraints2.gridy = 5;
        gridBagConstraints2.insets = new java.awt.Insets(2, 2, 2, 2);
        gridBagConstraints2.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints3.gridx = 2;
        gridBagConstraints3.gridy = 5;
        gridBagConstraints3.insets = new java.awt.Insets(2, 2, 2, 10);
        gridBagConstraints3.anchor = java.awt.GridBagConstraints.EAST;

        gridBagConstraints13.gridx = 0;
        gridBagConstraints13.gridy = 5;
        gridBagConstraints13.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints13.weightx = 1.0D;
        gridBagConstraints13.insets = new java.awt.Insets(2, 10, 2, 5);

        gridBagConstraints15.weightx = 1.0D;
        gridBagConstraints15.weighty = 1.0D;
        gridBagConstraints15.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints15.insets = new java.awt.Insets(2, 2, 2, 2);
        gridBagConstraints15.gridwidth = 3;
        gridBagConstraints15.gridx = 0;
        gridBagConstraints15.gridy = 2;
        gridBagConstraints15.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints15.ipadx = 0;
        gridBagConstraints15.ipady = 10;

        jPanel.add(getJScrollPane(), gridBagConstraints15);
        jPanel.add(jLabel2, gridBagConstraints13);
        jPanel.add(getCancelButton(), gridBagConstraints2);
        jPanel.add(getSelectButton(), gridBagConstraints3);
    }
    return jPanel;
}

From source file:logdruid.ui.DateEditor.java

/**
 * Create the panel./* w w w . j  av  a 2s. c  o m*/
 */
public DateEditor(Repository rep) {
    repository = rep;
    model = new MyTableModel2(data, header);

    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 15, 550, 15 };
    gridBagLayout.rowHeights = new int[] { 152, 300 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0, 0.0 };
    gridBagLayout.rowWeights = new double[] { 0.0, 1.0 };
    setLayout(gridBagLayout);

    JPanel panel_1 = new JPanel();
    GridBagConstraints gbc_panel_1 = new GridBagConstraints();
    gbc_panel_1.fill = GridBagConstraints.BOTH;
    gbc_panel_1.insets = new Insets(5, 0, 5, 5);
    gbc_panel_1.gridx = 1;
    gbc_panel_1.gridy = 0;
    add(panel_1, gbc_panel_1);
    panel_1.setLayout(new BorderLayout(0, 0));

    table = new JTable(model);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setBorder(UIManager.getBorder("TextPane.border"));
    table.setPreferredScrollableViewportSize(new Dimension(0, 0));
    table.setFillsViewportHeight(true);

    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            // ((table.getSelectedRow()!=-1)?table.convertRowIndexToModel(table.getSelectedRow()):-1)
            // persist repository
            // display selected row

            if (((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1) >= 0) {
                /*
                 * recEditor = new RecordingEditor(repository
                 * .getRecordings().get(((table.getSelectedRow()!=-1)?table.
                 * convertRowIndexToModel(table.getSelectedRow()):-1)),
                 * repository); jPanelDetail.removeAll();
                 */
                // jPanelDetail.add(recEditor, gbc_jPanelDetail);
                DateFormat df = repository.getDateFormat(
                        ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                                : -1));
                if (df != null) {
                    textFieldName.setText((String) df.getName());
                    textFieldPattern.setText((String) df.getPattern());
                    textField.setText((String) df.getDateFormat());
                }
                // jPanelDetail.revalidate();
                // jPanelDetail.repaint();
                // jPanelDetail.setVisible(true);
                // reloadTable(); those 2 ********
                // jPanelDetail.revalidate();
            }
        }
    });

    JScrollPane scrollPane = new JScrollPane(table);
    panel_1.add(scrollPane, BorderLayout.CENTER);
    // Set up column sizes.
    initColumnSizes(table);

    JPanel panel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) panel.getLayout();
    flowLayout.setAlignment(FlowLayout.LEFT);
    flowLayout.setVgap(2);
    flowLayout.setHgap(2);
    panel_1.add(panel, BorderLayout.SOUTH);

    JButton btnNew = new JButton("New");
    panel.add(btnNew);
    btnNew.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            DateFormat df = new DateFormat("name", "\\w{3}\\s[0-9]{1}/[0-9]{2}/[0-9]{2}\\s\\d\\d:\\d\\d:\\d\\d",
                    "EEE. MM/dd/yy HH:mm:ss");
            repository.addDateFormat(df);
            data.add(new Object[] { df.getName(), df.getPattern(), df.getDateFormat() });
            table.repaint();
        }
    });

    JButton btnDuplicate = new JButton("Duplicate");
    btnDuplicate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1) >= 0) {
                DateFormat df = repository.getDateFormat(
                        ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                                : -1));
                repository.addDateFormat(df);
                reloadTable();
                // data.add(new Object[] { table.getRowCount()+1,
                // df.getName(),df.getDateFormat()});
                table.repaint();
            }
        }
    });
    panel.add(btnDuplicate);

    JButton btnDelete = new JButton("Delete");
    btnDelete.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int selectedRow = ((table.getSelectedRow() != -1)
                    ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1);
            if (selectedRow >= 0) {
                repository.deleteDateFormat(
                        ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                                : -1));
                data.remove(
                        ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                                : -1));
                reloadTable();
                table.setRowSelectionInterval(selectedRow, selectedRow);
                table.repaint();
            }
        }
    });
    panel.add(btnDelete);

    jPanelDetail = new JPanel();
    gbc_jPanelDetail = new GridBagConstraints();
    gbc_jPanelDetail.anchor = GridBagConstraints.NORTH;
    gbc_jPanelDetail.fill = GridBagConstraints.HORIZONTAL;
    gbc_jPanelDetail.gridx = 1;
    gbc_jPanelDetail.gridy = 1;
    add(jPanelDetail, gbc_jPanelDetail);
    GridBagLayout gbl_jPanelDetail = new GridBagLayout();
    gbl_jPanelDetail.columnWidths = new int[] { 169 };
    gbl_jPanelDetail.rowHeights = new int[] { 0, 0, 0, 0, 150, 0 };
    gbl_jPanelDetail.columnWeights = new double[] { 1.0, 0.0 };
    gbl_jPanelDetail.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 1.0, 0.0 };
    jPanelDetail.setLayout(gbl_jPanelDetail);

    JPanel panel_2 = new JPanel();
    panel_2.setBorder(null);
    GridBagConstraints gbc_panel_2 = new GridBagConstraints();
    gbc_panel_2.gridwidth = 2;
    gbc_panel_2.anchor = GridBagConstraints.NORTHWEST;
    gbc_panel_2.insets = new Insets(0, 0, 5, 0);
    gbc_panel_2.gridx = 0;
    gbc_panel_2.gridy = 0;
    jPanelDetail.add(panel_2, gbc_panel_2);
    panel_2.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));

    JLabel label = new JLabel("Name");
    panel_2.add(label);

    textFieldName = new JTextField();
    textFieldName.setColumns(20);
    panel_2.add(textFieldName);

    JPanel panel_3 = new JPanel();
    FlowLayout flowLayout_1 = (FlowLayout) panel_3.getLayout();
    flowLayout_1.setAlignment(FlowLayout.LEFT);
    panel_3.setBorder(null);
    GridBagConstraints gbc_panel_3 = new GridBagConstraints();
    gbc_panel_3.insets = new Insets(0, 0, 5, 0);
    gbc_panel_3.gridwidth = 2;
    gbc_panel_3.anchor = GridBagConstraints.NORTHWEST;
    gbc_panel_3.gridx = 0;
    gbc_panel_3.gridy = 1;
    jPanelDetail.add(panel_3, gbc_panel_3);

    labelPattern = new JLabel("Pattern");
    panel_3.add(labelPattern);

    textFieldPattern = new JTextField();
    textFieldPattern.setColumns(40);
    panel_3.add(textFieldPattern);

    JButton btnSave = new JButton("Save");
    btnSave.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            DateFormat df1 = repository.getDateFormat(
                    ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow())
                            : -1));
            df1.update(textFieldName.getText(), textFieldPattern.getText(), textField.getText());
            reloadTable();
        }
    });

    JPanel panel_4 = new JPanel();
    FlowLayout flowLayout_2 = (FlowLayout) panel_4.getLayout();
    flowLayout_2.setAlignment(FlowLayout.LEFT);
    GridBagConstraints gbc_panel_4 = new GridBagConstraints();
    gbc_panel_4.anchor = GridBagConstraints.WEST;
    gbc_panel_4.insets = new Insets(0, 0, 5, 5);
    gbc_panel_4.gridx = 0;
    gbc_panel_4.gridy = 2;
    jPanelDetail.add(panel_4, gbc_panel_4);

    JLabel lblFastDateFormat = new JLabel("FastDateFormat");
    panel_4.add(lblFastDateFormat);

    textField = new JTextField();
    panel_4.add(textField);
    textField.setColumns(30);

    JPanel panel_5 = new JPanel();
    FlowLayout flowLayout_3 = (FlowLayout) panel_5.getLayout();
    flowLayout_3.setAlignment(FlowLayout.LEFT);
    GridBagConstraints gbc_panel_5 = new GridBagConstraints();
    gbc_panel_5.insets = new Insets(0, 0, 5, 5);
    gbc_panel_5.fill = GridBagConstraints.BOTH;
    gbc_panel_5.gridx = 0;
    gbc_panel_5.gridy = 3;
    jPanelDetail.add(panel_5, gbc_panel_5);

    JLabel lblSampleLabel = new JLabel("Sample");
    panel_5.add(lblSampleLabel);

    JPanel panel_6 = new JPanel();
    panel_6.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_panel_6 = new GridBagConstraints();
    gbc_panel_6.ipady = 1;
    gbc_panel_6.ipadx = 1;
    gbc_panel_6.insets = new Insets(0, 0, 5, 5);
    gbc_panel_6.fill = GridBagConstraints.BOTH;
    gbc_panel_6.gridx = 0;
    gbc_panel_6.gridy = 4;
    jPanelDetail.add(panel_6, gbc_panel_6);
    panel_6.setLayout(new BorderLayout(0, 0));

    JTextPane textPane = new JTextPane();
    textPane.setBackground(UIManager.getColor("windowBorder"));
    panel_6.add(textPane);
    GridBagConstraints gbc_btnSave = new GridBagConstraints();
    gbc_btnSave.anchor = GridBagConstraints.WEST;
    gbc_btnSave.insets = new Insets(0, 0, 0, 5);
    gbc_btnSave.gridx = 0;
    gbc_btnSave.gridy = 5;
    jPanelDetail.add(btnSave, gbc_btnSave);
    reloadTable();
}

From source file:org.parosproxy.paros.extension.beanshell.BeanShellConsoleDialog.java

/**
 * This method initializes jPanel   //from   w  ww . ja  v a2 s. c o m
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanel() {
    if (jPanel == null) {
        GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
        jPanel = new JPanel();
        jPanel.setLayout(new GridBagLayout());
        gridBagConstraints31.gridx = 0;
        gridBagConstraints31.gridy = 0;
        gridBagConstraints31.weightx = 1.0;
        gridBagConstraints31.weighty = 1.0;
        gridBagConstraints31.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints31.anchor = java.awt.GridBagConstraints.NORTHWEST;

        HttpSender sender = new HttpSender(Model.getSingleton().getOptionsParam().getConnectionParam(), true);
        try {
            getInterpreter().set("model", Model.getSingleton());
            getInterpreter().set("sites", Model.getSingleton().getSession().getSiteTree());
            getInterpreter().set("sender", sender);
            getInterpreter().eval("setAccessibility(true)"); //This allows BeanShell users to access private members
            getInterpreter().eval("import org.apache.commons.httpclient.URI");
            getInterpreter().eval("import org.parosproxy.paros.network.*");
            getInterpreter().eval("import org.parosproxy.paros.model.*");
            getInterpreter().eval("import org.parosproxy.paros.db.*");
            getInterpreter().eval("import org.parosproxy.paros.model.*;");
        } catch (EvalError e) {
            e.printStackTrace();
        }
        new Thread(getInterpreter()).start();
        jPanel.add(getBeanShellPanel(), gridBagConstraints31);
    }
    return jPanel;
}

From source file:de.cismet.cids.custom.objecteditors.wunda_blau.WebDavPicturePanel.java

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

    final RoundedPanel pnlFotos = new RoundedPanel();
    final SemiRoundedPanel pnlHeaderFotos = new SemiRoundedPanel();
    final JLabel lblHeaderFotos = new JLabel();
    final JPanel jPanel2 = new JPanel();
    final JPanel jPanel1 = new JPanel();
    final JScrollPane jspFotoList = new JScrollPane();
    lstFotos = new JList();
    final JPanel pnlCtrlButtons = new JPanel();
    btnAddImg = new JButton();
    btnRemoveImg = new JButton();
    final JPanel pnlMap = new JPanel();
    final RoundedPanel pnlVorschau = new RoundedPanel();
    final SemiRoundedPanel semiRoundedPanel2 = new SemiRoundedPanel();
    final JLabel lblVorschau = new JLabel();
    final JPanel jPanel3 = new JPanel();
    pnlFoto = new JPanel();
    lblPicture = new JLabel();
    lblBusy = new JXBusyLabel(new Dimension(75, 75));
    final JPanel pnlCtrlBtn = new JPanel();
    btnPrevImg = new JButton();
    btnNextImg = new JButton();

    final FormListener formListener = new FormListener();

    setName("Form"); // NOI18N
    setOpaque(false);
    setLayout(new GridBagLayout());

    pnlFotos.setMinimumSize(new Dimension(400, 200));
    pnlFotos.setName("pnlFotos"); // NOI18N
    pnlFotos.setPreferredSize(new Dimension(400, 200));
    pnlFotos.setLayout(new GridBagLayout());

    pnlHeaderFotos.setBackground(new Color(51, 51, 51));
    pnlHeaderFotos.setForeground(new Color(51, 51, 51));
    pnlHeaderFotos.setName("pnlHeaderFotos"); // NOI18N
    pnlHeaderFotos.setLayout(new FlowLayout());

    lblHeaderFotos.setForeground(new Color(255, 255, 255));
    Mnemonics.setLocalizedText(lblHeaderFotos,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblHeaderFotos.text")); // NOI18N
    lblHeaderFotos.setName("lblHeaderFotos"); // NOI18N
    pnlHeaderFotos.add(lblHeaderFotos);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    pnlFotos.add(pnlHeaderFotos, gridBagConstraints);

    jPanel2.setName("jPanel2"); // NOI18N
    jPanel2.setOpaque(false);
    jPanel2.setLayout(new GridBagLayout());

    jPanel1.setName("jPanel1"); // NOI18N
    jPanel1.setOpaque(false);
    jPanel1.setLayout(new GridBagLayout());

    jspFotoList.setMinimumSize(new Dimension(250, 130));
    jspFotoList.setName("jspFotoList"); // NOI18N

    lstFotos.setMinimumSize(new Dimension(250, 130));
    lstFotos.setName("lstFotos"); // NOI18N
    lstFotos.setPreferredSize(new Dimension(250, 130));

    final ELProperty eLProperty = ELProperty.create("${cidsBean." + beanCollProp + "}");
    final JListBinding jListBinding = SwingBindings.createJListBinding(AutoBinding.UpdateStrategy.READ_WRITE,
            this, eLProperty, lstFotos);
    bindingGroup.addBinding(jListBinding);

    lstFotos.addListSelectionListener(formListener);
    jspFotoList.setViewportView(lstFotos);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel1.add(jspFotoList, gridBagConstraints);

    pnlCtrlButtons.setName("pnlCtrlButtons"); // NOI18N
    pnlCtrlButtons.setOpaque(false);
    pnlCtrlButtons.setLayout(new GridBagLayout());

    btnAddImg.setIcon(new ImageIcon(
            getClass().getResource("/de/cismet/cids/custom/objecteditors/wunda_blau/edit_add_mini.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnAddImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnAddImg.text")); // NOI18N
    btnAddImg.setBorderPainted(false);
    btnAddImg.setContentAreaFilled(false);
    btnAddImg.setName("btnAddImg"); // NOI18N
    btnAddImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.insets = new Insets(0, 0, 5, 0);
    pnlCtrlButtons.add(btnAddImg, gridBagConstraints);

    btnRemoveImg.setIcon(new ImageIcon(
            getClass().getResource("/de/cismet/cids/custom/objecteditors/wunda_blau/edit_remove_mini.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnRemoveImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnRemoveImg.text")); // NOI18N
    btnRemoveImg.setBorderPainted(false);
    btnRemoveImg.setContentAreaFilled(false);
    btnRemoveImg.setName("btnRemoveImg"); // NOI18N
    btnRemoveImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new Insets(5, 0, 0, 0);
    pnlCtrlButtons.add(btnRemoveImg, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.NORTH;
    gridBagConstraints.insets = new Insets(0, 5, 0, 0);
    jPanel1.add(pnlCtrlButtons, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(10, 10, 10, 0);
    jPanel2.add(jPanel1, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(0, 0, 2, 0);
    pnlFotos.add(jPanel2, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.NORTH;
    gridBagConstraints.insets = new Insets(0, 0, 5, 5);
    add(pnlFotos, gridBagConstraints);

    pnlMap.setBorder(BorderFactory.createEtchedBorder());
    pnlMap.setMinimumSize(new Dimension(400, 200));
    pnlMap.setName("pnlMap"); // NOI18N
    pnlMap.setPreferredSize(new Dimension(400, 200));
    pnlMap.setLayout(new BorderLayout());
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.VERTICAL;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(5, 0, 0, 5);
    add(pnlMap, gridBagConstraints);
    pnlMap.add(map, BorderLayout.CENTER);

    pnlVorschau.setName("pnlVorschau"); // NOI18N
    pnlVorschau.setLayout(new GridBagLayout());

    semiRoundedPanel2.setBackground(new Color(51, 51, 51));
    semiRoundedPanel2.setName("semiRoundedPanel2"); // NOI18N
    semiRoundedPanel2.setLayout(new FlowLayout());

    lblVorschau.setForeground(new Color(255, 255, 255));
    Mnemonics.setLocalizedText(lblVorschau,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblVorschau.text")); // NOI18N
    lblVorschau.setName("lblVorschau"); // NOI18N
    semiRoundedPanel2.add(lblVorschau);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    pnlVorschau.add(semiRoundedPanel2, gridBagConstraints);

    jPanel3.setName("jPanel3"); // NOI18N
    jPanel3.setOpaque(false);
    jPanel3.setLayout(new GridBagLayout());

    pnlFoto.setName("pnlFoto"); // NOI18N
    pnlFoto.setOpaque(false);
    pnlFoto.setLayout(new GridBagLayout());

    lblPicture.setHorizontalAlignment(SwingConstants.CENTER);
    Mnemonics.setLocalizedText(lblPicture,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblPicture.text")); // NOI18N
    lblPicture.setName("lblPicture"); // NOI18N
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlFoto.add(lblPicture, gridBagConstraints);

    lblBusy.setHorizontalAlignment(SwingConstants.CENTER);
    lblBusy.setMaximumSize(new Dimension(140, 40));
    lblBusy.setMinimumSize(new Dimension(140, 60));
    lblBusy.setName("lblBusy"); // NOI18N
    lblBusy.setPreferredSize(new Dimension(140, 60));
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlFoto.add(lblBusy, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(10, 10, 0, 10);
    jPanel3.add(pnlFoto, gridBagConstraints);

    pnlCtrlBtn.setName("pnlCtrlBtn"); // NOI18N
    pnlCtrlBtn.setOpaque(false);
    pnlCtrlBtn.setPreferredSize(new Dimension(100, 50));
    pnlCtrlBtn.setLayout(new GridBagLayout());

    btnPrevImg.setIcon(new ImageIcon(getClass().getResource("/res/arrow-left.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnPrevImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnPrevImg.text")); // NOI18N
    btnPrevImg.setBorderPainted(false);
    btnPrevImg.setFocusPainted(false);
    btnPrevImg.setName("btnPrevImg"); // NOI18N
    btnPrevImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlCtrlBtn.add(btnPrevImg, gridBagConstraints);

    btnNextImg.setIcon(new ImageIcon(getClass().getResource("/res/arrow-right.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnNextImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnNextImg.text")); // NOI18N
    btnNextImg.setBorderPainted(false);
    btnNextImg.setFocusPainted(false);
    btnNextImg.setName("btnNextImg"); // NOI18N
    btnNextImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlCtrlBtn.add(btnNextImg, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.insets = new Insets(0, 10, 10, 10);
    jPanel3.add(pnlCtrlBtn, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlVorschau.add(jPanel3, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new Insets(0, 5, 0, 0);
    add(pnlVorschau, gridBagConstraints);

    bindingGroup.bind();
}

From source file:de.rub.syssec.saaf.gui.editor.FileTree.java

public FileTree(final ApplicationInterface app, File dir, OpenAnalysis open) {
    super();//from  w w  w.j a v  a 2 s .  c  o m
    this.openAna = open;
    history = new Vector<Vector<String>>();
    linkEditorKit = new LinkEditorKit(history, app.getUnpackedDataDir(), this);

    directory = dir;
    //userful to debug layout issues
    //setBackground(Color.MAGENTA);
    setLayout(new GridBagLayout());

    this.model = new EditorModel(app);

    // we want to be notified if the file changes so we can reflect that in
    // the tree
    model.addPropertyChangeListener(this);

    // the tree that lists the files (top left)
    JTree tree = new JTree(addNodes(null, dir));
    tree.addMouseListener(ma);
    tree.addTreeSelectionListener(new SelectionListener());
    tree.setCellRenderer(new FileCellRenderer());
    fileTree = tree;

    GridBagConstraints treeConstraints = new GridBagConstraints();
    treeConstraints.fill = GridBagConstraints.BOTH;
    treeConstraints.gridheight = 1;
    treeConstraints.gridwidth = 1;
    treeConstraints.gridx = 0;
    treeConstraints.gridy = 0;
    treeConstraints.weightx = 0.20;
    treeConstraints.weighty = 1.0;
    treeConstraints.anchor = GridBagConstraints.FIRST_LINE_START;
    this.add(new JScrollPane(tree), treeConstraints);

    // the list of components (bottom left)
    EntryPointsView entrypoints = new EntryPointsView(model);
    model.addPropertyChangeListener(entrypoints);

    JScrollPane entryPointsScroller = new JScrollPane(entrypoints);
    GridBagConstraints entrypointConstraints = new GridBagConstraints();
    entrypointConstraints.anchor = GridBagConstraints.FIRST_LINE_START;
    entrypointConstraints.fill = GridBagConstraints.BOTH;
    entrypointConstraints.gridheight = 1;
    entrypointConstraints.gridwidth = 1;
    entrypointConstraints.gridx = 0;
    entrypointConstraints.gridy = 1;
    entrypointConstraints.weightx = 0.15;
    entrypointConstraints.weighty = 1.0;

    this.add(entryPointsScroller, entrypointConstraints);

    // the editor (contains the textview and the list of methods)
    this.editor = new EditorView(model, this);
    this.model.addPropertyChangeListener(this.editor);

    GridBagConstraints editorConstraints = new GridBagConstraints();
    editorConstraints.anchor = GridBagConstraints.NORTHWEST;
    editorConstraints.fill = GridBagConstraints.BOTH;
    editorConstraints.gridheight = 2;
    editorConstraints.gridwidth = 1;
    editorConstraints.gridx = 1;
    editorConstraints.gridy = 0;
    editorConstraints.weightx = 0.70;
    editorConstraints.weighty = 1.0;
    this.add(editor, editorConstraints);

    this.outlineTree = new OutlineView(this.model);
    model.addPropertyChangeListener("currentClass", outlineTree);

    GridBagConstraints outlineConstraints = new GridBagConstraints();
    outlineConstraints.anchor = GridBagConstraints.NORTHWEST;
    outlineConstraints.fill = GridBagConstraints.BOTH;
    outlineConstraints.gridwidth = 1;
    outlineConstraints.gridheight = 2;
    outlineConstraints.gridx = 2;
    outlineConstraints.gridy = 0;
    outlineConstraints.weightx = 0.15;
    outlineConstraints.weighty = 1.0;
    this.add(outlineTree, outlineConstraints);

    String shortpath = model.getCurrentFile().getAbsolutePath()
            .replace(app.getApplicationDirectory().getAbsolutePath(), "");
    this.setTitle("Editor - " + shortpath);
    searchNode(shortpath, null);
}

From source file:net.java.sip.communicator.impl.gui.main.chat.ChatWritePanel.java

/**
 * Initializes the sms menu./*ww  w.j  a v a2s.co m*/
 *
 * @param centerPanel the parent panel
 */
private void initSmsLabel(final JPanel centerPanel) {
    GridBagConstraints constraints = new GridBagConstraints();

    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.gridheight = 1;
    constraints.weightx = 0f;
    constraints.weighty = 0f;
    constraints.insets = new Insets(0, 3, 0, 0);

    ImageID smsIcon = new ImageID("service.gui.icons.SEND_SMS");

    ImageID selectedIcon = new ImageID("service.gui.icons.SEND_SMS_SELECTED");

    smsButton = new SIPCommToggleButton(ImageLoader.getImage(smsIcon), ImageLoader.getImage(selectedIcon),
            ImageLoader.getImage(smsIcon), ImageLoader.getImage(selectedIcon));

    smsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (smsMode && !isIMAllowed()) {
                return;
            }

            smsMode = smsButton.isSelected();

            Color bgColor;
            if (smsMode) {
                bgColor = new Color(GuiActivator.getResources().getColor("service.gui.LIST_SELECTION_COLOR"));

                smsCharCountLabel.setVisible(true);
                smsNumberLabel.setVisible(true);
            } else {
                bgColor = Color.WHITE;
                smsCharCountLabel.setVisible(false);
                smsNumberLabel.setVisible(false);
            }

            centerPanel.setBackground(bgColor);
            editorPane.setBackground(bgColor);
        }
    });

    // We hide the sms label until we know if the chat supports sms.
    smsButton.setVisible(false);

    centerPanel.add(smsButton, constraints);
}