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.jets3t.gui.ObjectsAttributesDialog.java

/**
 * Initialise the GUI elements to display the given item.
 *//*from ww w .  ja v a  2 s.co  m*/
private void initGui() {
    this.setResizable(true);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    JPanel unmodifiableAttributesPanel = skinsFactory.createSkinnedJPanel("ObjectStaticAttributesPanel");
    unmodifiableAttributesPanel.setLayout(new GridBagLayout());
    JPanel metadataContainer = skinsFactory.createSkinnedJPanel("ObjectPropertiesMetadataPanel");
    metadataContainer.setLayout(new GridBagLayout());
    metadataButtonsContainer = skinsFactory.createSkinnedJPanel("ObjectPropertiesMetadataButtonsPanel");
    metadataButtonsContainer.setLayout(new GridBagLayout());

    // Fields to display unmodifiable object details.
    JLabel objectKeyLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectKeyLabel");
    objectKeyLabel.setText("Object key:");
    objectKeyTextField = skinsFactory.createSkinnedJTextField("ObjectKeyTextField");
    objectKeyTextField.setEditable(false);
    JLabel objectContentLengthLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectContentLengthLabel");
    objectContentLengthLabel.setText("Size:");
    objectContentLengthTextField = skinsFactory.createSkinnedJTextField("ObjectContentLengthTextField");
    objectContentLengthTextField.setEditable(false);
    JLabel objectLastModifiedLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectLastModifiedLabel");
    objectLastModifiedLabel.setText("Last modified:");
    objectLastModifiedTextField = skinsFactory.createSkinnedJTextField("ObjectLastModifiedTextField");
    objectLastModifiedTextField.setEditable(false);
    JLabel objectETagLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectETagLabel");
    objectETagLabel.setText("ETag:");
    objectETagTextField = skinsFactory.createSkinnedJTextField("ObjectETagTextField");
    objectETagTextField.setEditable(false);
    JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel");
    bucketNameLabel.setText("Bucket:");
    bucketLocationTextField = skinsFactory.createSkinnedJTextField("BucketLocationTextField");
    bucketLocationTextField.setEditable(false);
    ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel");
    ownerNameLabel.setText("Owner name:");
    ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField");
    ownerNameTextField.setEditable(false);
    ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel");
    ownerIdLabel.setText("Owner ID:");
    ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField");
    ownerIdTextField.setEditable(false);

    int row = 0;

    unmodifiableAttributesPanel.add(objectKeyLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(objectKeyTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(objectContentLengthLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(objectContentLengthTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(objectLastModifiedLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(objectLastModifiedTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(objectETagLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(objectETagTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(ownerNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(ownerNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(ownerIdLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(ownerIdTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(bucketNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(bucketLocationTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Build metadata table.
    objectMetadataTableModel = new DefaultTableModel(new Object[] { "Name", "Value" }, 0) {
        private static final long serialVersionUID = -3762866886166776851L;

        public boolean isCellEditable(int row, int column) {
            return isModifyMode();
        }
    };

    metadataTableSorter = new TableSorter(objectMetadataTableModel);
    metadataTable = skinsFactory.createSkinnedJTable("MetadataTable");
    metadataTable.setModel(metadataTableSorter);
    metadataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting() && removeMetadataItemButton != null) {
                int row = metadataTable.getSelectedRow();
                removeMetadataItemButton.setEnabled(row >= 0);
            }
        }
    });

    metadataTableSorter.setTableHeader(metadataTable.getTableHeader());
    metadataTableSorter.setSortingStatus(0, TableSorter.ASCENDING);
    metadataContainer.add(new JScrollPane(metadataTable), new GridBagConstraints(0, 0, 1, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsHorizontalSpace, 0, 0));

    // Add/remove buttons for metadata table.
    removeMetadataItemButton = skinsFactory.createSkinnedJButton("ObjectPropertiesAddMetadataButton");
    removeMetadataItemButton.setEnabled(false);
    removeMetadataItemButton.setToolTipText("Remove the selected metadata item(s)");
    guiUtils.applyIcon(removeMetadataItemButton, "/images/nuvola/16x16/actions/viewmag-.png");
    removeMetadataItemButton.addActionListener(this);
    removeMetadataItemButton.setActionCommand("removeMetadataItem");
    addMetadataItemButton = skinsFactory.createSkinnedJButton("ObjectPropertiesAddMetadataButton");
    addMetadataItemButton.setToolTipText("Add a new metadata item");
    guiUtils.applyIcon(addMetadataItemButton, "/images/nuvola/16x16/actions/viewmag+.png");
    addMetadataItemButton.setActionCommand("addMetadataItem");
    addMetadataItemButton.addActionListener(this);
    metadataButtonsContainer.add(removeMetadataItemButton, new GridBagConstraints(0, 0, 1, 1, 0, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsZero, 0, 0));
    metadataButtonsContainer.add(addMetadataItemButton, new GridBagConstraints(1, 0, 1, 1, 0, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsZero, 0, 0));
    metadataContainer.add(metadataButtonsContainer, new GridBagConstraints(0, 1, 1, 1, 1, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsHorizontalSpace, 0, 0));
    metadataButtonsContainer.setVisible(false);

    // OK Button.
    okButton = skinsFactory.createSkinnedJButton("ObjectPropertiesOKButton");
    okButton.setText("OK");
    okButton.setActionCommand("OK");
    okButton.addActionListener(this);

    // Cancel Button.
    cancelButton = null;
    cancelButton = skinsFactory.createSkinnedJButton("ObjectPropertiesCancelButton");
    cancelButton.setText("Cancel");
    cancelButton.setActionCommand("Cancel");
    cancelButton.addActionListener(this);
    cancelButton.setVisible(false);

    // Recognize and handle ENTER, ESCAPE, PAGE_UP, and PAGE_DOWN key presses.
    this.getRootPane().setDefaultButton(okButton);
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"),
            "ESCAPE");
    this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() {
        private static final long serialVersionUID = -7768790936535999307L;

        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    });
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("PAGE_UP"),
            "PAGE_UP");
    this.getRootPane().getActionMap().put("PAGE_UP", new AbstractAction() {
        private static final long serialVersionUID = -6324229423705756219L;

        public void actionPerformed(ActionEvent actionEvent) {
            previousObjectButton.doClick();
        }
    });
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("PAGE_DOWN"),
            "PAGE_DOWN");
    this.getRootPane().getActionMap().put("PAGE_DOWN", new AbstractAction() {
        private static final long serialVersionUID = -5808972377672449421L;

        public void actionPerformed(ActionEvent actionEvent) {
            nextObjectButton.doClick();
        }
    });

    // Put it all together.
    row = 0;
    JPanel container = skinsFactory.createSkinnedJPanel("ObjectPropertiesPanel");
    container.setLayout(new GridBagLayout());
    container.add(unmodifiableAttributesPanel, new GridBagConstraints(0, row++, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    // Object previous and next buttons, if we have multiple objects.
    previousObjectButton = skinsFactory.createSkinnedJButton("ObjectPropertiesPreviousButton");
    guiUtils.applyIcon(previousObjectButton, "/images/nuvola/16x16/actions/1leftarrow.png");
    previousObjectButton.addActionListener(this);
    previousObjectButton.setEnabled(false);
    nextObjectButton = skinsFactory.createSkinnedJButton("ObjectPropertiesNextButton");
    guiUtils.applyIcon(nextObjectButton, "/images/nuvola/16x16/actions/1rightarrow.png");
    nextObjectButton.addActionListener(this);
    nextObjectButton.setEnabled(false);
    currentObjectLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectPropertiesCurrentObjectLabel");
    currentObjectLabel.setHorizontalAlignment(JLabel.CENTER);

    nextPreviousPanel = skinsFactory.createSkinnedJPanel("ObjectPropertiesNextPreviousPanel");
    nextPreviousPanel.setLayout(new GridBagLayout());
    nextPreviousPanel.add(previousObjectButton, new GridBagConstraints(0, 0, 1, 1, 1, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0));
    nextPreviousPanel.add(currentObjectLabel, new GridBagConstraints(1, 0, 1, 1, 0, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsHorizontalSpace, 0, 0));
    nextPreviousPanel.add(nextObjectButton, new GridBagConstraints(2, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsZero, 0, 0));
    container.add(nextPreviousPanel, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    nextPreviousPanel.setVisible(false);
    row++;

    JHtmlLabel metadataLabel = skinsFactory.createSkinnedJHtmlLabel("MetadataLabel");
    metadataLabel.setText("<html><b>Metadata Attributes</b></html>");
    metadataLabel.setHorizontalAlignment(JLabel.CENTER);
    container.add(metadataLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsVerticalSpace, 0, 0));
    container.add(metadataContainer, new GridBagConstraints(0, row++, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));

    // Destination Access Control List setting.
    destinationPanel = skinsFactory.createSkinnedJPanel("DestinationPanel");
    destinationPanel.setLayout(new GridBagLayout());

    JPanel actionButtonsPanel = skinsFactory.createSkinnedJPanel("ObjectPropertiesActionButtonsPanel");
    actionButtonsPanel.setLayout(new GridBagLayout());
    actionButtonsPanel.add(cancelButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    actionButtonsPanel.add(okButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    cancelButton.setVisible(false);

    container.add(actionButtonsPanel, new GridBagConstraints(0, row++, 3, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    this.getContentPane().add(container);

    this.pack();
    this.setSize(new Dimension(450, 500));
    this.setLocationRelativeTo(this.getOwner());
}

From source file:org.openmicroscopy.shoola.agents.dataBrowser.view.SearchPanel.java

/**
 * Builds the UI component hosting the time interval.
 * //from   www.j  av a2s. c o m
 * @return See above.
 */
private JPanel buildDate() {

    JPanel p = new JPanel();

    p.setBackground(UIUtilities.BACKGROUND_COLOR);

    p.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.WEST;
    c.fill = GridBagConstraints.HORIZONTAL;

    c.gridx = 0;
    c.gridy = 0;
    dateBox = new JComboBox();
    dateBox.setToolTipText(DATE_TYPE_TOOLTIP);
    dateBox.addItem(ITEM_IMPORTDATE);
    dateBox.addItem(ITEM_ACQUISITIONDATE);
    p.add(dateBox);

    c.gridy++;

    p.add(buildTimeRange(), c);

    UIUtilities.setBoldTitledBorder("Date", p);
    return p;
}

From source file:br.com.jinsync.view.FrmJInSync.java

/**
 * Initialize the contents of the frame.
 *//*ww w .  ja v a  2 s.  co m*/
private void initialize() {

    Language.loadParameters();

    setBounds(100, 100, 1136, 665);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 0, 0 };
    gridBagLayout.rowHeights = new int[] { 600, 53, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gridBagLayout.rowWeights = new double[] { 1.0, 0.0, 0.0, Double.MIN_VALUE };
    getContentPane().setLayout(gridBagLayout);

    grpFontes = new JTabbedPane(SwingConstants.TOP);
    GridBagConstraints gbc_grpFontes = new GridBagConstraints();
    gbc_grpFontes.insets = new Insets(0, 0, 5, 0);
    gbc_grpFontes.fill = GridBagConstraints.BOTH;
    gbc_grpFontes.gridx = 0;
    gbc_grpFontes.gridy = 0;
    getContentPane().add(grpFontes, gbc_grpFontes);

    tabCopybook = new JPanel();
    tabCopybook.setBackground(Color.WHITE);
    grpFontes.addTab(Language.tabCopy, null, tabCopybook, null);

    GridBagLayout gbl_tabCopybook = new GridBagLayout();
    gbl_tabCopybook.columnWidths = new int[] { 10, 1, 0, 349, 0, 0, 62, 28, 71, 0, 0, 0 };
    gbl_tabCopybook.rowHeights = new int[] { 1, 0, 0, 0 };
    gbl_tabCopybook.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            Double.MIN_VALUE };
    gbl_tabCopybook.rowWeights = new double[] { 0.0, 0.0, 1.0, Double.MIN_VALUE };
    tabCopybook.setLayout(gbl_tabCopybook);

    JLabel lblCopybook = new JLabel(Language.txtFilePds);
    GridBagConstraints gbc_lblCopybook = new GridBagConstraints();
    gbc_lblCopybook.anchor = GridBagConstraints.EAST;
    gbc_lblCopybook.insets = new Insets(0, 0, 5, 5);
    gbc_lblCopybook.gridx = 1;
    gbc_lblCopybook.gridy = 1;
    tabCopybook.add(lblCopybook, gbc_lblCopybook);

    txtPath = new JTextField();
    GridBagConstraints gbc_txtPath = new GridBagConstraints();
    gbc_txtPath.gridwidth = 4;
    gbc_txtPath.insets = new Insets(0, 0, 5, 5);
    gbc_txtPath.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtPath.gridx = 2;
    gbc_txtPath.gridy = 1;
    tabCopybook.add(txtPath, gbc_txtPath);
    txtPath.setColumns(10);

    JButton btnDiretorio = new JButton("");
    btnDiretorio.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/folder.png")));
    btnDiretorio.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            openDirectory();
        }
    });
    GridBagConstraints gbc_btnDiretorio = new GridBagConstraints();
    gbc_btnDiretorio.insets = new Insets(0, 0, 5, 5);
    gbc_btnDiretorio.gridx = 6;
    gbc_btnDiretorio.gridy = 1;
    tabCopybook.add(btnDiretorio, gbc_btnDiretorio);

    btnClearCopy = new JButton("");
    btnClearCopy.setEnabled(false);
    btnClearCopy.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            tableCopy = new JTable();
            scrCopy.setViewportView(tableCopy);
            tableString = new JTable();
            scrTableString.setViewportView(tableString);

            btnExcelString.setEnabled(false);
            btnClearString.setEnabled(false);
            textAreaString.setText("");

            console.removeAllElements();
            btnExcel.setEnabled(false);
            btnClearCopy.setEnabled(false);
            grpFontes.setEnabledAt(1, false);

            tableFile = new JTable();
            scrFile.setViewportView(tableFile);
            btnExcelFile.setEnabled(false);
            btnClearFile.setEnabled(false);
            grpFontes.setEnabledAt(2, false);

        }
    });
    btnClearCopy.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/cancel.png")));
    GridBagConstraints gbc_btnLimpar = new GridBagConstraints();
    gbc_btnLimpar.fill = GridBagConstraints.BOTH;
    gbc_btnLimpar.insets = new Insets(0, 0, 5, 5);
    gbc_btnLimpar.gridx = 9;
    gbc_btnLimpar.gridy = 1;
    tabCopybook.add(btnClearCopy, gbc_btnLimpar);

    JButton btnProcessarBook = new JButton("");
    btnProcessarBook.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            loadData();
            btnClearCopy.setEnabled(true);
            grpFontes.setEnabledAt(1, true);
            grpFontes.setEnabledAt(2, true);
        }
    });
    btnProcessarBook.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/engine.png")));
    GridBagConstraints gbc_btnProcessarBook = new GridBagConstraints();
    gbc_btnProcessarBook.fill = GridBagConstraints.VERTICAL;
    gbc_btnProcessarBook.insets = new Insets(0, 0, 5, 5);
    gbc_btnProcessarBook.gridx = 7;
    gbc_btnProcessarBook.gridy = 1;
    tabCopybook.add(btnProcessarBook, gbc_btnProcessarBook);

    btnExcel = new JButton("");
    btnExcel.setEnabled(false);
    btnExcel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            expExcelBook();
            // exportarExcelBook(tableCopy, txtPath.getText(),
            // "Horizontal");
        }
    });
    btnExcel.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/excel.png")));
    GridBagConstraints gbc_btnExcel = new GridBagConstraints();
    gbc_btnExcel.insets = new Insets(0, 0, 5, 5);
    gbc_btnExcel.gridx = 8;
    gbc_btnExcel.gridy = 1;
    tabCopybook.add(btnExcel, gbc_btnExcel);

    // JScrollPane scrCopy = new JScrollPane();
    gbc_scrCopy = new GridBagConstraints();
    gbc_scrCopy.gridwidth = 9;
    gbc_scrCopy.insets = new Insets(0, 0, 0, 5);
    gbc_scrCopy.fill = GridBagConstraints.BOTH;
    gbc_scrCopy.gridx = 1;
    gbc_scrCopy.gridy = 2;
    // tabCopybook.add(scrCopy, gbc_scrCopy);

    panelConsole = new Panel();
    GridBagConstraints gbc_panelConsole = new GridBagConstraints();
    gbc_panelConsole.insets = new Insets(0, 0, 5, 0);
    gbc_panelConsole.fill = GridBagConstraints.BOTH;
    gbc_panelConsole.gridx = 0;
    gbc_panelConsole.gridy = 1;
    getContentPane().add(panelConsole, gbc_panelConsole);
    panelConsole.setLayout(new BorderLayout(0, 0));

    listTerminal = new JList<String>();
    listTerminal.setFont(new Font("Courier New", Font.PLAIN, 11));
    listTerminal.setModel(console);

    scrConsole = new JScrollPane(listTerminal);
    panelConsole.add(scrConsole);

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu mnNewMenu = new JMenu(Language.menuParam);
    menuBar.add(mnNewMenu);

    JMenuItem mnItemUsuario = new JMenuItem(Language.menuParamUser);
    mnItemUsuario.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            FrmUser frmUsuar = new FrmUser();
            frmUsuar.setLocationRelativeTo(null);
            frmUsuar.setVisible(true);
            setUser();
        }
    });
    mnNewMenu.add(mnItemUsuario);

    JMenuItem mnItemFtp = new JMenuItem(Language.menuParamFtp);
    mnItemFtp.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            FrmFtp frmFtp = new FrmFtp();
            frmFtp.setLocationRelativeTo(null);
            frmFtp.setVisible(true);
            setFtp();
        }
    });

    mnNewMenu.add(mnItemFtp);

    JMenu mnAjuda = new JMenu(Language.menuHelp);
    menuBar.add(mnAjuda);

    JMenuItem mntmNewMenuItem = new JMenuItem(Language.menuHelpAbout);
    mntmNewMenuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            FrmAbout frmSobre = new FrmAbout();
            frmSobre.setLocationRelativeTo(null);
            frmSobre.setVisible(true);
        }
    });
    mnAjuda.add(mntmNewMenuItem);

    tabCopybook.setFont(new Font("Arial", Font.PLAIN, 12));
    tabCopybook.add(scrCopy, gbc_scrCopy);

    tabString = new JPanel();
    tabString.setFont(new Font("Arial", Font.PLAIN, 12));
    tabString.setBackground(Color.WHITE);
    grpFontes.addTab(Language.tabString, null, tabString, null);
    grpFontes.setEnabledAt(1, false);
    GridBagLayout gbl_tabString = new GridBagLayout();
    gbl_tabString.columnWidths = new int[] { 10, 1, 346, 349, 0, 0, 62, 28, 71, 0, 0, 0 };
    gbl_tabString.rowHeights = new int[] { 1, 0, 0, 17, 22, 0, 259, 0 };
    gbl_tabString.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            Double.MIN_VALUE };
    gbl_tabString.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE };
    tabString.setLayout(gbl_tabString);

    JLabel lblString = new JLabel("String:");
    GridBagConstraints gbc_lblString = new GridBagConstraints();
    gbc_lblString.anchor = GridBagConstraints.WEST;
    gbc_lblString.insets = new Insets(0, 0, 5, 5);
    gbc_lblString.gridx = 1;
    gbc_lblString.gridy = 1;
    tabString.add(lblString, gbc_lblString);

    textAreaString = new JTextArea();

    JScrollPane scrStringData = new JScrollPane(textAreaString);
    GridBagConstraints gbc_scrString = new GridBagConstraints();
    gbc_scrString.gridheight = 3;
    gbc_scrString.gridwidth = 8;
    gbc_scrString.insets = new Insets(0, 0, 5, 5);
    gbc_scrString.fill = GridBagConstraints.BOTH;
    gbc_scrString.gridx = 1;
    gbc_scrString.gridy = 2;
    tabString.add(scrStringData, gbc_scrString);

    btnClearString = new JButton("");
    btnClearString.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            scrTableString.setViewportView(tableString);
            btnExcelString.setEnabled(false);
            btnClearString.setEnabled(false);
            textAreaString.setText("");
            tableString = new JTable();
            scrTableString.setViewportView(tableString);
        }
    });

    btnExcelString = new JButton("");
    btnExcelString.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            expExcelString();
        }
    });

    JButton btnProcessarArq = new JButton("");
    btnProcessarArq.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            processString();
        }
    });
    btnProcessarArq.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/engine.png")));
    GridBagConstraints gbc_btnProcessarArq = new GridBagConstraints();
    gbc_btnProcessarArq.fill = GridBagConstraints.VERTICAL;
    gbc_btnProcessarArq.insets = new Insets(0, 0, 5, 5);
    gbc_btnProcessarArq.gridx = 9;
    gbc_btnProcessarArq.gridy = 2;
    tabString.add(btnProcessarArq, gbc_btnProcessarArq);
    btnExcelString.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/excel.png")));
    btnExcelString.setEnabled(false);
    GridBagConstraints gbc_btnExcelString = new GridBagConstraints();
    gbc_btnExcelString.fill = GridBagConstraints.VERTICAL;
    gbc_btnExcelString.insets = new Insets(0, 0, 5, 5);
    gbc_btnExcelString.gridx = 9;
    gbc_btnExcelString.gridy = 3;
    tabString.add(btnExcelString, gbc_btnExcelString);
    btnClearString.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/cancel.png")));
    btnClearString.setEnabled(false);
    GridBagConstraints gbc_btnClearString = new GridBagConstraints();
    gbc_btnClearString.fill = GridBagConstraints.VERTICAL;
    gbc_btnClearString.insets = new Insets(0, 0, 5, 5);
    gbc_btnClearString.gridx = 9;
    gbc_btnClearString.gridy = 4;
    tabString.add(btnClearString, gbc_btnClearString);

    JLabel lblSaida = new JLabel(Language.txtOutput);
    GridBagConstraints gbc_lblSaida = new GridBagConstraints();
    gbc_lblSaida.insets = new Insets(0, 0, 5, 5);
    gbc_lblSaida.gridx = 1;
    gbc_lblSaida.gridy = 5;
    tabString.add(lblSaida, gbc_lblSaida);

    GridBagConstraints gbc_scrArquivo = new GridBagConstraints();
    gbc_scrArquivo.fill = GridBagConstraints.BOTH;
    gbc_scrArquivo.gridwidth = 9;
    gbc_scrArquivo.insets = new Insets(0, 0, 0, 5);
    gbc_scrArquivo.gridx = 1;
    gbc_scrArquivo.gridy = 6;
    tabString.add(scrTableString, gbc_scrArquivo);

    tabFile = new JPanel();
    tabFile.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent e) {
            // TODO Auto-generated method stub
            if (isProcessStarted) {
                int key = e.getKeyCode();
                if (key == KeyEvent.VK_ESCAPE) {
                    int opc = JOptionPane.showConfirmDialog(null, Language.msgCancelProcess, Language.msgInf,
                            JOptionPane.OK_CANCEL_OPTION);
                    if (opc == JOptionPane.OK_OPTION) {
                        escProcessFile();
                    }
                }
            }

        }

        @Override
        public void keyReleased(KeyEvent arg0) {
            // TODO Auto-generated method stub

        }

        @Override
        public void keyTyped(KeyEvent arg0) {
            // TODO Auto-generated method stub

        }

    });

    tabFile.setFont(new Font("Arial", Font.PLAIN, 12));
    tabFile.setBackground(Color.WHITE);
    grpFontes.addTab(Language.tabFile, null, tabFile, null);
    grpFontes.setEnabledAt(2, false);
    GridBagLayout gbl_tabFile = new GridBagLayout();
    gbl_tabFile.columnWidths = new int[] { 10, 1, 49, 459, 0, 0, 62, 28, 0, 71, 0, 0, 0, 0 };
    gbl_tabFile.rowHeights = new int[] { 1, 0, 0, 17, 22, 0, 259, 0, 0 };
    gbl_tabFile.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            Double.MIN_VALUE };
    gbl_tabFile.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE };
    tabFile.setLayout(gbl_tabFile);

    JLabel lblFile = new JLabel(Language.txtFilePds);
    GridBagConstraints gbc_lblFile = new GridBagConstraints();
    gbc_lblFile.anchor = GridBagConstraints.EAST;
    gbc_lblFile.insets = new Insets(0, 0, 5, 5);
    gbc_lblFile.gridx = 1;
    gbc_lblFile.gridy = 1;
    tabFile.add(lblFile, gbc_lblFile);

    txtFile = new JTextField();
    txtFile.setColumns(10);
    GridBagConstraints gbc_txtFile = new GridBagConstraints();
    gbc_txtFile.gridwidth = 5;
    gbc_txtFile.insets = new Insets(0, 0, 5, 5);
    gbc_txtFile.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtFile.gridx = 2;
    gbc_txtFile.gridy = 1;
    tabFile.add(txtFile, gbc_txtFile);

    btnClearFile = new JButton("");
    btnClearFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {

            tableFile = new JTable();
            scrFile.setViewportView(tableFile);
            btnExcelFile.setEnabled(false);
            btnClearFile.setEnabled(false);
            progressBar.setStringPainted(true);
            progressBar.setValue(0);
            progressBar.setString("");

        }
    });

    btnExcelFile = new JButton("");
    btnExcelFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            expExcelFile();
        }
    });

    btnProcFile = new JButton("");
    btnProcFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            loadFile();
        }
    });

    btnDirFile = new JButton("");
    btnDirFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            openDirFile();
        }
    });
    btnDirFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/folder.png")));
    GridBagConstraints gbc_btnDirFile = new GridBagConstraints();
    gbc_btnDirFile.fill = GridBagConstraints.VERTICAL;
    gbc_btnDirFile.insets = new Insets(0, 0, 5, 5);
    gbc_btnDirFile.gridx = 7;
    gbc_btnDirFile.gridy = 1;
    tabFile.add(btnDirFile, gbc_btnDirFile);
    btnProcFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/engine.png")));
    GridBagConstraints gbc_btnProcFile = new GridBagConstraints();
    gbc_btnProcFile.fill = GridBagConstraints.VERTICAL;
    gbc_btnProcFile.insets = new Insets(0, 0, 5, 5);
    gbc_btnProcFile.gridx = 8;
    gbc_btnProcFile.gridy = 1;
    tabFile.add(btnProcFile, gbc_btnProcFile);
    btnExcelFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/excel.png")));
    btnExcelFile.setEnabled(false);
    GridBagConstraints gbc_btnExcelFile = new GridBagConstraints();
    gbc_btnExcelFile.insets = new Insets(0, 0, 5, 5);
    gbc_btnExcelFile.gridx = 9;
    gbc_btnExcelFile.gridy = 1;
    tabFile.add(btnExcelFile, gbc_btnExcelFile);
    btnClearFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/cancel.png")));
    btnClearFile.setEnabled(false);
    GridBagConstraints gbc_btnLimparFile = new GridBagConstraints();
    gbc_btnLimparFile.fill = GridBagConstraints.VERTICAL;
    gbc_btnLimparFile.insets = new Insets(0, 0, 5, 5);
    gbc_btnLimparFile.gridx = 10;
    gbc_btnLimparFile.gridy = 1;
    tabFile.add(btnClearFile, gbc_btnLimparFile);

    JLabel lblTamanho = new JLabel(Language.txtFileLength);
    GridBagConstraints gbc_lblTamanho = new GridBagConstraints();
    gbc_lblTamanho.anchor = GridBagConstraints.WEST;
    gbc_lblTamanho.insets = new Insets(0, 0, 5, 5);
    gbc_lblTamanho.gridx = 1;
    gbc_lblTamanho.gridy = 2;
    tabFile.add(lblTamanho, gbc_lblTamanho);

    txtLength = new JTextField();
    GridBagConstraints gbc_txtTamanho = new GridBagConstraints();
    gbc_txtTamanho.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtTamanho.insets = new Insets(0, 0, 5, 5);
    gbc_txtTamanho.gridx = 2;
    gbc_txtTamanho.gridy = 2;
    tabFile.add(txtLength, gbc_txtTamanho);
    txtLength.setColumns(10);

    JLabel label_1 = new JLabel(Language.txtOutput);
    GridBagConstraints gbc_label_1 = new GridBagConstraints();
    gbc_label_1.anchor = GridBagConstraints.WEST;
    gbc_label_1.insets = new Insets(0, 0, 5, 5);
    gbc_label_1.gridx = 1;
    gbc_label_1.gridy = 3;
    tabFile.add(label_1, gbc_label_1);

    GridBagConstraints gbc_scrFile = new GridBagConstraints();
    gbc_scrFile.gridheight = 3;
    gbc_scrFile.fill = GridBagConstraints.BOTH;
    gbc_scrFile.gridwidth = 10;
    gbc_scrFile.insets = new Insets(0, 0, 5, 5);
    gbc_scrFile.gridx = 1;
    gbc_scrFile.gridy = 4;
    tabFile.add(scrFile, gbc_scrFile);

    progressBar = new JProgressBar();
    GridBagConstraints gbc_progressBar = new GridBagConstraints();
    gbc_progressBar.fill = GridBagConstraints.HORIZONTAL;
    gbc_progressBar.gridwidth = 10;
    gbc_progressBar.insets = new Insets(0, 0, 0, 5);
    gbc_progressBar.gridx = 1;
    gbc_progressBar.gridy = 7;
    tabFile.add(progressBar, gbc_progressBar);

    JLabel lblNewLabel = new JLabel(Language.txtDeveloped + " Rodrigo Augusto Silva dos Santos - 2016");
    GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
    gbc_lblNewLabel.gridx = 0;
    gbc_lblNewLabel.gridy = 2;
    getContentPane().add(lblNewLabel, gbc_lblNewLabel);

    loadParameters();

}

