Search in sources :

Example 76 with JPanel

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

the class ErrorTreeCellRenderer method getNodesEditPanel.

/**
	 * This method initializes jPanel3	
	 * 	
	 * @return javax.swing.JPanel	
	 */
private JPanel getNodesEditPanel() {
    if (nodesEditPanel == null) {
        nodesEditPanel = new JPanel();
        nodesEditPanel.setVisible(false);
        nodesEditPanel.add(getNewNodeButton(), null);
        nodesEditPanel.add(getRemoveNodeButton(), null);
    }
    return nodesEditPanel;
}
Also used : JPanel(javax.swing.JPanel)

Example 77 with JPanel

use of javax.swing.JPanel 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 78 with JPanel

use of javax.swing.JPanel 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 79 with JPanel

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

the class ColumnHeaderRankOptionRenderer method getTableCellRendererComponent.

@Override
public Component getTableCellRendererComponent(JTable table, final Object value, boolean isSelected, boolean hasFocus, int row, int col) {
    // Convert RankingOption to display String
    String text = null;
    if (value instanceof RankingOption) {
        RankingOption rankingOption = (RankingOption) value;
        text = rankingOption.getTableHeaderText();
    } else if (value instanceof RankOptionErrorHeader) {
        RankOptionErrorHeader headerValue = (RankOptionErrorHeader) value;
        text = headerValue.getRankingOption().getTableHeaderText();
    }
    // Use the default renderer to paint the header nicely (with sort arrows)
    JTableHeader header = table.getTableHeader();
    TableCellRenderer delegate = table.getTableHeader().getDefaultRenderer();
    Component component = delegate.getTableCellRendererComponent(table, text, isSelected, hasFocus, row, col);
    // Create the panel
    JButton button = new JButton("Sort");
    SwingUtil.makeSmall(button);
    if (isAquaLAF())
        button.putClientProperty("JButton.buttonType", "gradient");
    button.addActionListener(e -> menuButtonClicked(table, button));
    JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.add(button, BorderLayout.CENTER);
    buttonPanel.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    buttonPanel.setForeground(header.getForeground());
    buttonPanel.setBackground(header.getBackground());
    JPanel panel = new JPanel(new BorderLayout());
    panel.setForeground(header.getForeground());
    panel.setBackground(header.getBackground());
    panel.add(component, BorderLayout.CENTER);
    panel.add(buttonPanel, BorderLayout.NORTH);
    if (value instanceof RankOptionErrorHeader) {
        JLabel icon = new JLabel(IconManager.ICON_TIMES_CIRCLE);
        icon.setForeground(Color.RED.darker());
        icon.setFont(iconManager.getIconFont(13.0f));
        icon.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        icon.setOpaque(false);
        panel.add(icon, BorderLayout.WEST);
    }
    // Add mouse listener
    if (mouseListener != null) {
        header.removeMouseListener(mouseListener);
    }
    header.addMouseListener(mouseListener = new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            int col = header.columnAtPoint(e.getPoint());
            if (col == colIndex)
                if (e.getY() <= button.getHeight())
                    button.doClick();
                else
                    sortColumn(table);
            else
                sortOrder = null;
        }
    });
    return panel;
}
Also used : TableCellRenderer(javax.swing.table.TableCellRenderer) JPanel(javax.swing.JPanel) MouseEvent(java.awt.event.MouseEvent) JButton(javax.swing.JButton) MouseAdapter(java.awt.event.MouseAdapter) RankingOption(org.baderlab.csplugins.enrichmentmap.view.heatmap.RankingOption) JTableHeader(javax.swing.table.JTableHeader) JLabel(javax.swing.JLabel) BorderLayout(java.awt.BorderLayout) Component(java.awt.Component)

Example 80 with JPanel

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

the class MannWhitneyRanksDialog method createContents.

@AfterInjection
private void createContents() {
    JPanel dataSetPanel = createDataSetPanel();
    JPanel buttonPanel = createButtonPanel();
    buttonPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIManager.getColor("Separator.foreground")));
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(dataSetPanel, BorderLayout.CENTER);
    panel.add(buttonPanel, BorderLayout.SOUTH);
    setContentPane(panel);
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) AfterInjection(org.baderlab.csplugins.enrichmentmap.AfterInjection)

Aggregations

JPanel (javax.swing.JPanel)4487 JLabel (javax.swing.JLabel)1843 BorderLayout (java.awt.BorderLayout)1461 JButton (javax.swing.JButton)1180 Dimension (java.awt.Dimension)1107 GridBagLayout (java.awt.GridBagLayout)1071 ActionEvent (java.awt.event.ActionEvent)1019 GridBagConstraints (java.awt.GridBagConstraints)954 JScrollPane (javax.swing.JScrollPane)901 ActionListener (java.awt.event.ActionListener)871 BoxLayout (javax.swing.BoxLayout)801 Insets (java.awt.Insets)724 FlowLayout (java.awt.FlowLayout)667 JTextField (javax.swing.JTextField)532 JCheckBox (javax.swing.JCheckBox)458 GridLayout (java.awt.GridLayout)375 JComboBox (javax.swing.JComboBox)267 EmptyBorder (javax.swing.border.EmptyBorder)252 JTable (javax.swing.JTable)224 Color (java.awt.Color)210