Search in sources :

Example 16 with JTable

use of javax.swing.JTable in project binnavi by google.

the class CViewSearcherDialog method createGui.

/**
   * Creates the GUI of the dialog.
   */
private void createGui() {
    setLayout(new BorderLayout());
    final JPanel panel = new JPanel(new BorderLayout());
    final JLabel lbl = new JLabel("Address" + ":");
    lbl.setBorder(new EmptyBorder(5, 5, 5, 5));
    panel.add(lbl, BorderLayout.WEST);
    m_offsetField.setSize(400, 20);
    final ActionListener listener = new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            search();
        }
    };
    m_offsetField.addActionListener(listener);
    panel.add(m_offsetField, BorderLayout.CENTER);
    panel.add(new JButton(CActionProxy.proxy(new SearchAction(this))), BorderLayout.EAST);
    add(panel, BorderLayout.NORTH);
    m_table = new JTable(tableModel);
    m_table.addMouseListener(m_listener);
    add(new JScrollPane(m_table), BorderLayout.CENTER);
    add(new CPanelTwoButtons(CActionProxy.proxy(new InternalActionListener()), "OK", "Cancel"), BorderLayout.SOUTH);
    setSize(500, 300);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JTable(javax.swing.JTable) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) CPanelTwoButtons(com.google.security.zynamics.zylib.gui.CPanelTwoButtons) EmptyBorder(javax.swing.border.EmptyBorder)

Example 17 with JTable

use of javax.swing.JTable in project zaproxy by zaproxy.

the class PolicyManagerDialog method getParamsTable.

private JTable getParamsTable() {
    if (paramsTable == null) {
        paramsTable = new JTable();
        paramsTable.setModel(getParamsModel());
        paramsTable.addMouseListener(new MouseListener() {

            @Override
            public void mouseClicked(MouseEvent e) {
            }

            @Override
            public void mousePressed(MouseEvent e) {
                if (e.getClickCount() >= 2) {
                    int row = paramsTable.rowAtPoint(e.getPoint());
                    if (row >= 0) {
                        String name = (String) getParamsModel().getValueAt(row, 0);
                        if (name != null) {
                            try {
                                extension.showPolicyDialog(PolicyManagerDialog.this, name);
                            } catch (ConfigurationException e1) {
                                logger.error(e1.getMessage(), e1);
                            }
                        }
                    }
                }
            }

            @Override
            public void mouseReleased(MouseEvent e) {
            }

            @Override
            public void mouseEntered(MouseEvent e) {
            }

            @Override
            public void mouseExited(MouseEvent e) {
            }
        });
        paramsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (getParamsTable().getSelectedRowCount() == 0) {
                    getModifyButton().setEnabled(false);
                    getRemoveButton().setEnabled(false);
                    getExportButton().setEnabled(false);
                } else if (getParamsTable().getSelectedRowCount() == 1) {
                    getModifyButton().setEnabled(true);
                    // Dont let the last policy be removed
                    getRemoveButton().setEnabled(getParamsModel().getRowCount() > 1);
                    getExportButton().setEnabled(true);
                } else {
                    getModifyButton().setEnabled(false);
                    getRemoveButton().setEnabled(false);
                    getExportButton().setEnabled(false);
                }
            }
        });
    }
    return paramsTable;
}
Also used : MouseListener(java.awt.event.MouseListener) MouseEvent(java.awt.event.MouseEvent) ConfigurationException(org.apache.commons.configuration.ConfigurationException) JTable(javax.swing.JTable) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 18 with JTable

use of javax.swing.JTable in project zaproxy by zaproxy.

the class ScanProgressDialog method getMainPanel.

/**
     * Get the main content panel of the dialog
     * @return the main panel
     */
private JTable getMainPanel() {
    if (table == null) {
        model = new ScanProgressTableModel();
        table = new JTable();
        table.setModel(model);
        table.setRowSelectionAllowed(false);
        table.setColumnSelectionAllowed(false);
        table.setDoubleBuffered(true);
        // First column is for plugin's name
        table.getColumnModel().getColumn(0).setPreferredWidth(256);
        table.getColumnModel().getColumn(1).setPreferredWidth(80);
        // Second column is for plugin's status
        table.getColumnModel().getColumn(2).setPreferredWidth(80);
        table.getColumnModel().getColumn(2).setCellRenderer(new ScanProgressBarRenderer());
        // Third column is for plugin's elapsed time
        DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
        centerRenderer.setHorizontalAlignment(JLabel.CENTER);
        table.getColumnModel().getColumn(3).setPreferredWidth(85);
        table.getColumnModel().getColumn(3).setCellRenderer(centerRenderer);
        // Forth column is for plugin's request count
        DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
        rightRenderer.setHorizontalAlignment(JLabel.RIGHT);
        table.getColumnModel().getColumn(4).setPreferredWidth(60);
        table.getColumnModel().getColumn(4).setCellRenderer(rightRenderer);
        // Fifth column is for plugin's completion and actions
        table.getColumnModel().getColumn(5).setPreferredWidth(40);
        table.getColumnModel().getColumn(5).setCellRenderer(new ScanProgressActionRenderer());
        ScanProgressActionListener listener = new ScanProgressActionListener(table, model);
        table.addMouseListener(listener);
        table.addMouseMotionListener(listener);
    }
    return table;
}
Also used : JTable(javax.swing.JTable) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer)

