Search in sources :

Example 41 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 42 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 43 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)

Example 44 with GridBagConstraints

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

the class EdgeWidthDialog method createGenesetOverlapPanel.

private JPanel createGenesetOverlapPanel() {
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Geneset Overlap"));
    panel.setLayout(new GridBagLayout());
    GridBagConstraints gbc;
    // Similarity Coefficient
    JLabel similarityLabel = new JLabel("Similarity Coefficient:    ");
    gbc = gridBagConstraints(0, 0);
    gbc.weightx = 1.0;
    panel.add(similarityLabel, gbc);
    JLabel lowerBound = new JLabel(String.format("%.1f", similarityCutoff));
    lowerBound.setHorizontalAlignment(JLabel.RIGHT);
    gbc = gridBagConstraints(1, 0);
    panel.add(lowerBound, gbc);
    // hardcoded
    JLabel upperBound = new JLabel("1.0");
    upperBound.setHorizontalAlignment(JLabel.RIGHT);
    gbc = gridBagConstraints(2, 0);
    panel.add(upperBound, gbc);
    JLabel spacer = new JLabel("");
    gbc = gridBagConstraints(3, 0);
    panel.add(spacer, gbc);
    // Width
    JLabel widthLabel = new JLabel("Width:");
    gbc = gridBagConstraints(0, 1);
    panel.add(widthLabel, gbc);
    emLowerWidthText = new JFormattedTextField(new DecimalFormat());
    emLowerWidthText.setPreferredSize(new Dimension(50, emLowerWidthText.getPreferredSize().height));
    emLowerWidthText.setHorizontalAlignment(JTextField.RIGHT);
    gbc = gridBagConstraints(1, 1);
    gbc.insets = new Insets(5, 5, 5, 0);
    panel.add(emLowerWidthText, gbc);
    emUpperWidthText = new JFormattedTextField(new DecimalFormat());
    emUpperWidthText.setPreferredSize(new Dimension(50, emUpperWidthText.getPreferredSize().height));
    emUpperWidthText.setHorizontalAlignment(JTextField.RIGHT);
    gbc = gridBagConstraints(2, 1);
    gbc.insets = new Insets(5, 5, 5, 0);
    panel.add(emUpperWidthText, gbc);
    JLabel mappingText = new JLabel("(continuous mapping) ");
    gbc = gridBagConstraints(3, 1);
    panel.add(mappingText, gbc);
    makeSmall(similarityLabel, lowerBound, upperBound, spacer, widthLabel, emLowerWidthText, emUpperWidthText, mappingText);
    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)

Example 45 with GridBagConstraints

use of java.awt.GridBagConstraints in project zaproxy by zaproxy.

the class AlertAddDialog method getJPanel.

/**
	 * This method initializes jPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
private JPanel getJPanel() {
    if (jPanel == null) {
        GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
        java.awt.GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
        javax.swing.JLabel jLabel2 = new JLabel();
        java.awt.GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        java.awt.GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        jPanel = new JPanel();
        jPanel.setLayout(new GridBagLayout());
        jPanel.setPreferredSize(new java.awt.Dimension(450, 650));
        jPanel.setMinimumSize(new java.awt.Dimension(450, 650));
        gridBagConstraints2.gridx = 1;
        gridBagConstraints2.gridy = 5;
        gridBagConstraints2.insets = new java.awt.Insets(2, 2, 2, 2);
        gridBagConstraints2.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints3.gridx = 2;
        gridBagConstraints3.gridy = 5;
        gridBagConstraints3.insets = new java.awt.Insets(2, 2, 2, 10);
        gridBagConstraints3.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints13.gridx = 0;
        gridBagConstraints13.gridy = 5;
        gridBagConstraints13.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints13.weightx = 1.0D;
        gridBagConstraints13.insets = new java.awt.Insets(2, 10, 2, 5);
        gridBagConstraints15.weightx = 1.0D;
        gridBagConstraints15.weighty = 1.0D;
        gridBagConstraints15.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints15.insets = new java.awt.Insets(2, 2, 2, 2);
        gridBagConstraints15.gridwidth = 3;
        gridBagConstraints15.gridx = 0;
        gridBagConstraints15.gridy = 2;
        gridBagConstraints15.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints15.ipadx = 0;
        gridBagConstraints15.ipady = 10;
        jPanel.add(getJScrollPane(), gridBagConstraints15);
        jPanel.add(jLabel2, gridBagConstraints13);
        jPanel.add(getBtnCancel(), gridBagConstraints2);
        jPanel.add(getBtnOk(), gridBagConstraints3);
    }
    return jPanel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) JLabel(javax.swing.JLabel) GridBagConstraints(java.awt.GridBagConstraints)

Aggregations

GridBagConstraints (java.awt.GridBagConstraints)1628 GridBagLayout (java.awt.GridBagLayout)1200 Insets (java.awt.Insets)1044 JPanel (javax.swing.JPanel)960 JLabel (javax.swing.JLabel)833 JButton (javax.swing.JButton)350 ActionEvent (java.awt.event.ActionEvent)303 ActionListener (java.awt.event.ActionListener)284 Dimension (java.awt.Dimension)266 JScrollPane (javax.swing.JScrollPane)252 JTextField (javax.swing.JTextField)250 BorderLayout (java.awt.BorderLayout)214 JCheckBox (javax.swing.JCheckBox)200 JComboBox (javax.swing.JComboBox)101 Color (java.awt.Color)98 FlowLayout (java.awt.FlowLayout)93 TitledBorder (javax.swing.border.TitledBorder)91 Font (java.awt.Font)85 BoxLayout (javax.swing.BoxLayout)82 EmptyBorder (javax.swing.border.EmptyBorder)72