From source file:com.sec.ose.osi.ui.frm.main.identification.stringmatch.JPanStringMatchMain.java

/**
 * This method initializes jPanel3   //  w  w  w .  j av a  2  s.com
 *    
 * @return javax.swing.JPanel   
 */
public JPanel getJPanelRepreLicenFolder() {
    if (jPanelRepreLicenFolder == null) {
        GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
        gridBagConstraints6.anchor = GridBagConstraints.WEST;
        gridBagConstraints6.insets = new Insets(0, 0, 0, 0);
        gridBagConstraints6.gridx = -1;
        gridBagConstraints6.gridy = -1;
        gridBagConstraints6.weightx = 0.0;
        gridBagConstraints6.fill = GridBagConstraints.VERTICAL;
        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.anchor = GridBagConstraints.EAST;
        gridBagConstraints3.insets = new Insets(0, 0, 0, 3);
        gridBagConstraints3.gridx = -1;
        gridBagConstraints3.gridy = -1;
        gridBagConstraints3.weightx = 0.0;
        gridBagConstraints3.fill = GridBagConstraints.NONE;
        jPanelRepreLicenFolder = new JPanel();
        jPanelRepreLicenFolder.setLayout(new GridBagLayout());
        jPanelRepreLicenFolder.setPreferredSize(new Dimension(489, 33));
        jPanelRepreLicenFolder.add(jLabelRepresentativeLicenseForOpt2, gridBagConstraints3);
        jPanelRepreLicenFolder.add(getJComboLicenseNameForOpt2(), gridBagConstraints6);
    }
    return jPanelRepreLicenFolder;
}

