Search in sources :

Example 21 with BoxLayout

use of javax.swing.BoxLayout in project ACS by ACS-Community.

the class Toolbar method initialize.

/**
	 * Initialize the toolbar
	 * 
	 * @param <code>true</code> if the reduction rules are applied at startup
	 */
private void initialize(boolean reduce) {
    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
    // Add the button to inhibit sounds
    add(soundComponent);
    // Add the label and the combobox for auto ack
    Font fnt = autoAckLbl.getFont();
    Font newFont = fnt.deriveFont(fnt.getSize() * 80 / 100);
    autoAckLbl.setFont(newFont);
    add(Box.createHorizontalStrut(2));
    add(autoAckLbl);
    autoAckLevelCB.setFont(newFont);
    autoAckLevelCB.setEditable(false);
    autoAckLevelCB.setOpaque(true);
    // Set the colors of the renderers
    ComboBoxValues.initSizes();
    autoAckLevelCB.setRenderer(new ComboBoxRenderer());
    autoAckLevelCB.setSelectedIndex(ComboBoxValues.NONE.ordinal());
    autoAckLevelCB.setMaximumRowCount(ComboBoxValues.values().length);
    autoAckLevelCB.setEditable(false);
    autoAckLevelCB.addActionListener(this);
    Dimension d = new Dimension(ComboBoxValues.getWidth(), ComboBoxValues.getHeight());
    autoAckLevelCB.setMinimumSize(d);
    add(Box.createHorizontalStrut(5));
    add(autoAckLevelCB);
    activeReductionIcon = new ImageIcon(this.getClass().getResource("/alma/acsplugins/alarmsystem/gui/resources/arrow_in.png"));
    inactiveReductionIcon = new ImageIcon(this.getClass().getResource("/alma/acsplugins/alarmsystem/gui/resources/arrow_out.png"));
    reductionRulesBtn = new JToggleButton("Reduce", activeReductionIcon, reduce);
    reductionRulesBtn.setFont(newFont);
    add(Box.createHorizontalStrut(5));
    add(reductionRulesBtn);
    reductionRulesBtn.addActionListener(this);
    add(Box.createHorizontalStrut(5));
    add(pauseBtn);
    pauseBtn.addActionListener(this);
    pauseBtn.setFont(newFont);
    add(Box.createHorizontalStrut(5));
    add(new JSeparator(JSeparator.VERTICAL));
    add(Box.createHorizontalStrut(5));
    JLabel searchLbl = new JLabel("Search");
    add(searchLbl);
    searchLbl.setFont(newFont);
    add(Box.createHorizontalStrut(5));
    add(searchTF);
    searchTF.setEditable(true);
    searchTF.getDocument().addDocumentListener(this);
    searchTF.setToolTipText("Search");
    add(Box.createHorizontalStrut(3));
    add(prevSearchBtn);
    prevSearchBtn.setToolTipText("Search prev");
    prevSearchBtn.addActionListener(this);
    add(Box.createHorizontalStrut(3));
    add(nextSearchBtn);
    nextSearchBtn.setToolTipText("Search next");
    nextSearchBtn.addActionListener(this);
    add(Box.createHorizontalStrut(3));
    add(showBtn);
    showBtn.setFont(newFont);
    showBtn.setToolTipText("Filter in");
    showBtn.addActionListener(this);
    add(Box.createHorizontalStrut(3));
    add(hideBtn);
    hideBtn.setFont(newFont);
    hideBtn.setToolTipText("Filter out");
    hideBtn.addActionListener(this);
    add(Box.createHorizontalStrut(2));
    ratioSearchBtns();
}
Also used : ImageIcon(javax.swing.ImageIcon) JToggleButton(javax.swing.JToggleButton) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Font(java.awt.Font) JSeparator(javax.swing.JSeparator)

Example 22 with BoxLayout

use of javax.swing.BoxLayout in project ACS by ACS-Community.

the class ExpertPrefsDlg method initGUI.

/**
	 * Builds the GUI
	 *
	 */
