Example usage for java.awt GridBagConstraints WEST

List of usage examples for java.awt GridBagConstraints WEST

Introduction

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

Prototype

int WEST

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

Click Source Link

Document

Put the component on the left side of its display area, centered vertically.

Usage

From source file:org.yccheok.jstock.gui.IndicatorPanel.java

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

    toolButtonGroup = new javax.swing.ButtonGroup();
    jPanel10 = new javax.swing.JPanel();
    jScrollPane2 = new javax.swing.JScrollPane();
    jList2 = new javax.swing.JList();
    jComboBox1 = new AutoCompleteJComboBox();
    jSplitPane1 = new javax.swing.JSplitPane();
    jPanel4 = new javax.swing.JPanel();
    scrollPane = new javax.swing.JScrollPane();
    view = new org.jhotdraw.draw.DefaultDrawingView();
    jPanel1 = new javax.swing.JPanel();
    creationToolbar = new javax.swing.JToolBar();
    jSplitPane2 = new javax.swing.JSplitPane();
    jPanel2 = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton5 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel11 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jList1 = new javax.swing.JList();
    jPanel5 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jButton4 = new javax.swing.JButton();
    jButton6 = new javax.swing.JButton();
    jPanel7 = new javax.swing.JPanel();
    objectInspectorJPanel = new ObjectInspectorJPanel(new MutableStock(
            org.yccheok.jstock.engine.Utils.getEmptyStock(Code.newInstance(""), Symbol.newInstance(""))));

    jPanel10.setLayout(new java.awt.BorderLayout());

    jList2.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    this.jList2.setModel(new DefaultListModel());
    this.jList2.addMouseListener(new JListPopupListener());
    jList2.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
        public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
            jList2ValueChanged(evt);
        }
    });
    jScrollPane2.setViewportView(jList2);

    jPanel10.add(jScrollPane2, java.awt.BorderLayout.CENTER);

    jComboBox1.setEditable(true);
    jComboBox1.setPreferredSize(new java.awt.Dimension(150, 24));
    ((AutoCompleteJComboBox) jComboBox1).attachStockInfoObserver(this.getStockInfoObserver());
    ((AutoCompleteJComboBox) jComboBox1).attachDispObserver(this.getDispObserver());

    setLayout(new java.awt.BorderLayout());

    // Priority give to left component.
    jSplitPane1.setResizeWeight(0.9);

    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/gui"); // NOI18N
    jPanel4.setBorder(
            javax.swing.BorderFactory.createTitledBorder(bundle.getString("IndicatorPanel_StockIndicator"))); // NOI18N
    jPanel4.setLayout(new java.awt.BorderLayout(5, 5));

    scrollPane.setViewportView(view);

    jPanel4.add(scrollPane, java.awt.BorderLayout.CENTER);

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

    creationToolbar.setFloatable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    jPanel1.add(creationToolbar, gridBagConstraints);

    jPanel4.add(jPanel1, java.awt.BorderLayout.SOUTH);

    jSplitPane1.setLeftComponent(jPanel4);

    jSplitPane2.setDividerLocation(305);
    jSplitPane2.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
    jSplitPane2.setMinimumSize(new java.awt.Dimension(300, 261));
    jSplitPane2.setPreferredSize(new java.awt.Dimension(150, 368));

    jPanel2.setBorder(
            javax.swing.BorderFactory.createTitledBorder(bundle.getString("IndicatorPanel_Database"))); // NOI18N
    jPanel2.setLayout(new java.awt.BorderLayout(5, 5));

    jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 0, 5, 5));

    jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/filenew.png"))); // NOI18N
    jButton1.setText(bundle.getString("New...")); // NOI18N
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });
    jPanel3.add(jButton1);

    jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/filesave.png"))); // NOI18N
    jButton5.setText(bundle.getString("Save")); // NOI18N
    jButton5.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton5ActionPerformed(evt);
        }
    });
    jPanel3.add(jButton5);

    jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/download.png"))); // NOI18N
    jButton2.setText(bundle.getString("Install...")); // NOI18N
    jButton2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton2ActionPerformed(evt);
        }
    });
    jPanel3.add(jButton2);

    jPanel2.add(jPanel3, java.awt.BorderLayout.SOUTH);

    jPanel11.setLayout(new java.awt.BorderLayout());

    jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    this.jList1.setModel(new DefaultListModel());
    this.jList1.addMouseListener(new JListPopupListener());
    jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
        public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
            jList1ValueChanged(evt);
        }
    });
    jScrollPane1.setViewportView(jList1);

    jPanel11.add(jScrollPane1, java.awt.BorderLayout.CENTER);

    jTabbedPane1.addTab(bundle.getString("IndicatorPanel_AlertIndicator"),
            new javax.swing.ImageIcon(getClass().getResource("/images/16x16/bell.png")), jPanel11); // NOI18N

    jPanel2.add(jTabbedPane1, java.awt.BorderLayout.CENTER);

    jSplitPane2.setTopComponent(jPanel2);

    jPanel5.setBorder(
            javax.swing.BorderFactory.createTitledBorder(bundle.getString("IndicatorPanel_StockSampleData"))); // NOI18N
    jPanel5.setLayout(new java.awt.BorderLayout(5, 5));

    jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/player_play.png"))); // NOI18N
    jButton4.setText(bundle.getString("IndicatorPanel_Simulate")); // NOI18N
    jButton4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton4ActionPerformed(evt);
        }
    });
    jPanel6.add(jButton4);

    jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/stop.png"))); // NOI18N
    jButton6.setText(bundle.getString("IndicatorPanel_Stop")); // NOI18N
    jButton6.setEnabled(false);
    jButton6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton6ActionPerformed(evt);
        }
    });
    jPanel6.add(jButton6);

    jPanel5.add(jPanel6, java.awt.BorderLayout.SOUTH);
    jPanel5.add(jPanel7, java.awt.BorderLayout.NORTH);
    jPanel5.add(objectInspectorJPanel, java.awt.BorderLayout.CENTER);

    jSplitPane2.setBottomComponent(jPanel5);

    jSplitPane1.setRightComponent(jSplitPane2);

    add(jSplitPane1, java.awt.BorderLayout.CENTER);
}