From source file:org.openmicroscopy.shoola.agents.dataBrowser.view.SearchPanel.java

/** Builds and lays out the UI. */
private void buildGUI() {
    setBorder(null);/*from   w  ww.jav a  2  s . c  o  m*/
    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 2, 2, 0);
    c.gridy = 0;
    c.gridx = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0;
    setBackground(UIUtilities.BACKGROUND_COLOR);

    add(buildSearchFor(), c);// , "0, 0");

    SeparatorPane sep = new SeparatorPane();
    sep.setBackground(UIUtilities.BACKGROUND_COLOR);
    c.gridy++;
    add(sep, c);// , "0, 1");

    JPanel typePanel = buildType();
    c.gridy++;
    add(typePanel, c);// , "0, 2")

    JPanel fieldsPanel = buildFields();
    c.gridy++;
    add(fieldsPanel, c);// , "0, 2");

    JPanel scopePanel = buildScope();
    c.gridy++;
    add(scopePanel, c);// , "0, 2");

    JPanel datePanel = buildDate();
    c.gridy++;
    add(datePanel, c);// , "0, 4");

    updateUsersBox();
}

From source file:es.emergya.ui.gis.popups.ConsultaHistoricos.java

private JPanel getIntervalo() {
    JPanel intervalo = new JPanel(new GridBagLayout());
    intervalo.setOpaque(false);//from  www  . j a v a2s.  c  o  m
    intervalo.setBorder(new TitledBorder("Intervalo Temporal de Consulta"));

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;

    intervalo.add(new JLabel("Fecha/Hora Inicial"), gbc);
    gbc.gridx++;
    calendarini = new JCalendarCombo();
    calendarini.addActionListener(actionListener);
    calendarini.addDateListener(dateListener);
    intervalo.add(calendarini, gbc);
    gbc.gridx++;
    final Calendar instance = Calendar.getInstance();
    instance.set(Calendar.HOUR, 0);
    instance.set(Calendar.MINUTE, 0);
    instance.set(Calendar.SECOND, 0);
    horaini = initializeSpinner(instance);
    intervalo.add(horaini, gbc);

    gbc.gridx = 0;
    gbc.gridy++;

    intervalo.add(new JLabel("Fecha/Hora Final"), gbc);
    gbc.gridx++;
    calendarfin = new JCalendarCombo();
    calendarfin.addActionListener(actionListener);
    calendarfin.addDateListener(dateListener);
    intervalo.add(calendarfin, gbc);
    gbc.gridx++;
    horafin = initializeSpinner(instance);
    intervalo.add(horafin, gbc);

    gbc.gridx = 0;
    gbc.gridy++;
    gbc.anchor = GridBagConstraints.EAST;
    soloUltimas = new JCheckBox();
    soloUltimas.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            updateRecursos();
        }
    });
    soloUltimas.setOpaque(false);
    soloUltimas.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            boolean enabled = !soloUltimas.isSelected();
            calendarini.setEnabled(enabled);
            calendarfin.setEnabled(enabled);
            horaini.setEnabled(enabled);
            horafin.setEnabled(enabled);
        }
    });
    intervalo.add(soloUltimas, gbc);
    gbc.gridx++;
    gbc.anchor = GridBagConstraints.WEST;
    intervalo.add(new JLabel("Consultar Slo Las ltimas Posiciones"), gbc);

    return intervalo;
}

