Search in sources :

Example 86 with GridBagConstraints

use of java.awt.GridBagConstraints in project ACS by ACS-Community.

the class StatusLine method initialize.

/**
	 * Init the status line
	 */
private void initialize() {
    BoxLayout layout = new BoxLayout(this, BoxLayout.LINE_AXIS);
    setLayout(layout);
    // Add the panel with the widgets at the left side
    JPanel widgetsPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    widgetsPnl.setBorder(BorderFactory.createLoweredBevelBorder());
    // Build the text fields	
    for (int t = 0; t < counters.length; t++) {
        counters[t] = new CounterWidget(AlarmGUIType.values()[t], tableModel.getAlarmCounter(AlarmGUIType.values()[t]), tableModel);
        // Add the widget
        widgetsPnl.add(counters[t].getComponent());
    }
    add(widgetsPnl);
    JPanel statusMsgPnl = new JPanel();
    statusMsgPnl.setBorder(BorderFactory.createLoweredBevelBorder());
    statusMsgPnl.add(statusMessageLbl);
    add(statusMsgPnl);
    // filtered status display (copied from jlog :: LoggingClient#getStatusLinePnl())
    GridBagConstraints constraintsTableFlt = new GridBagConstraints();
    constraintsTableFlt.gridx = 3;
    constraintsTableFlt.gridy = 0;
    constraintsTableFlt.insets = new Insets(1, 1, 1, 1);
    tableFiltersLbl = new JLabel();
    tableFiltersLbl.setVisible(true);
    tableFiltersLbl.setBorder(BorderFactory.createLoweredBevelBorder());
    Font fntTableFlt = tableFiltersLbl.getFont();
    Font newFontTableFlt = fntTableFlt.deriveFont(fntTableFlt.getSize() - 2);
    tableFiltersLbl.setFont(newFontTableFlt);
    add(tableFiltersLbl, constraintsTableFlt);
    // set initial text
    setTableFilterLbl(null);
    // Add the label with the connection status to the right
    JPanel connectionPnl = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    connectionPnl.setBorder(BorderFactory.createLoweredBevelBorder());
    connectionWidget = new ConnectionWidget(alarmPanel);
    connectionPnl.add(connectionWidget);
    add(connectionPnl);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) FlowLayout(java.awt.FlowLayout) Insets(java.awt.Insets) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) Font(java.awt.Font)

Example 87 with GridBagConstraints

use of java.awt.GridBagConstraints in project ACS by ACS-Community.

the class ErrorTreeCellRenderer method getMembersEditPanel.

/**
	 * This method initializes jPanel5	
	 * 	
	 * @return javax.swing.JPanel	
	 */
private JPanel getMembersEditPanel() {
    if (membersEditPanel == null) {
        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.insets = new java.awt.Insets(0, 4, 0, 3);
        gridBagConstraints3.gridy = 1;
        gridBagConstraints3.gridx = 0;
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.insets = new java.awt.Insets(0, 4, 0, 3);
        gridBagConstraints2.gridy = 0;
        gridBagConstraints2.gridx = 0;
        membersEditPanel = new JPanel();
        membersEditPanel.setLayout(new GridBagLayout());
        membersEditPanel.setVisible(false);
        membersEditPanel.add(getAddMemmberButton(), gridBagConstraints2);
        membersEditPanel.add(getRemoveMemberButton(), gridBagConstraints3);
    }
    return membersEditPanel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout)

Example 88 with GridBagConstraints

use of java.awt.GridBagConstraints 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 89 with GridBagConstraints

use of java.awt.GridBagConstraints in project ACS by ACS-Community.

the class LoggingClient method getStatusLinePnl.

/**
	 * Returns the panel for the status line
	 * 
	 * @return the panel for the status line
	 */