From source file:com.supermap.desktop.icloud.CloudLicenseDialog.java

private void initLayout() {
    this.setLayout(new GridBagLayout());

    JPanel panelButton = new JPanel();
    panelButton.setLayout(new GridBagLayout());
    panelButton.add(this.buttonLogin, new GridBagConstraintsHelper(0, 0, 1, 1)
            .setAnchor(GridBagConstraints.EAST).setWeight(0, 0).setInsets(2, 0, 10, 10));
    panelButton.add(this.buttonClose, new GridBagConstraintsHelper(1, 0, 1, 1)
            .setAnchor(GridBagConstraints.EAST).setWeight(0, 0).setInsets(2, 0, 10, 10));

    this.add(panelCloudImage, new GridBagConstraintsHelper(0, 0, 6, 3).setAnchor(GridBagConstraints.NORTH)
            .setFill(GridBagConstraints.BOTH).setWeight(1, 1));
    this.add(panelUserImage, new GridBagConstraintsHelper(0, 3, 1, 3).setInsets(10, 0, 0, 0)
            .setAnchor(GridBagConstraints.NORTH).setFill(GridBagConstraints.BOTH).setWeight(1, 1));
    this.add(labelWarning, new GridBagConstraintsHelper(1, 3, 2, 1).setInsets(20, 5, 10, 5)
            .setAnchor(GridBagConstraints.WEST).setFill(GridBagConstraints.NONE).setWeight(0, 0));
    this.add(labelUserName, new GridBagConstraintsHelper(1, 4, 1, 1).setInsets(10, 5, 10, 5)
            .setAnchor(GridBagConstraints.WEST).setFill(GridBagConstraints.NONE).setWeight(0, 0));
    this.add(textFieldUserName, new GridBagConstraintsHelper(2, 4, 3, 1).setInsets(10, 0, 10, 5)
            .setAnchor(GridBagConstraints.WEST).setFill(GridBagConstraints.HORIZONTAL).setWeight(1, 0));
    this.add(labelRegister, new GridBagConstraintsHelper(5, 4, 1, 1).setInsets(10, 5, 5, 16)
            .setAnchor(GridBagConstraints.WEST).setFill(GridBagConstraints.BOTH).setWeight(1, 1));
    this.add(labelPassWord, new GridBagConstraintsHelper(1, 5, 1, 1).setInsets(0, 5, 0, 5)
            .setAnchor(GridBagConstraints.WEST).setFill(GridBagConstraints.NONE).setWeight(0, 0));
    this.add(fieldPassWord, new GridBagConstraintsHelper(2, 5, 3, 1).setInsets(0, 0, 0, 5)
            .setAnchor(GridBagConstraints.WEST).setFill(GridBagConstraints.HORIZONTAL).setWeight(1, 0));
    this.add(labelFindPassword, new GridBagConstraintsHelper(5, 5, 1, 1).setInsets(0, 5, 0, 16)
            .setAnchor(GridBagConstraints.WEST).setFill(GridBagConstraints.BOTH).setWeight(1, 1));
    this.add(checkBoxSavePassword, new GridBagConstraintsHelper(2, 6, 1, 1).setInsets(0, 5, 5, 5)
            .setAnchor(GridBagConstraints.WEST).setFill(GridBagConstraints.NONE).setWeight(0, 0));
    this.add(checkBoxAutoLogin, new GridBagConstraintsHelper(3, 6, 1, 1).setInsets(0, 0, 5, 5)
            .setAnchor(GridBagConstraints.WEST).setFill(GridBagConstraints.NONE).setWeight(0, 0));
    this.add(panelButton,
            new GridBagConstraintsHelper(0, 7, 6, 1).setAnchor(GridBagConstraints.EAST).setWeight(0, 0));
    this.labelRegister.setPreferredSize(new Dimension(100, 23));
    this.labelFindPassword.setPreferredSize(new Dimension(100, 23));
}

From source file:ro.nextreports.designer.querybuilder.SelectionColumnPanel.java