private void initGUI() {
    JRootPane mainPnl = this.getRootPane();
    mainPnl.setLayout(new BorderLayout());
    /////////////////////////////////////////////////////////////
    // Add the table constraints (max num of logs and time frame)
    ///////////////////////////////////////////////////////////
    JPanel tablePnl = new JPanel();
    tablePnl.setBorder(BorderFactory.createTitledBorder("Table constraints"));
    tablePnl.setLayout(new GridBagLayout());
    GridBagConstraints constr = new GridBagConstraints();
    // Num of logs
    constr.gridx = 0;
    constr.gridy = 0;
    constr.fill = GridBagConstraints.HORIZONTAL;
    constr.anchor = GridBagConstraints.WEST;
    constr.insets = new Insets(5, 5, 5, 5);
    tablePnl.add(OptionWidgets.MAX_NUM_OF_LOGS.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 0;
    constr.anchor = GridBagConstraints.LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    constr.fill = GridBagConstraints.HORIZONTAL;
    tablePnl.add(maxLogsInTableCB, constr);
    // Time frame
    constr.gridx = 0;
    constr.gridy = 1;
    constr.anchor = GridBagConstraints.WEST;
    constr.insets = new Insets(5, 5, 5, 5);
    tablePnl.add(OptionWidgets.TIME_FRAME.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 1;
    constr.anchor = GridBagConstraints.LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    tablePnl.add(timeFrameCB, constr);
    /// DISABLED
    timeFrameCB.setEnabled(false);
    // DISABLED
    OptionWidgets.TIME_FRAME.enableCB.setEnabled(false);
    ///////////////////////////////////////////////////////////
    // Add engine constraints
    ///////////////////////////////////////////////////////////
    JPanel enginePnl = new JPanel();
    enginePnl.setBorder(BorderFactory.createTitledBorder("Engine constraints"));
    enginePnl.setLayout(new GridBagLayout());
    // INPUT RATE
    constr.gridx = 0;
    constr.gridy = 0;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(OptionWidgets.MAX_INPUT_RATE.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 0;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(inputRateTF, constr);
    // Output RATE
    constr.gridx = 0;
    constr.gridy = 1;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(OptionWidgets.MAX_OUTPUT_RATE.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 1;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(outputRateTF, constr);
    // DYNAMIC DISCARD LEVEL
    JPanel pnl = new JPanel();
    pnl.setLayout(new GridLayout(3, 2));
    pnl.add(new JLabel("Threshold: "), "1");
    pnl.add(dynThresholdTF, "2");
    pnl.add(new JLabel("Damping: "), "3");
    pnl.add(dynDampingTF, "4");
    pnl.add(new JLabel("Time: "), "5");
    pnl.add(dynIntervalTF, "6");
    constr.gridx = 0;
    constr.gridy = 2;
    constr.fill = GridBagConstraints.VERTICAL;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(OptionWidgets.DYNAMIC_DISCARD_LEVEL.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 2;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(pnl, constr);
    // Add the table and engine panels to the main panel
    mainPnl.add(tablePnl, BorderLayout.CENTER);
    mainPnl.add(enginePnl, BorderLayout.NORTH);
    // Add the OK, CANCEL buttons
    JPanel buttonsPnl = new JPanel(new BorderLayout());
    JPanel okCancelPnl = new JPanel();
    okCancelPnl.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    BoxLayout boxLayout = new BoxLayout(okCancelPnl, BoxLayout.LINE_AXIS);
    okCancelPnl.setLayout(boxLayout);
    okCancelPnl.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
    okBtn = new JButton("Ok");
    okBtn.addActionListener(this);
    cancelBtn = new JButton("Cancel");
    cancelBtn.addActionListener(this);
    okCancelPnl.add(okBtn, BorderLayout.WEST);
    okCancelPnl.add(Box.createRigidArea(new Dimension(10, 0)));
    okCancelPnl.add(cancelBtn, BorderLayout.EAST);
    JPanel restoreBtnPnl = new JPanel(new FlowLayout());
    restoreBtn = new JButton("Restore");
    restoreBtn.addActionListener(this);
    restoreBtnPnl.add(restoreBtn);
    buttonsPnl.add(restoreBtnPnl, BorderLayout.WEST);
    buttonsPnl.add(okCancelPnl, BorderLayout.EAST);
    mainPnl.add(buttonsPnl, BorderLayout.SOUTH);
    pack();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridLayout(java.awt.GridLayout) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JRootPane(javax.swing.JRootPane) Dimension(java.awt.Dimension)

Example 23 with BoxLayout

use of javax.swing.BoxLayout in project EnrichmentMapApp by BaderLab.

the class EdgeWidthDialog method createContents.

private void createContents() {
    JPanel genesetOverlapPanel = createGenesetOverlapPanel();
    JPanel signatureSetPanel = createSignatureSetPanel();
    JPanel widthPanel = new JPanel();
    widthPanel.setLayout(new BoxLayout(widthPanel, BoxLayout.Y_AXIS));
    widthPanel.add(genesetOverlapPanel);
    widthPanel.add(Box.createVerticalStrut(5));
    widthPanel.add(signatureSetPanel);
    JPanel buttonPanel = createButtonPanel();
    JPanel panel = new JPanel();
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER, true).addComponent(widthPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(buttonPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createSequentialGroup().addComponent(widthPanel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(buttonPanel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
    add(panel);
}
Also used : JPanel(javax.swing.JPanel) BoxLayout(javax.swing.BoxLayout) GroupLayout(javax.swing.GroupLayout)

Example 24 with BoxLayout

use of javax.swing.BoxLayout in project joda-time by JodaOrg.

the class AgeCalculator method addBottomArea.

private void addBottomArea(Container container) {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    ItemListener listener = new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            updateResults();
        }
    };
    iFieldSets = new FieldSet[] { new FieldSet("Month Based", new FieldGroup[] { new FieldGroup(listener, "Years", YEARS), new FieldGroup(listener, "Months", MONTHS), new FieldGroup(listener, "Days", DAYS), new FieldGroup(listener, "Hours", HOURS), new FieldGroup(listener, "Minutes", MINUTES), new FieldGroup(listener, "Seconds", SECONDS) }), new FieldSet("Week Based", new FieldGroup[] { new FieldGroup(listener, "Weekyears", WEEKYEARS), new FieldGroup(listener, "Weeks", WEEKS), new FieldGroup(listener, "Days", DAYS), new FieldGroup(listener, "Hours", HOURS), new FieldGroup(listener, "Minutes", MINUTES), new FieldGroup(listener, "Seconds", SECONDS) }) };
    for (int i = 0; i < iFieldSets.length; i++) {
        if (i > 0) {
            panel.add(Box.createHorizontalStrut(10));
        }
        iFieldSets[i].addTo(panel);
    }
    panel.add(Box.createVerticalGlue());
    container.add(fixedHeight(panel));
}
Also used : JPanel(javax.swing.JPanel) ItemEvent(java.awt.event.ItemEvent) BoxLayout(javax.swing.BoxLayout) ItemListener(java.awt.event.ItemListener)

Example 25 with BoxLayout

use of javax.swing.BoxLayout in project joda-time by JodaOrg.

the class AgeCalculator method addMainArea.

private void addMainArea(Container container) {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    addTopArea(panel);
    panel.add(Box.createVerticalStrut(10));
    addBottomArea(panel);
    panel.add(Box.createVerticalGlue());
    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    container.add(panel);
}
Also used : JPanel(javax.swing.JPanel) BoxLayout(javax.swing.BoxLayout)

Aggregations

BoxLayout (javax.swing.BoxLayout)496 JPanel (javax.swing.JPanel)423 JLabel (javax.swing.JLabel)252 ActionEvent (java.awt.event.ActionEvent)165 JButton (javax.swing.JButton)161 Dimension (java.awt.Dimension)143 ActionListener (java.awt.event.ActionListener)141 JScrollPane (javax.swing.JScrollPane)125 FlowLayout (java.awt.FlowLayout)123 BorderLayout (java.awt.BorderLayout)63 GridBagLayout (java.awt.GridBagLayout)57 ButtonGroup (javax.swing.ButtonGroup)49 Container (java.awt.Container)48 JTable (javax.swing.JTable)48 JCheckBox (javax.swing.JCheckBox)47 JmriJFrame (jmri.util.JmriJFrame)45 JSeparator (javax.swing.JSeparator)44 JTextField (javax.swing.JTextField)43 JRadioButton (javax.swing.JRadioButton)30 JComboBox (javax.swing.JComboBox)28