private JPanel getStatusLinePnl() {
    if (statusLinePnl == null) {
        try {
            // Load the icons for the status of the connection
            connectionStatusIcons = new ImageIcon[5];
            connectionStatusIcons[CONNECTED_ICON] = new ImageIcon(this.getClass().getResource("/console-connected.png"));
            connectionStatusIcons[CONNECTING_ICON] = new ImageIcon(this.getClass().getResource("/console-connecting.png"));
            connectionStatusIcons[DISCONNECTED_ICON] = new ImageIcon(this.getClass().getResource("/console-disconnected.png"));
            connectionStatusIcons[SUSPENDED_ICON] = new ImageIcon(this.getClass().getResource("/console-suspended.png"));
            connectionStatusIcons[DELAY_ICON] = new ImageIcon(this.getClass().getResource("/console-delay.png"));
            connectionStatusLbl = new JLabel(connectionStatusIcons[CONNECTING_ICON]);
            // Create a label to show the status of the connection with the DB
            connectionDBLbl = new JLabel();
            statusLinePnl = new javax.swing.JPanel();
            statusLinePnl.setName("Status_line");
            statusLinePnl.setLayout(new java.awt.GridBagLayout());
            GridBagConstraints constraintsProgressBar = new GridBagConstraints();
            constraintsProgressBar.gridx = 0;
            constraintsProgressBar.gridy = 0;
            constraintsProgressBar.fill = GridBagConstraints.BOTH;
            constraintsProgressBar.anchor = GridBagConstraints.WEST;
            constraintsProgressBar.weightx = 1.0;
            constraintsProgressBar.insets = new Insets(1, 2, 1, 1);
            statusLinePnl.add(progressBar, constraintsProgressBar);
            GridBagConstraints constraintsNumFlt = new GridBagConstraints();
            constraintsNumFlt.gridx = 1;
            constraintsNumFlt.gridy = 0;
            constraintsNumFlt.insets = new Insets(1, 1, 1, 1);
            maxNumOfLogsLbl.setVisible(true);
            maxNumOfLogsLbl.setBorder(BorderFactory.createLoweredBevelBorder());
            Font fntNumFlt = maxNumOfLogsLbl.getFont();
            Font newFontNumFlt = fntNumFlt.deriveFont(fntNumFlt.getSize() - 2);
            maxNumOfLogsLbl.setFont(newFontNumFlt);
            statusLinePnl.add(maxNumOfLogsLbl, constraintsNumFlt);
            GridBagConstraints constraintsEngineFlt = new GridBagConstraints();
            constraintsEngineFlt.gridx = 2;
            constraintsEngineFlt.gridy = 0;
            constraintsEngineFlt.insets = new Insets(1, 1, 1, 1);
            engineFiltersLbl.setVisible(true);
            engineFiltersLbl.setBorder(BorderFactory.createLoweredBevelBorder());
            Font fntEngineFlt = engineFiltersLbl.getFont();
            Font newFontEngineFlt = fntEngineFlt.deriveFont(fntEngineFlt.getSize() - 2);
            engineFiltersLbl.setFont(newFontEngineFlt);
            statusLinePnl.add(engineFiltersLbl, constraintsEngineFlt);
            GridBagConstraints constraintsTableFlt = new GridBagConstraints();
            constraintsTableFlt.gridx = 3;
            constraintsTableFlt.gridy = 0;
            constraintsTableFlt.insets = new Insets(1, 1, 1, 1);
            tableFiltersLbl.setVisible(true);
            tableFiltersLbl.setBorder(BorderFactory.createLoweredBevelBorder());
            Font fntTableFlt = tableFiltersLbl.getFont();
            Font newFontTableFlt = fntTableFlt.deriveFont(fntTableFlt.getSize() - 2);
            tableFiltersLbl.setFont(newFontTableFlt);
            statusLinePnl.add(tableFiltersLbl, constraintsTableFlt);
            GridBagConstraints constraintsAudience = new GridBagConstraints();
            constraintsAudience.gridx = 4;
            constraintsAudience.gridy = 0;
            constraintsAudience.insets = new Insets(1, 1, 1, 1);
            audienceLbl.setVisible(true);
            audienceLbl.setBorder(BorderFactory.createLoweredBevelBorder());
            Font fnt = audienceLbl.getFont();
            Font newFont = fnt.deriveFont(fnt.getSize() - 2);
            audienceLbl.setFont(newFont);
            statusLinePnl.add(audienceLbl, constraintsAudience);
            GridBagConstraints constraintsConnectionDBStatus = new GridBagConstraints();
            constraintsConnectionDBStatus.gridx = 5;
            constraintsConnectionDBStatus.gridy = 0;
            constraintsConnectionDBStatus.insets = new Insets(1, 2, 1, 2);
            statusLinePnl.add(connectionDBLbl, constraintsConnectionDBStatus);
            GridBagConstraints constraintsJlogErrors = new GridBagConstraints();
            constraintsConnectionDBStatus.gridx = 6;
            constraintsConnectionDBStatus.gridy = 0;
            constraintsConnectionDBStatus.insets = new Insets(1, 2, 1, 2);
            statusLinePnl.add(jlogErrorLbl, constraintsJlogErrors);
            jlogErrorLbl.setVisible(false);
            jlogErrorLbl.setToolTipText("Error reading logs");
            jlogErrorLbl.addMouseListener(new MouseAdapter() {

                @Override
                public void mouseClicked(MouseEvent e) {
                    jlogErrorLbl.setVisible(false);
                    errorDialog.setVisible(true, LoggingClient.this);
                    super.mouseClicked(e);
                }
            });
            GridBagConstraints constraintsConnectionStatus = new GridBagConstraints();
            constraintsConnectionStatus.gridx = 7;
            constraintsConnectionStatus.gridy = 0;
            constraintsConnectionStatus.insets = new Insets(1, 2, 1, 2);
            statusLinePnl.add(connectionStatusLbl, constraintsConnectionStatus);
        } catch (java.lang.Throwable ivjExc) {
            handleException(ivjExc);
        }
    }
    return statusLinePnl;
}
Also used : ImageIcon(javax.swing.ImageIcon) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) Font(java.awt.Font) JPanel(javax.swing.JPanel)