private void buildUI() {

    setLayout(new GridBagLayout());

    final DBViewer viewer = Globals.getDBViewer();

    schemaCombo = new JComboBox();
    schemaCombo.setPreferredSize(comboDim);

    schemaCombo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            String schema = (String) e.getItem();
            shownColumnModel.clear();/*from   w w  w .j a  v a2  s  . c om*/
            columnModel.clear();
            tableModel.clear();
            try {
                DBInfo dbInfo = viewer.getDBInfo(schema, DBInfo.TABLES | DBInfo.VIEWS);
                List<DBTable> tables = dbInfo.getTables();
                Collections.sort(tables);
                for (DBTable table : tables) {
                    tableModel.addElement(table);
                }
            } catch (NextSqlException ex) {
                LOG.error(ex.getMessage(), ex);
                ex.printStackTrace();
            }
        }
    });

    try {
        List<String> schemas = viewer.getSchemas();
        String schemaName = viewer.getUserSchema();
        Collections.sort(schemas);
        boolean added = false;
        for (String schema : schemas) {
            if (DefaultSchemaManager.getInstance().isVisible(
                    DefaultDataSourceManager.getInstance().getConnectedDataSource().getName(), schema)) {
                added = true;
                schemaCombo.addItem(schema);
            }
        }

        if ((schema == null) || schema.equals(DefaultDBViewer.NO_SCHEMA_NAME)) {
            schema = DefaultDBViewer.NO_SCHEMA_NAME;//viewer.getUserSchema();
        }
        if (!added) {
            schemaCombo.addItem(schema);
        }
        schemaCombo.setSelectedItem(schema);
    } catch (NextSqlException e) {
        LOG.error(e.getMessage(), e);
        e.printStackTrace();
    }

    // create table list
    tableList = new JXList(tableModel);
    tableList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tableList.setCellRenderer(new DBTableCellRenderer());

    // create column list
    columnList = new JXList(columnModel);
    if (singleSelection) {
        columnList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    } else {
        columnList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    }
    columnList.setCellRenderer(new DBColumnCellRenderer());

    shownColumnList = new JXList(shownColumnModel);
    if (singleSelection) {
        shownColumnList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    } else {
        columnList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    }
    addDoubleClick();

    shownColumnList.setCellRenderer(new DBColumnCellRenderer());
    shownColumnList.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent mouseEvent) {
            if ((mouseEvent.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) {
                JPopupMenu popupMenu = new JPopupMenu();
                JMenuItem menuItem = new JMenuItem(new DeselectListAction(shownColumnList));
                popupMenu.add(menuItem);
                popupMenu.show((Component) mouseEvent.getSource(), mouseEvent.getX(), mouseEvent.getY());
            }
        }
    });

    tableList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting() == false) {
                int index = tableList.getSelectedIndex();
                if (index == -1) {
                    return;
                }
                DBTable table = (DBTable) tableModel.getElementAt(index);
                try {
                    List<DBColumn> columns = null;
                    try {
                        columns = viewer.getColumns(table.getSchema(), table.getName());
                    } catch (MalformedTableNameException e1) {
                        Show.error("Malformed table name : " + table.getName());
                        return;
                    }
                    Collections.sort(columns);
                    columnModel.clear();
                    shownColumnModel.clear();
                    for (DBColumn column : columns) {
                        columnModel.addElement(column);
                        shownColumnModel.addElement(column);
                    }
                } catch (NextSqlException e1) {
                    LOG.error(e1.getMessage(), e1);
                    e1.printStackTrace();
                    Show.error(e1);
                }
            }
        }
    });

    columnList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            shownColumnList.clearSelection();
        }
    });

    scrTable = new JScrollPane(tableList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrTable.setPreferredSize(scrDim);
    scrTable.setMinimumSize(scrDim);
    scrTable.setBorder(new TitledBorder(I18NSupport.getString("parameter.source.tables")));
    scrColumn = new JScrollPane(columnList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrColumn.setPreferredSize(scrDim);
    scrColumn.setMinimumSize(scrDim);
    scrColumn.setBorder(new TitledBorder(I18NSupport.getString("parameter.source.columns")));
    scrShownColumn = new JScrollPane(shownColumnList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrShownColumn.setPreferredSize(scrDim);
    scrShownColumn.setMinimumSize(scrDim);
    scrShownColumn.setBorder(new TitledBorder(I18NSupport.getString("parameter.source.shown.columns")));

    JPanel schemaPanel = new JPanel();
    schemaPanel.setLayout(new BoxLayout(schemaPanel, BoxLayout.X_AXIS));
    schemaPanel.add(new JLabel("Schema"));
    schemaPanel.add(Box.createHorizontalStrut(5));
    schemaPanel.add(schemaCombo);

    add(schemaPanel, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    add(scrTable, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 5), 0, 0));
    add(scrColumn, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));
    if (show) {
        add(scrShownColumn, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST,
                GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    }
}

From source file:com.sec.ose.osi.ui.dialog.setting.JPanProjectAnalysisSetting.java

/**
 * This method initializes jIntRadioTopPanel   
 *    /*from w ww  .j  av a 2  s  .c  om*/
 * @return javax.swing.JPanel   
 */
private JPanel getJIntRadioTopPanel() {
    if (jIntRadioTopPanel == null) {

        GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
        gridBagConstraints51.gridx = 0;
        gridBagConstraints51.gridy = 2;

        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.insets = new Insets(0, 0, 0, 0);
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = GridBagConstraints.WEST;
        gridBagConstraints.gridy = 8;
        jLabelUserHour = new JLabel();
        jLabelUserHour.setText(" Hour (more than 12 hours)");
        GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
        gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints4.gridy = 8;
        gridBagConstraints4.weightx = 0.0;
        gridBagConstraints4.weighty = 0.0;
        gridBagConstraints4.ipadx = 0;
        gridBagConstraints4.gridx = 1;
        GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
        gridBagConstraints10.anchor = GridBagConstraints.WEST;
        gridBagConstraints10.gridx = 0;
        gridBagConstraints10.gridy = 8;
        gridBagConstraints10.insets = new Insets(0, 0, 0, 0);
        GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
        gridBagConstraints9.anchor = GridBagConstraints.WEST;
        gridBagConstraints9.gridx = 0;
        gridBagConstraints9.gridy = 7;
        gridBagConstraints9.insets = new Insets(0, 0, 0, 0);
        GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
        gridBagConstraints7.anchor = GridBagConstraints.WEST;
        gridBagConstraints7.gridx = 0;
        gridBagConstraints7.gridy = 6;
        gridBagConstraints7.insets = new Insets(0, 0, 0, 0);
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.anchor = GridBagConstraints.WEST;
        gridBagConstraints5.gridx = 0;
        gridBagConstraints5.gridy = 5;
        gridBagConstraints5.insets = new Insets(0, 0, 0, 0);
        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.anchor = GridBagConstraints.WEST;
        gridBagConstraints3.gridx = -1;
        gridBagConstraints3.gridy = 4;
        gridBagConstraints3.insets = new Insets(0, 0, 0, 0);
        GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
        gridBagConstraints6.anchor = GridBagConstraints.WEST;
        gridBagConstraints6.gridwidth = 2;
        gridBagConstraints6.gridx = 0;
        gridBagConstraints6.gridy = 5;
        gridBagConstraints6.insets = new Insets(0, 0, 0, 0);
        jIntRadioTopPanel = new JPanel();
        jIntRadioTopPanel.setLayout(new GridBagLayout());
        jIntRadioTopPanel.add(getJRadioButtonDisable(), gridBagConstraints3);
        jIntRadioTopPanel.add(getJRadioButton12Hour(), gridBagConstraints5);
        jIntRadioTopPanel.add(getJRadioButton24Hour(), gridBagConstraints7);
        jIntRadioTopPanel.add(getJRadioButton48Hour(), gridBagConstraints9);
        jIntRadioTopPanel.add(getJRadioButtonUserHour(), gridBagConstraints10);
        jIntRadioTopPanel.add(getJTextFieldUserHour(), gridBagConstraints4);
        jIntRadioTopPanel.add(jLabelUserHour, gridBagConstraints);
    }
    return jIntRadioTopPanel;
}

From source file:org.zaproxy.zap.extension.bruteforce.BruteForcePanel.java

private javax.swing.JToolBar getPanelToolbar() {
    if (panelToolbar == null) {

        panelToolbar = new javax.swing.JToolBar();
        panelToolbar.setLayout(new java.awt.GridBagLayout());
        panelToolbar.setEnabled(true);/*from  w  ww.j  a v a2  s . c o  m*/
        panelToolbar.setFloatable(false);
        panelToolbar.setRollover(true);
        panelToolbar.setPreferredSize(new java.awt.Dimension(800, 30));
        panelToolbar.setFont(FontUtils.getFont("Dialog"));
        panelToolbar.setName("BruteForceToolbar");

        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
        GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
        GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
        GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
        GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
        GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
        GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
        GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
        // Dummy
        GridBagConstraints gridBagConstraintsx = new GridBagConstraints();
        GridBagConstraints gridBagConstraintsy = new GridBagConstraints();

        gridBagConstraints1.gridx = 0;
        gridBagConstraints1.gridy = 0;
        gridBagConstraints1.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;

        gridBagConstraints2.gridx = 1;
        gridBagConstraints2.gridy = 0;
        gridBagConstraints2.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST;

        gridBagConstraints3.gridx = 2;
        gridBagConstraints3.gridy = 0;
        gridBagConstraints3.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;

        gridBagConstraints4.gridx = 3;
        gridBagConstraints4.gridy = 0;
        gridBagConstraints4.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraints4.anchor = java.awt.GridBagConstraints.WEST;

        gridBagConstraints5.gridx = 4;
        gridBagConstraints5.gridy = 0;
        gridBagConstraints5.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraints5.anchor = java.awt.GridBagConstraints.WEST;

        gridBagConstraints6.gridx = 5;
        gridBagConstraints6.gridy = 0;
        gridBagConstraints6.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraints6.anchor = java.awt.GridBagConstraints.WEST;

        gridBagConstraints7.gridx = 6;
        gridBagConstraints7.gridy = 0;
        gridBagConstraints7.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraints7.anchor = java.awt.GridBagConstraints.WEST;

        gridBagConstraints8.gridx = 7;
        gridBagConstraints8.gridy = 0;
        gridBagConstraints8.weightx = 1.0;
        gridBagConstraints8.weighty = 1.0;
        gridBagConstraints8.insets = new java.awt.Insets(0, 5, 0, 5); // Slight indent
        gridBagConstraints8.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints8.fill = java.awt.GridBagConstraints.HORIZONTAL;

        gridBagConstraints9.gridx = 8;
        gridBagConstraints9.gridy = 0;
        gridBagConstraints9.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraints9.anchor = java.awt.GridBagConstraints.EAST;

        gridBagConstraints10.gridx = 9;
        gridBagConstraints10.gridy = 0;
        gridBagConstraints10.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraints10.anchor = java.awt.GridBagConstraints.EAST;

        gridBagConstraints11.gridx = 10;
        gridBagConstraints11.gridy = 0;
        gridBagConstraints11.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraints11.anchor = java.awt.GridBagConstraints.EAST;

        gridBagConstraints12.gridx = 11;
        gridBagConstraints12.gridy = 0;
        gridBagConstraints12.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraints12.anchor = java.awt.GridBagConstraints.EAST;

        gridBagConstraints13.gridx = 12;
        gridBagConstraints13.gridy = 0;
        gridBagConstraints13.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraints13.anchor = java.awt.GridBagConstraints.EAST;

        gridBagConstraintsx.gridx = 20;
        gridBagConstraintsx.gridy = 0;
        gridBagConstraintsx.weightx = 1.0;
        // gridBagConstraintsx.weighty = 1.0;
        gridBagConstraintsx.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraintsx.anchor = java.awt.GridBagConstraints.WEST;

        gridBagConstraintsy.gridx = 21;
        gridBagConstraintsy.gridy = 0;
        gridBagConstraintsy.insets = new java.awt.Insets(0, 0, 0, 0);
        gridBagConstraintsy.anchor = java.awt.GridBagConstraints.WEST;

        panelToolbar.add(new JLabel(Constant.messages.getString("bruteforce.toolbar.site.label")),
                gridBagConstraints1);
        panelToolbar.add(getSiteSelect(), gridBagConstraints2);
        panelToolbar.add(new JLabel(Constant.messages.getString("bruteforce.toolbar.list.label")),
                gridBagConstraints3);
        panelToolbar.add(getFileSelect(), gridBagConstraints4);

        panelToolbar.add(getStartScanButton(), gridBagConstraints5);
        panelToolbar.add(getPauseScanButton(), gridBagConstraints6);
        panelToolbar.add(getStopScanButton(), gridBagConstraints7);
        panelToolbar.add(getProgressBar(), gridBagConstraints8);
        panelToolbar.add(getActiveScansNameLabel(), gridBagConstraints9);
        panelToolbar.add(getActiveScansValueLabel(), gridBagConstraints10);
        panelToolbar.add(getRequestCountNameLabel(), gridBagConstraints11);
        panelToolbar.add(getRequestCountValueLabel(), gridBagConstraints12);
        panelToolbar.add(getExportButton(), gridBagConstraints13);

        panelToolbar.add(new JLabel(), gridBagConstraintsx); // Filler
        // panelToolbar.add(getLaunchButton(), gridBagConstraintsx);
        panelToolbar.add(getOptionsButton(), gridBagConstraintsy);
    }
    return panelToolbar;
}

From source file:com.frostwire.gui.bittorrent.PartialFilesDialog.java

private void setupTitle() {
    GridBagConstraints c;/*from   w  ww  .j ava  2s  .c o  m*/

    String title = _torrent.getUTF8Name();
    if (title == null) {
        if (_torrent.getName() != null) {
            title = StringUtils.getUTF8String(_torrent.getName());
        } else {
            title = _name.replace("_", " ").replace(".torrent", "").replace("&quot;", "\"");
        }
    }
    labelTitle = new JLabel(title);
    labelTitle.setFont(new Font("Dialog", Font.BOLD, 18));
    labelTitle.setHorizontalAlignment(SwingConstants.LEFT);
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.anchor = GridBagConstraints.WEST;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.insets = new Insets(5, 5, 5, 5);
    panel.add(labelTitle, c);
}

From source file:org.apache.taverna.activities.rest.ui.config.RESTActivityConfigurationPanel.java

private JPanel createGeneralTab() {
    JPanel jpGeneral = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    // All components to be anchored WEST
    c.anchor = GridBagConstraints.WEST;

    c.gridx = 0;/*  ww  w.j  a v  a2 s.c o  m*/
    c.gridy = 0;
    c.gridwidth = 1;
    c.insets = new Insets(7, 7, 3, 3);
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
    JLabel labelMethod = new JLabel("HTTP Method:", infoIcon, JLabel.LEFT);
    labelMethod.setToolTipText(
            "<html>HTTP method determines how a request to the remote server will be made.<br><br>"
                    + "Supported HTTP methods are normally used for different purposes:<br>"
                    + "<b>GET</b> - to fetch data;<br>" + "<b>POST</b> - to create new resources;<br>"
                    + "<b>PUT</b> - to update existing resources;<br>"
                    + "<b>DELETE</b> - to remove existing resources.<br><br>"
                    + "Documentation of the server that is about to be used may suggest the<br>"
                    + "HTTP method that should be used.</html>");
    jpGeneral.add(labelMethod, c);

    // the HTTP method combo-box will always contain the same values - it is
    // the selected
    // method which is important; therefore, can prepopulate as the set of
    // values is known
    c.gridx++;
    c.insets = new Insets(7, 3, 3, 7);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    cbHTTPMethod = new JComboBox<>(HTTP_METHOD.values());
    cbHTTPMethod.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean contentTypeSelEnabled = RESTActivity
                    .hasMessageBodyInputPort((HTTP_METHOD) cbHTTPMethod.getSelectedItem());

            jlContentTypeExplanation.setVisible(contentTypeSelEnabled);
            jlContentType.setVisible(contentTypeSelEnabled);
            cbContentType.setVisible(contentTypeSelEnabled);
            jlSendDataAs.setVisible(contentTypeSelEnabled);
            cbSendDataAs.setVisible(contentTypeSelEnabled);

            jlContentTypeExplanationPlaceholder.setVisible(!contentTypeSelEnabled);
            jlContentTypeLabelPlaceholder.setVisible(!contentTypeSelEnabled);
            jlContentTypeFieldPlaceholder.setVisible(!contentTypeSelEnabled);
            jlSendDataAsLabelPlaceholder.setVisible(!contentTypeSelEnabled);
            jlSendDataAsFieldPlaceholder.setVisible(!contentTypeSelEnabled);
        }
    });
    jpGeneral.add(cbHTTPMethod, c);

    c.gridx = 0;
    c.gridy++;
    c.insets = new Insets(3, 7, 3, 3);
    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.0;
    JLabel labelString = new JLabel("URL Template:", infoIcon, JLabel.LEFT);
    labelString.setToolTipText("<html>URL template enables to define a URL with <b>configurable<br>"
            + "parameters</b> that will be used to access a remote server.<br><br>"
            + "The template may contain zero or more <b>parameters</b> - each<br>"
            + "enclosed within curly braces <b>\"{\"</b> and <b>\"}\"</b>.<br>"
            + "Taverna will automatically create an individual input port for<br>"
            + "this activity for each parameter.<br><br>"
            + "Values extracted from these input ports during the workflow<br>"
            + "execution these will be used to replace the parameters to<br>" + "produce complete URLs.<br><br>"
            + "For example, if the URL template is configured as<br>"
            + "\"<i>http://www.myexperiment.org/user.xml?id={userID}</i>\", a<br>"
            + "single input port with the name \"<i>userID</i>\" will be created.</html>");
    labelString.setLabelFor(tfURLSignature);
    jpGeneral.add(labelString, c);

    c.gridx++;
    c.insets = new Insets(3, 3, 3, 7);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    tfURLSignature = new JTextField(40);
    tfURLSignature.addFocusListener(new FocusListener() {
        public void focusGained(FocusEvent e) {
            tfURLSignature.selectAll();
        }

        public void focusLost(FocusEvent e) { /* do nothing */
        }
    });
    jpGeneral.add(tfURLSignature, c);

    c.gridx = 0;
    c.gridwidth = 2;
    c.gridy++;
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.insets = new Insets(18, 7, 3, 7);
    JLabel jlAcceptsExplanation = new JLabel(
            "Preferred MIME type for data to be fetched from the remote server --");
    jpGeneral.add(jlAcceptsExplanation, c);
    c.gridwidth = 1;

    c.gridx = 0;
    c.gridy++;
    c.insets = new Insets(3, 7, 3, 3);
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
    JLabel jlAccepts = new JLabel("'Accept' header:", infoIcon, JLabel.LEFT);
    jlAccepts.setToolTipText(
            "<html>Select a MIME type from the drop-down menu or type your own.<br>Select blank if you do not want this header to be set.</br>");
    jlAccepts.setLabelFor(cbAccepts);
    jpGeneral.add(jlAccepts, c);

    c.gridx++;
    c.insets = new Insets(3, 3, 3, 7);
    c.weightx = 1.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    cbAccepts = new JComboBox<>(getMediaTypes());
    cbAccepts.setEditable(true);
    cbAccepts.getEditor().getEditorComponent().addFocusListener(new FocusListener() {
        public void focusGained(FocusEvent e) {
            cbAccepts.getEditor().selectAll();
        }

        public void focusLost(FocusEvent e) { /* do nothing */
        }
    });
    jpGeneral.add(cbAccepts, c);

    c.gridx = 0;
    c.gridwidth = 2;
    c.gridy++;
    c.insets = new Insets(18, 7, 3, 7);
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
    jlContentTypeExplanation = new JLabel("MIME type of data that will be sent to the remote server --");
    jpGeneral.add(jlContentTypeExplanation, c);
    c.gridwidth = 1;

    c.gridx = 0;
    c.gridy++;
    c.insets = new Insets(3, 7, 3, 3);
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
    jlContentType = new JLabel("'Content-Type' header:", infoIcon, JLabel.LEFT);
    jlContentType.setToolTipText(
            "<html>Select a MIME type from the drop-down menu or type your own.<br>Select blank if you do not want this header to be set.</html>");
    jlContentType.setLabelFor(cbContentType);
    jpGeneral.add(jlContentType, c);

    c.gridx++;
    c.insets = new Insets(3, 3, 3, 7);
    c.weightx = 1.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    cbContentType = new JComboBox<>(getMediaTypes());
    cbContentType.setEditable(true);
    cbContentType.getEditor().getEditorComponent().addFocusListener(new FocusListener() {
        public void focusGained(FocusEvent e) {
            cbContentType.getEditor().selectAll();
        }

        public void focusLost(FocusEvent e) { /* do nothing */
        }
    });
    cbContentType.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // change selection in the "Send data as" combo-box, based on
            // the selection of Content-Type
            String selectedContentType = (String) cbContentType.getSelectedItem();
            if (selectedContentType.startsWith("text")) {
                cbSendDataAs.setSelectedItem(DATA_FORMAT.String);
            } else {
                cbSendDataAs.setSelectedItem(DATA_FORMAT.Binary);
            }
        }
    });
    jpGeneral.add(cbContentType, c);

    c.gridx = 0;
    c.gridwidth = 2;
    c.gridy++;
    c.insets = new Insets(18, 7, 3, 7);
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
    jlContentTypeExplanationPlaceholder = new JLabel();
    jlContentTypeExplanationPlaceholder.setPreferredSize(jlContentTypeExplanation.getPreferredSize());
    jpGeneral.add(jlContentTypeExplanationPlaceholder, c);
    c.gridwidth = 1;

    c.gridx = 0;
    c.gridy++;
    c.insets = new Insets(3, 7, 3, 3);
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
    jlContentTypeLabelPlaceholder = new JLabel();
    jlContentTypeLabelPlaceholder.setPreferredSize(jlContentType.getPreferredSize());
    jpGeneral.add(jlContentTypeLabelPlaceholder, c);

    c.gridx++;
    c.insets = new Insets(3, 3, 3, 7);
    c.weightx = 1.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    jlContentTypeFieldPlaceholder = new JLabel();
    jlContentTypeFieldPlaceholder.setPreferredSize(cbContentType.getPreferredSize());
    jpGeneral.add(jlContentTypeFieldPlaceholder, c);

    c.gridx = 0;
    c.gridy++;
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.insets = new Insets(3, 7, 8, 3);
    jlSendDataAs = new JLabel("Send data as:", infoIcon, JLabel.LEFT);
    jlSendDataAs.setToolTipText("Select the format for the data to be sent to the remote server");
    jlSendDataAs.setLabelFor(cbSendDataAs);
    jpGeneral.add(jlSendDataAs, c);

    c.gridx++;
    c.insets = new Insets(3, 3, 8, 7);
    c.weightx = 1.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    cbSendDataAs = new JComboBox<>(DATA_FORMAT.values());
    cbSendDataAs.setEditable(false);
    jpGeneral.add(cbSendDataAs, c);

    c.gridx = 0;
    c.gridy++;
    c.insets = new Insets(3, 7, 8, 3);
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
    jlSendDataAsLabelPlaceholder = new JLabel();
    jlSendDataAsLabelPlaceholder.setPreferredSize(jlSendDataAs.getPreferredSize());
    jpGeneral.add(jlSendDataAsLabelPlaceholder, c);

    c.gridx++;
    c.insets = new Insets(3, 3, 8, 7);
    c.weightx = 1.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    jlSendDataAsFieldPlaceholder = new JLabel();
    jlSendDataAsFieldPlaceholder.setPreferredSize(cbSendDataAs.getPreferredSize());
    jpGeneral.add(jlSendDataAsFieldPlaceholder, c);

    JPanel finalPanel = new JPanel(new BorderLayout());
    finalPanel.add(jpGeneral, BorderLayout.NORTH);
    return (finalPanel);
}