Example 19 with JTable

use of javax.swing.JTable in project nhin-d by DirectProject.

the class PKCS11SecretKeyManager method initUI.

private void initUI() {
    this.getContentPane().setLayout(new BorderLayout(5, 5));
    // Top Panel
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    addAESKeyButton = new JButton("Add AES Key");
    addAESKeyButton.setSize(new Dimension(30, 100));
    addGenericKeyButton = new JButton("Add Text Key");
    addGenericKeyButton.setSize(new Dimension(30, 100));
    removeKeyButton = new JButton("Remove Key(s)");
    removeKeyButton.setSize(new Dimension(30, 100));
    topPanel.add(addAESKeyButton);
    topPanel.add(addGenericKeyButton);
    topPanel.add(removeKeyButton);
    this.getContentPane().add(topPanel, BorderLayout.NORTH);
    // Middle and list panel
    JPanel midPanel = new JPanel();
    midPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    midPanel.setLayout(new BorderLayout(5, 5));
    JLabel keyListLabel = new JLabel("Secret Keys:");
    Object[][] data = {};
    String[] columnNames = { "Key Alias", "Key Type", "Key Value" };
    keyDataModel = new DefaultTableModel(data, columnNames);
    keyDataTable = new JTable(keyDataModel);
    JScrollPane scrollPane = new JScrollPane(keyDataTable);
    keyDataTable.setFillsViewportHeight(true);
    midPanel.add(keyListLabel, BorderLayout.NORTH);
    midPanel.add(scrollPane, BorderLayout.CENTER);
    this.getContentPane().add(midPanel, BorderLayout.CENTER);
    // Bottom Panel
    JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    quitButton = new JButton("Quit");
    quitButton.setSize(new Dimension(30, 100));
    bottomPanel.add(quitButton);
    this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) DefaultTableModel(javax.swing.table.DefaultTableModel) JTable(javax.swing.JTable) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 20 with JTable

use of javax.swing.JTable in project nhin-d by DirectProject.

the class PKCS11SecretKeyManagerUI method initUI.

private void initUI() {
    this.getContentPane().setLayout(new BorderLayout(5, 5));
    // Top Panel
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    addAESKeyButton = new JButton("Add AES Key");
    addAESKeyButton.setSize(new Dimension(30, 100));
    addGenericKeyButton = new JButton("Add Text Key");
    addGenericKeyButton.setSize(new Dimension(30, 100));
    removeKeyButton = new JButton("Remove Key(s)");
    removeKeyButton.setSize(new Dimension(30, 100));
    topPanel.add(addAESKeyButton);
    topPanel.add(addGenericKeyButton);
    topPanel.add(removeKeyButton);
    this.getContentPane().add(topPanel, BorderLayout.NORTH);
    // Middle and list panel
    JPanel midPanel = new JPanel();
    midPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    midPanel.setLayout(new BorderLayout(5, 5));
    JLabel keyListLabel = new JLabel("Secret Keys:");
    Object[][] data = {};
    String[] columnNames = { "Key Alias", "Key Type", "Key Value" };
    keyDataModel = new DefaultTableModel(data, columnNames);
    keyDataTable = new JTable(keyDataModel);
    JScrollPane scrollPane = new JScrollPane(keyDataTable);
    keyDataTable.setFillsViewportHeight(true);
    midPanel.add(keyListLabel, BorderLayout.NORTH);
    midPanel.add(scrollPane, BorderLayout.CENTER);
    this.getContentPane().add(midPanel, BorderLayout.CENTER);
    // Bottom Panel
    JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    quitButton = new JButton("Quit");
    quitButton.setSize(new Dimension(30, 100));
    bottomPanel.add(quitButton);
    this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) DefaultTableModel(javax.swing.table.DefaultTableModel) JTable(javax.swing.JTable) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Aggregations

JTable (javax.swing.JTable)223 JScrollPane (javax.swing.JScrollPane)127 JPanel (javax.swing.JPanel)100 JButton (javax.swing.JButton)68 JLabel (javax.swing.JLabel)68 Dimension (java.awt.Dimension)60 BorderLayout (java.awt.BorderLayout)58 BoxLayout (javax.swing.BoxLayout)48 ActionEvent (java.awt.event.ActionEvent)46 TableColumn (javax.swing.table.TableColumn)43 ActionListener (java.awt.event.ActionListener)38 TableColumnModel (javax.swing.table.TableColumnModel)33 FlowLayout (java.awt.FlowLayout)28 JTextField (javax.swing.JTextField)28 JComboBox (javax.swing.JComboBox)24 TableRowSorter (javax.swing.table.TableRowSorter)23 MouseEvent (java.awt.event.MouseEvent)21 ArrayList (java.util.ArrayList)16 Container (java.awt.Container)15 DefaultCellEditor (javax.swing.DefaultCellEditor)15