From source file:org.jets3t.apps.cockpit.Cockpit.java

/**
 * Initialises the application's GUI elements.
 *///  w  ww. jav  a2s  .  c  o  m
private void initGui() {
    initMenus();

    JPanel appContent = new JPanel(new GridBagLayout());
    this.getContentPane().add(appContent);

    // Buckets panel.
    JPanel bucketsPanel = new JPanel(new GridBagLayout());

    JButton bucketActionButton = new JButton();
    bucketActionButton.setToolTipText("Bucket actions menu");
    guiUtils.applyIcon(bucketActionButton, "/images/nuvola/16x16/actions/misc.png");
    bucketActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            bucketActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    bucketsPanel.add(new JHtmlLabel("<html><b>Buckets</b></html>", this), new GridBagConstraints(0, 0, 1, 1, 1,
            0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    bucketsPanel.add(bucketActionButton, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    bucketTableModel = new BucketTableModel(false);
    bucketTableModelSorter = new TableSorter(bucketTableModel);
    bucketsTable = new JTable(bucketTableModelSorter);
    bucketTableModelSorter.setTableHeader(bucketsTable.getTableHeader());
    bucketsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    bucketsTable.getSelectionModel().addListSelectionListener(this);
    bucketsTable.setShowHorizontalLines(true);
    bucketsTable.setShowVerticalLines(false);
    bucketsTable.addMouseListener(new ContextMenuListener());
    bucketsPanel.add(new JScrollPane(bucketsTable), new GridBagConstraints(0, 1, 2, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0));
    bucketsPanel.add(new JLabel(" "), new GridBagConstraints(0, 2, 2, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Filter panel.
    filterObjectsPanel = new JPanel(new GridBagLayout());
    filterObjectsPrefix = new JTextField();
    filterObjectsPrefix.setToolTipText("Only show objects with this prefix");
    filterObjectsPrefix.addActionListener(this);
    filterObjectsPrefix.setActionCommand("RefreshObjects");
    filterObjectsDelimiter = new JComboBox(new String[] { "", "/", "?", "\\" });
    filterObjectsDelimiter.setEditable(true);
    filterObjectsDelimiter.setToolTipText("Object name delimiter");
    filterObjectsDelimiter.addActionListener(this);
    filterObjectsDelimiter.setActionCommand("RefreshObjects");
    filterObjectsPanel.add(new JHtmlLabel("Prefix:", this), new GridBagConstraints(0, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.add(filterObjectsPrefix, new GridBagConstraints(1, 0, 1, 1, 1, 0,
            GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    filterObjectsPanel.add(new JHtmlLabel("Delimiter:", this), new GridBagConstraints(2, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    filterObjectsPanel.add(filterObjectsDelimiter, new GridBagConstraints(3, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.setVisible(false);

    // Objects panel.
    JPanel objectsPanel = new JPanel(new GridBagLayout());
    int row = 0;
    filterObjectsCheckBox = new JCheckBox("Filter objects");
    filterObjectsCheckBox.addActionListener(this);
    filterObjectsCheckBox.setToolTipText("Check this option to filter the objects listed");
    objectsPanel.add(new JHtmlLabel("<html><b>Objects</b></html>", this), new GridBagConstraints(0, row, 1, 1,
            1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    objectsPanel.add(filterObjectsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    JButton objectActionButton = new JButton();
    objectActionButton.setToolTipText("Object actions menu");
    guiUtils.applyIcon(objectActionButton, "/images/nuvola/16x16/actions/misc.png");
    objectActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            objectActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    objectsPanel.add(objectActionButton, new GridBagConstraints(2, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsPanel.add(filterObjectsPanel, new GridBagConstraints(0, ++row, 3, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsTable = new JTable();
    objectTableModel = new ObjectTableModel();
    objectTableModelSorter = new TableSorter(objectTableModel);
    objectTableModelSorter.setTableHeader(objectsTable.getTableHeader());
    objectsTable.setModel(objectTableModelSorter);
    objectsTable.setDefaultRenderer(Long.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 301092191828910402L;

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            String formattedSize = byteFormatter.formatByteSize(((Long) value).longValue());
            return super.getTableCellRendererComponent(table, formattedSize, isSelected, hasFocus, row, column);
        }
    });
    objectsTable.setDefaultRenderer(Date.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 7285511556343895652L;

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            Date date = (Date) value;
            return super.getTableCellRendererComponent(table, yearAndTimeSDF.format(date), isSelected, hasFocus,
                    row, column);
        }
    });
    objectsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    objectsTable.getSelectionModel().addListSelectionListener(this);
    objectsTable.setShowHorizontalLines(true);
    objectsTable.setShowVerticalLines(true);
    objectsTable.addMouseListener(new ContextMenuListener());
    objectsTableSP = new JScrollPane(objectsTable);
    objectsPanel.add(objectsTableSP, new GridBagConstraints(0, ++row, 3, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));
    objectsSummaryLabel = new JHtmlLabel("Please select a bucket", this);
    objectsSummaryLabel.setHorizontalAlignment(JLabel.CENTER);
    objectsSummaryLabel.setFocusable(false);
    objectsPanel.add(objectsSummaryLabel, new GridBagConstraints(0, ++row, 3, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Combine sections.
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bucketsPanel, objectsPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setContinuousLayout(true);

    appContent.add(splitPane, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));

    // Set preferred sizes
    int preferredWidth = 800;
    int preferredHeight = 600;
    this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight)));

    splitPane.setResizeWeight(0.30);

    // Initialize drop target.
    initDropTarget(new JComponent[] { objectsTableSP, objectsTable });
    objectsTable.getDropTarget().setActive(false);
    objectsTableSP.getDropTarget().setActive(false);
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

private void addSelectedArtifactLineItem() {
    final String tipInfo = "The Artifact you want to use.";
    JLabel artifactSelectLabel = new JLabel("Select an Artifact to submit");
    artifactSelectLabel.setToolTipText(tipInfo);

    selectedArtifactComboBox = new ComboBox();
    selectedArtifactComboBox.setToolTipText(tipInfo);

    errorMessageLabels[ErrorMessageLabelTag.SystemArtifact.ordinal()] = new JLabel(
            "Artifact should not be null!");
    errorMessageLabels[ErrorMessageLabelTag.SystemArtifact.ordinal()]
            .setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    errorMessageLabels[ErrorMessageLabelTag.SystemArtifact.ordinal()].setVisible(false);

    errorMessageLabels[ErrorMessageLabelTag.LocalArtifact.ordinal()] = new JLabel(
            "Could not find the local jar package for Artifact");
    errorMessageLabels[ErrorMessageLabelTag.LocalArtifact.ordinal()]
            .setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    errorMessageLabels[ErrorMessageLabelTag.LocalArtifact.ordinal()].setVisible(false);

    selectedArtifactTextField = new TextFieldWithBrowseButton();
    selectedArtifactTextField.setToolTipText("Artifact from local jar package.");
    selectedArtifactTextField.setEditable(true);
    selectedArtifactTextField.setEnabled(false);
    selectedArtifactTextField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
        @Override//  w w  w. j  a  v a 2s. c  om
        public void insertUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(2,
                    !SparkSubmitHelper.isLocalArtifactPath(selectedArtifactTextField.getText()));
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(2,
                    !SparkSubmitHelper.isLocalArtifactPath(selectedArtifactTextField.getText()));
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(2,
                    !SparkSubmitHelper.isLocalArtifactPath(selectedArtifactTextField.getText()));
        }
    });

    selectedArtifactTextField.getButton().addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            FileChooserDescriptor chooserDescriptor = new FileChooserDescriptor(false, false, true, false, true,
                    false);
            chooserDescriptor.setTitle("Select Local Artifact File");
            VirtualFile chooseFile = FileChooser.chooseFile(chooserDescriptor, null, null);
            if (chooseFile != null) {
                String path = chooseFile.getPath();
                if (path.endsWith("!/")) {
                    path = path.substring(0, path.length() - 2);
                }
                selectedArtifactTextField.setText(path);
            }
        }
    });

    intelliJArtifactRadioButton = new JRadioButton("Artifact from IntelliJ project:", true);
    localArtifactRadioButton = new JRadioButton("Artifact from local disk:", false);

    intelliJArtifactRadioButton.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                selectedArtifactComboBox.setEnabled(true);
                selectedArtifactTextField.setEnabled(false);
                mainClassTextField.setButtonEnabled(true);

                setVisibleForFixedErrorMessageLabel(2, false);

                if (selectedArtifactComboBox.getItemCount() == 0) {
                    setVisibleForFixedErrorMessageLabel(2, true);
                }
            }
        }
    });

    localArtifactRadioButton.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                selectedArtifactComboBox.setEnabled(false);
                selectedArtifactTextField.setEnabled(true);
                mainClassTextField.setButtonEnabled(false);

                setVisibleForFixedErrorMessageLabel(1, false);

                if (StringHelper.isNullOrWhiteSpace(selectedArtifactTextField.getText())) {
                    setVisibleForFixedErrorMessageLabel(2, true);
                }
            }
        }
    });

    ButtonGroup group = new ButtonGroup();
    group.add(intelliJArtifactRadioButton);
    group.add(localArtifactRadioButton);

    intelliJArtifactRadioButton.setSelected(true);

    add(artifactSelectLabel, new GridBagConstraints(0, ++displayLayoutCurrentRow, 0, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, margin), 0, 0));

    add(intelliJArtifactRadioButton,
            new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 0, 0, GridBagConstraints.WEST,
                    GridBagConstraints.NONE, new Insets(margin / 3, margin * 3, 0, margin), 0, 0));

    add(selectedArtifactComboBox,
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin / 3, margin, 0, margin), 0, 0));

    add(errorMessageLabels[ErrorMessageLabelTag.SystemArtifact.ordinal()],
            new GridBagConstraints(1, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.NONE, new Insets(0, margin, 0, 0), 0, 0));

    add(localArtifactRadioButton,
            new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 0, 0, GridBagConstraints.WEST,
                    GridBagConstraints.NONE, new Insets(margin / 3, margin * 3, 0, margin), 0, 0));

    add(selectedArtifactTextField,
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 0, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin / 3, margin, 0, margin), 0, 0));
    add(errorMessageLabels[ErrorMessageLabelTag.LocalArtifact.ordinal()],
            new GridBagConstraints(1, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.NONE, new Insets(0, margin, 0, 0), 0, 0));
}