From source file:ro.nextreports.designer.querybuilder.SQLViewPanel.java

private void initUI() {
    sqlEditor = new Editor() {
        public void afterCaretMove() {
            removeHighlightErrorLine();//from   w w  w.j av a 2s. c  om
        }
    };
    this.queryArea = sqlEditor.getEditorPanel().getEditorPane();
    queryArea.setText(DEFAULT_QUERY);

    errorPainter = new javax.swing.text.Highlighter.HighlightPainter() {
        @Override
        public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent c) {
            try {
                Rectangle r = c.modelToView(c.getCaretPosition());
                g.setColor(Color.RED.brighter().brighter());
                g.fillRect(0, r.y, c.getWidth(), r.height);
            } catch (BadLocationException e) {
                // ignore
            }
        }
    };

    ActionMap actionMap = sqlEditor.getEditorPanel().getEditorPane().getActionMap();

    // create the toolbar
    JToolBar toolBar = new JToolBar();
    toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders
    toolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
    toolBar.setBorderPainted(false);

    // add cut action
    Action cutAction = actionMap.get(BaseEditorKit.cutAction);
    cutAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("cut"));
    cutAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("sqlviewpanel.cut"));
    toolBar.add(cutAction);

    // add copy action
    Action copyAction = actionMap.get(BaseEditorKit.copyAction);
    copyAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("copy"));
    copyAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("sqlviewpanel.copy"));
    toolBar.add(copyAction);

    // add paste action
    Action pasteAction = actionMap.get(BaseEditorKit.pasteAction);
    pasteAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("paste"));
    pasteAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("sqlviewpanel.paste"));
    toolBar.add(pasteAction);

    // add separator
    SwingUtil.addCustomSeparator(toolBar);

    // add undo action
    Action undoAction = actionMap.get(BaseEditorKit.undoAction);
    undoAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("undo"));
    undoAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("undo"));
    toolBar.add(undoAction);

    // add redo action
    Action redoAction = actionMap.get(BaseEditorKit.redoAction);
    redoAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("redo"));
    redoAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("redo"));
    toolBar.add(redoAction);

    // add separator
    SwingUtil.addCustomSeparator(toolBar);

    // add find action
    Action findReplaceAction = actionMap.get(BaseEditorKit.findReplaceAction);
    findReplaceAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("find"));
    findReplaceAction.putValue(Action.SHORT_DESCRIPTION,
            I18NSupport.getString("sqleditor.findReplaceActionName"));
    toolBar.add(findReplaceAction);

    // add separator
    SwingUtil.addCustomSeparator(toolBar);

    // add run action
    runAction = new SQLRunAction();
    runAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("run"));
    runAction.putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(ShortcutsUtil.getShortcut("query.run.accelerator", "control 4")));
    runAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("run.query") + " ("
            + ShortcutsUtil.getShortcut("query.run.accelerator.display", "Ctrl 4") + ")");
    // runAction is globally registered in QueryBuilderPanel !
    toolBar.add(runAction);

    //        ro.nextreports.designer.util.SwingUtil.registerButtonsForFocus(buttonsPanel);

    // create the table
    resultTable = new JXTable();
    resultTable.setDefaultRenderer(Integer.class, new ToStringRenderer()); // to remove thousand separators
    resultTable.setDefaultRenderer(Long.class, new ToStringRenderer());
    resultTable.setDefaultRenderer(Date.class, new DateRenderer());
    resultTable.setDefaultRenderer(Double.class, new DoubleRenderer());
    resultTable.addMouseListener(new CopyTableMouseAdapter(resultTable));
    TableUtil.setRowHeader(resultTable);
    resultTable.setColumnControlVisible(true);
    //        resultTable.getTableHeader().setReorderingAllowed(false);
    resultTable.setHorizontalScrollEnabled(true);

    // highlight table
    Highlighter alternateHighlighter = HighlighterFactory.createAlternateStriping(Color.WHITE,
            ColorUtil.PANEL_BACKROUND_COLOR);
    Highlighter nullHighlighter = new TextHighlighter(ResultSetTableModel.NULL_VALUE, Color.YELLOW.brighter());
    Highlighter blobHighlighter = new TextHighlighter(ResultSetTableModel.BLOB_VALUE, Color.GRAY.brighter());
    Highlighter clobHighlighter = new TextHighlighter(ResultSetTableModel.CLOB_VALUE, Color.GRAY.brighter());
    resultTable.setHighlighters(alternateHighlighter, nullHighlighter, blobHighlighter, clobHighlighter);
    resultTable.setBackground(ColorUtil.PANEL_BACKROUND_COLOR);
    resultTable.setGridColor(Color.LIGHT_GRAY);

    resultTable.setRolloverEnabled(true);
    resultTable.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, null, Color.RED));

    JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    split.setResizeWeight(0.66);
    split.setOneTouchExpandable(true);

    JPanel topPanel = new JPanel();
    topPanel.setLayout(new GridBagLayout());
    topPanel.add(toolBar, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    topPanel.add(sqlEditor, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new GridBagLayout());
    JScrollPane scrPanel = new JScrollPane(resultTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    statusPanel = new SQLStatusPanel();
    bottomPanel.add(scrPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    bottomPanel.add(statusPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));

    split.setTopComponent(topPanel);
    split.setBottomComponent(bottomPanel);
    split.setDividerLocation(400);

    setLayout(new BorderLayout());
    this.add(split, BorderLayout.CENTER);
}

From source file:org.openconcerto.erp.core.sales.order.component.CommandeClientSQLComponent.java

public void addViews() {
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();

    // Numero du commande
    c.gridx = 0;/*from w  w  w. j a  va 2  s  .  c  om*/
    this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c);

    this.numeroUniqueCommande = new JUniqueTextField(16);
    c.fill = GridBagConstraints.NONE;
    c.gridx++;
    c.weightx = 1;
    this.add(this.numeroUniqueCommande, c);

    // Date
    JLabel labelDate = new JLabel(getLabelFor("DATE"));
    labelDate.setHorizontalAlignment(SwingConstants.RIGHT);
    c.gridx = 2;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    this.add(labelDate, c);

    JDate dateCommande = new JDate(true);
    c.gridx++;
    c.fill = GridBagConstraints.NONE;
    this.add(dateCommande, c);

    // Champ Module
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    final JPanel addP = ComptaSQLConfElement.createAdditionalPanel();

    this.setAdditionalFieldsPanel(new FormLayouter(addP, 2));
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    this.add(addP, c);

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

    this.comboDevis = new ElementComboBox();

    // Reference
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.fill = GridBagConstraints.HORIZONTAL;

    JLabel labelObjet = new JLabel(getLabelFor("NOM"));
    labelObjet.setHorizontalAlignment(SwingConstants.RIGHT);
    c.weightx = 0;
    this.add(labelObjet, c);

    c.gridx++;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    this.add(this.textObjet, c);

    String field;
    field = "ID_COMMERCIAL";
    c.fill = GridBagConstraints.HORIZONTAL;
    // Commercial
    JLabel labelCommercial = new JLabel(getLabelFor(field));
    labelCommercial.setHorizontalAlignment(SwingConstants.RIGHT);

    c.gridx++;
    c.weightx = 0;
    this.add(labelCommercial, c);

    this.comboCommercial = new ElementComboBox(false, 25);
    this.comboCommercial.setListIconVisible(false);
    c.gridx++;
    c.fill = GridBagConstraints.NONE;
    c.weightx = 1;
    this.add(this.comboCommercial, c);
    addRequiredSQLObject(this.comboCommercial, field);

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

    this.comboClient = new ElementComboBox();
    c.gridx = GridBagConstraints.RELATIVE;
    c.gridwidth = 3;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.NONE;
    this.add(this.comboClient, c);
    final ElementComboBox boxTarif = new ElementComboBox();
    this.comboClient.addValueListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (!isFilling() && comboClient.getValue() != null) {
                Integer id = comboClient.getValue();

                if (id > 1) {

                    SQLRow row = comboClient.getElement().getTable().getRow(id);
                    if (comboClient.getElement().getTable().getFieldsName().contains("ID_TARIF")) {

                        SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
                        if (!foreignRow.isUndefined()
                                && (boxTarif.getSelectedRow() == null
                                        || boxTarif.getSelectedId() != foreignRow.getID())
                                && JOptionPane.showConfirmDialog(null,
                                        "Appliquer les tarifs associs au client?") == JOptionPane.YES_OPTION) {
                            boxTarif.setValue(foreignRow.getID());
                            // SaisieVenteFactureSQLComponent.this.tableFacture.setTarif(foreignRow,
                            // true);
                        } else {
                            boxTarif.setValue(foreignRow.getID());
                        }
                        // SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
                        // if (foreignRow.isUndefined() &&
                        // !row.getForeignRow("ID_DEVISE").isUndefined()) {
                        // SQLRowValues rowValsD = new SQLRowValues(foreignRow.getTable());
                        // rowValsD.put("ID_DEVISE", row.getObject("ID_DEVISE"));
                        // foreignRow = rowValsD;
                        //
                        // }
                        // table.setTarif(foreignRow, true);
                    }
                }
            }

        }
    });
    // 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"), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;

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

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                SQLRow selectedRow = boxTarif.getRequest().getPrimaryTable().getRow(boxTarif.getWantedID());
                table.setTarif(selectedRow, false);
            }
        });
    }

    // Table d'lment
    this.table = new CommandeClientItemTable();
    c.fill = GridBagConstraints.BOTH;
    c.gridy++;
    c.gridx = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    this.add(this.table, c);

    DeviseField textPortHT = new DeviseField();
    DeviseField textRemiseHT = new DeviseField();

    // INfos
    c.gridx = 0;
    c.gridy++;
    c.gridheight = 1;
    c.weighty = 0;
    c.weightx = 1;
    c.anchor = GridBagConstraints.WEST;
    c.gridwidth = 2;
    this.add(new TitledSeparator(getLabelFor("INFOS")), c);

    c.gridy++;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.BOTH;
    final JScrollPane scrollPane = new JScrollPane(this.infos);
    scrollPane.setBorder(null);
    this.add(scrollPane, c);

    // Poids
    c.gridwidth = 1;

    DefaultProps props = DefaultNXProps.getInstance();
    Boolean b = props.getBooleanValue("ArticleShowPoids");
    final JTextField textPoidsTotal = new JTextField(8);
    if (b) {
        JPanel panel = new JPanel();

        panel.add(new JLabel(getLabelFor("T_POIDS")), c);

        textPoidsTotal.setEnabled(false);
        textPoidsTotal.setHorizontalAlignment(JTextField.RIGHT);
        textPoidsTotal.setDisabledTextColor(Color.BLACK);
        panel.add(textPoidsTotal, c);

        panel.setOpaque(false);
        DefaultGridBagConstraints.lockMinimumSize(panel);

        c.gridx = 2;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        c.fill = GridBagConstraints.NONE;
        c.anchor = GridBagConstraints.NORTHEAST;
        this.add(panel, c);
    }

    // Total
    DeviseField fieldHT = new DeviseField();
    DeviseField fieldTVA = new DeviseField();
    DeviseField fieldTTC = new DeviseField();
    DeviseField fieldDevise = new DeviseField();
    DeviseField fieldService = new DeviseField();
    DeviseField fieldHA = new DeviseField();
    fieldHT.setOpaque(false);
    fieldHA.setOpaque(false);
    fieldTVA.setOpaque(false);
    fieldTTC.setOpaque(false);
    fieldService.setOpaque(false);
    addSQLObject(fieldDevise, "T_DEVISE");
    addRequiredSQLObject(fieldHT, "T_HT");
    addRequiredSQLObject(fieldTVA, "T_TVA");
    addRequiredSQLObject(fieldTTC, "T_TTC");
    addRequiredSQLObject(fieldService, "T_SERVICE");
    if (getTable().contains("PREBILAN")) {
        addSQLObject(fieldHA, "PREBILAN");
    } else if (getTable().contains("T_HA")) {
        addSQLObject(fieldHA, "T_HA");
    }

    JTextField poids = new JTextField();
    // addSQLObject(poids, "T_POIDS");
    final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT,
            textRemiseHT, fieldService, fieldHA, fieldDevise, poids, null);

    c.gridx = GridBagConstraints.RELATIVE;
    c.gridy--;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 2;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.fill = GridBagConstraints.NONE;
    c.weighty = 0;

    this.add(totalTTC, c);

    this.panelOO = new PanelOOSQLComponent(this);
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.EAST;
    c.gridx = 0;
    c.gridy += 3;
    c.weightx = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    this.add(this.panelOO, c);

    textPortHT.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void removeUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void insertUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }
    });

    textRemiseHT.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void removeUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void insertUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }
    });

    addRequiredSQLObject(this.comboClient, "ID_CLIENT");
    addSQLObject(this.textObjet, "NOM");
    addSQLObject(textPoidsTotal, "T_POIDS");
    addRequiredSQLObject(dateCommande, "DATE");
    // addRequiredSQLObject(radioEtat, "ID_ETAT_DEVIS");
    addRequiredSQLObject(this.numeroUniqueCommande, "NUMERO");
    addSQLObject(this.infos, "INFOS");
    addSQLObject(this.comboDevis, "ID_DEVIS");

    this.numeroUniqueCommande
            .setText(NumerotationAutoSQLElement.getNextNumero(CommandeClientSQLElement.class, new Date()));

    this.table.getModel().addTableModelListener(new TableModelListener() {

        public void tableChanged(TableModelEvent e) {
            textPoidsTotal.setText(String.valueOf(CommandeClientSQLComponent.this.table.getPoidsTotal()));
        }
    });
    DefaultGridBagConstraints.lockMinimumSize(comboClient);
    DefaultGridBagConstraints.lockMinimumSize(comboCommercial);
    DefaultGridBagConstraints.lockMinimumSize(comboDevis);
    DefaultGridBagConstraints.lockMinimumSize(totalTTC);
    DefaultGridBagConstraints.lockMaximumSize(totalTTC);
    DefaultGridBagConstraints.lockMinimumSize(numeroUniqueCommande);

}

From source file:gov.loc.repository.bagger.ui.NewBagInPlaceFrame.java

private void layoutSpacer(JPanel contentPanel, int row) {
    GridBagConstraints glbc = new GridBagConstraints();
    glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 1, 50, GridBagConstraints.NONE,
            GridBagConstraints.WEST);
    JLabel spacerLabel = new JLabel("");
    contentPanel.add(spacerLabel, glbc);
}