Example 90 with GridBagConstraints

use of java.awt.GridBagConstraints in project EnrichmentMapApp by BaderLab.

the class EdgeWidthDialog method createSignatureSetPanel.

private JPanel createSignatureSetPanel() {
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Signature Set (Post Analysis)"));
    panel.setLayout(new GridBagLayout());
    GridBagConstraints gbc;
    JLabel pValueLabel = new JLabel("p-value:  ");
    gbc = gridBagConstraints(0, 0);
    gbc.weightx = 1.0;
    panel.add(pValueLabel, gbc);
    JLabel lessThan100 = new JLabel("<= cutoff/100     ");
    gbc = gridBagConstraints(1, 0);
    panel.add(lessThan100, gbc);
    JLabel lessThan10 = new JLabel("<= cutoff/10     ");
    gbc = gridBagConstraints(2, 0);
    panel.add(lessThan10, gbc);
    JLabel greaterThan = new JLabel("> cutoff/10     ");
    gbc = gridBagConstraints(3, 0);
    panel.add(greaterThan, gbc);
    // Width
    JLabel widthLabel = new JLabel("Width:");
    gbc = gridBagConstraints(0, 1);
    panel.add(widthLabel, gbc);
    lessThan100Text = new JFormattedTextField(new DecimalFormat());
    lessThan100Text.setPreferredSize(new Dimension(50, lessThan100Text.getPreferredSize().height));
    lessThan100Text.setHorizontalAlignment(JTextField.RIGHT);
    gbc = gridBagConstraints(1, 1);
    gbc.insets = new Insets(5, 5, 5, 0);
    panel.add(lessThan100Text, gbc);
    lessThan10Text = new JFormattedTextField(new DecimalFormat());
    lessThan10Text.setPreferredSize(new Dimension(50, lessThan10Text.getPreferredSize().height));
    lessThan10Text.setHorizontalAlignment(JTextField.RIGHT);
    gbc = gridBagConstraints(2, 1);
    gbc.insets = new Insets(5, 5, 5, 0);
    panel.add(lessThan10Text, gbc);
    greaterThanText = new JFormattedTextField(new DecimalFormat());
    greaterThanText.setPreferredSize(new Dimension(50, greaterThanText.getPreferredSize().height));
    greaterThanText.setHorizontalAlignment(JTextField.RIGHT);
    gbc = gridBagConstraints(3, 1);
    gbc.insets = new Insets(5, 5, 5, 0);
    panel.add(greaterThanText, gbc);
    makeSmall(pValueLabel, lessThan100, lessThan10, greaterThan, widthLabel, lessThan100Text, lessThan10Text, greaterThanText);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) DecimalFormat(java.text.DecimalFormat) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Aggregations

GridBagConstraints (java.awt.GridBagConstraints)807 GridBagLayout (java.awt.GridBagLayout)585 Insets (java.awt.Insets)520 JPanel (javax.swing.JPanel)472 JLabel (javax.swing.JLabel)412 Dimension (java.awt.Dimension)156 JButton (javax.swing.JButton)131 ActionEvent (java.awt.event.ActionEvent)123 JScrollPane (javax.swing.JScrollPane)119 ActionListener (java.awt.event.ActionListener)116 JTextField (javax.swing.JTextField)99 BorderLayout (java.awt.BorderLayout)98 JCheckBox (javax.swing.JCheckBox)84 TitledBorder (javax.swing.border.TitledBorder)57 ButtonGroup (javax.swing.ButtonGroup)48 JComboBox (javax.swing.JComboBox)45 Color (java.awt.Color)41 FlowLayout (java.awt.FlowLayout)37 Font (java.awt.Font)36 Border (javax.swing.border.Border)35