From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java

/**
 * @return//w  w  w .j  a v  a  2s .c  o m
 */
private JPanel createGradientConfigurationPanel() {

    // create gradient config panel
    JPanel gradientConfigPanel = new JPanel(new GridBagLayout());
    gradientConfigPanel.setPreferredSize(new Dimension(100, 50));

    GridBagConstraints itemConstraint;

    // add gradient label
    {
        JLabel gradientLabel = new ResourceLabel(
                "plotter.configuration_dialog.color_scheme_dialog.gradient_preview");

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1;
        itemConstraint.weighty = 1;
        itemConstraint.fill = GridBagConstraints.BOTH;
        itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
        itemConstraint.insets = new Insets(2, 2, 2, 2);

        gradientConfigPanel.add(gradientLabel, itemConstraint);
    }

    // add combobox panel
    {
        JPanel comboBoxPanel = new JPanel(new GridBagLayout());

        // gradient start panel
        {

            JPanel startGradientPanel = createStartGradientPanel();

            itemConstraint = new GridBagConstraints();
            itemConstraint.weightx = 1.0;
            itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
            itemConstraint.anchor = GridBagConstraints.WEST;
            itemConstraint.fill = GridBagConstraints.HORIZONTAL;

            comboBoxPanel.add(startGradientPanel, itemConstraint);

        }

        // gradient end panel
        {

            JPanel endGradientPanel = createEndGradientPanel();

            itemConstraint = new GridBagConstraints();
            itemConstraint.weightx = 1.0;
            itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
            itemConstraint.anchor = GridBagConstraints.EAST;
            itemConstraint.fill = GridBagConstraints.HORIZONTAL;

            comboBoxPanel.add(endGradientPanel, itemConstraint);

        }

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1;
        itemConstraint.weighty = 0.0;
        itemConstraint.fill = GridBagConstraints.HORIZONTAL;
        itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
        itemConstraint.insets = new Insets(2, 2, 2, 2);

        gradientConfigPanel.add(comboBoxPanel, itemConstraint);
    }

    // add 0.0 label
    {
        JLabel zeroLabel = new JLabel("0");

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 0;
        itemConstraint.weighty = 0;
        itemConstraint.fill = GridBagConstraints.NONE;
        itemConstraint.insets = new Insets(2, 2, 2, 2);

        gradientConfigPanel.add(zeroLabel, itemConstraint);
    }

    // add gradient preview
    {
        preview = new GradientPreview(null);

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1;
        itemConstraint.weighty = 1;
        itemConstraint.fill = GridBagConstraints.BOTH;
        itemConstraint.insets = new Insets(2, 2, 2, 2);

        gradientConfigPanel.add(preview, itemConstraint);

    }

    // add 1.0 label
    {
        JLabel zeroLabel = new JLabel("1");

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 0;
        itemConstraint.weighty = 0;
        itemConstraint.fill = GridBagConstraints.NONE;
        itemConstraint.insets = new Insets(2, 2, 2, 2);
        itemConstraint.gridwidth = GridBagConstraints.REMAINDER;

        gradientConfigPanel.add(zeroLabel, itemConstraint);
    }

    return gradientConfigPanel;
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.s3.Cockpit.java

/**
 * Initialises the application's GUI elements.
 *///  w  w w  .  j a v a2  s .  c o m
private void initGui() {
    initMenus();

    JPanel appContent = new JPanel(new GridBagLayout());
    this.getContentPane().add(appContent);

    // Buckets panel.
    JPanel bucketsPanel = new JPanel(new GridBagLayout());

    JButton bucketActionButton = new JButton();
    bucketActionButton.setToolTipText("Bucket actions menu");
    guiUtils.applyIcon(bucketActionButton, "/images/nuvola/16x16/actions/misc.png");
    bucketActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            bucketActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    bucketsPanel.add(new JHtmlLabel("<html><b>Buckets</b></html>", this), new GridBagConstraints(0, 0, 1, 1, 1,
            0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    bucketsPanel.add(bucketActionButton, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    bucketTableModel = new BucketTableModel(false);
    bucketTableModelSorter = new TableSorter(bucketTableModel);
    bucketsTable = new JTable(bucketTableModelSorter);
    bucketTableModelSorter.setTableHeader(bucketsTable.getTableHeader());
    bucketsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    bucketsTable.getSelectionModel().addListSelectionListener(this);
    bucketsTable.setShowHorizontalLines(true);
    bucketsTable.setShowVerticalLines(false);
    bucketsTable.addMouseListener(new ContextMenuListener());
    bucketsPanel.add(new JScrollPane(bucketsTable), new GridBagConstraints(0, 1, 2, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0));
    bucketsPanel.add(new JLabel(" "), new GridBagConstraints(0, 2, 2, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Filter panel.
    filterObjectsPanel = new JPanel(new GridBagLayout());
    filterObjectsPrefix = new JTextField();
    filterObjectsPrefix.setToolTipText("Only show objects with this prefix");
    filterObjectsPrefix.addActionListener(this);
    filterObjectsPrefix.setActionCommand("RefreshObjects");
    filterObjectsDelimiter = new JComboBox(new String[] { "", "/", "?", "\\" });
    filterObjectsDelimiter.setEditable(true);
    filterObjectsDelimiter.setToolTipText("Object name delimiter");
    filterObjectsDelimiter.addActionListener(this);
    filterObjectsDelimiter.setActionCommand("RefreshObjects");
    filterObjectsPanel.add(new JHtmlLabel("Prefix:", this), new GridBagConstraints(0, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.add(filterObjectsPrefix, new GridBagConstraints(1, 0, 1, 1, 1, 0,
            GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    filterObjectsPanel.add(new JHtmlLabel("Delimiter:", this), new GridBagConstraints(2, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    filterObjectsPanel.add(filterObjectsDelimiter, new GridBagConstraints(3, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.setVisible(false);

    // Objects panel.
    JPanel objectsPanel = new JPanel(new GridBagLayout());
    int row = 0;
    filterObjectsCheckBox = new JCheckBox("Filter objects");
    filterObjectsCheckBox.addActionListener(this);
    filterObjectsCheckBox.setToolTipText("Check this option to filter the objects listed");
    objectsPanel.add(new JHtmlLabel("<html><b>Objects</b></html>", this), new GridBagConstraints(0, row, 1, 1,
            1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    objectsPanel.add(filterObjectsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    JButton objectActionButton = new JButton();
    objectActionButton.setToolTipText("Object actions menu");
    guiUtils.applyIcon(objectActionButton, "/images/nuvola/16x16/actions/misc.png");
    objectActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            objectActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    objectsPanel.add(objectActionButton, new GridBagConstraints(2, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsPanel.add(filterObjectsPanel, new GridBagConstraints(0, ++row, 3, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsTable = new JTable();
    objectTableModel = new ObjectTableModel();
    objectTableModelSorter = new TableSorter(objectTableModel);
    objectTableModelSorter.setTableHeader(objectsTable.getTableHeader());
    objectsTable.setModel(objectTableModelSorter);
    objectsTable.setDefaultRenderer(Long.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 301092191828910402L;

        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            String formattedSize = byteFormatter.formatByteSize(((Long) value).longValue());
            return super.getTableCellRendererComponent(table, formattedSize, isSelected, hasFocus, row, column);
        }
    });
    objectsTable.setDefaultRenderer(Date.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 7285511556343895652L;

        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            Date date = (Date) value;
            return super.getTableCellRendererComponent(table, yearAndTimeSDF.format(date), isSelected, hasFocus,
                    row, column);
        }
    });
    objectsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    objectsTable.getSelectionModel().addListSelectionListener(this);
    objectsTable.setShowHorizontalLines(true);
    objectsTable.setShowVerticalLines(true);
    objectsTable.addMouseListener(new ContextMenuListener());
    objectsTableSP = new JScrollPane(objectsTable);
    objectsPanel.add(objectsTableSP, new GridBagConstraints(0, ++row, 3, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));
    objectsSummaryLabel = new JHtmlLabel("Please select a bucket", this);
    objectsSummaryLabel.setHorizontalAlignment(JLabel.CENTER);
    objectsSummaryLabel.setFocusable(false);
    objectsPanel.add(objectsSummaryLabel, new GridBagConstraints(0, ++row, 3, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Combine sections.
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bucketsPanel, objectsPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setContinuousLayout(true);

    appContent.add(splitPane, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));

    // Set preferred sizes
    int preferredWidth = 800;
    int preferredHeight = 600;
    this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight)));

    splitPane.setResizeWeight(0.30);

    // Initialize drop target.
    initDropTarget(new JComponent[] { objectsTableSP, objectsTable });
    objectsTable.getDropTarget().setActive(false);
    objectsTableSP.getDropTarget().setActive(false);
}