Search in sources :

Example 41 with Component

use of java.awt.Component in project enclojure by EricThorsen.

the class ClojureTemplateWizardIterator method initialize.

public void initialize(WizardDescriptor wiz) {
    this.wiz = wiz;
    index = 0;
    panels = createPanels();
    // Make sure list of steps is accurate.
    String[] steps = createSteps();
    for (int i = 0; i < panels.length; i++) {
        Component c = panels[i].getComponent();
        if (steps[i] == null) {
            // Default step name to component name of panel.
            // Mainly useful for getting the name of the target
            // chooser to appear in the list of steps.
            steps[i] = c.getName();
        }
        if (c instanceof JComponent) {
            // assume Swing components
            JComponent jc = (JComponent) c;
            // Step #.
            jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
            // Step name (actually the whole list for reference).
            jc.putClientProperty("WizardPanel_contentData", steps);
        }
    }
}
Also used : JComponent(javax.swing.JComponent) JComponent(javax.swing.JComponent) Component(java.awt.Component)

Example 42 with Component

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

the class SpiderPanel method getUrlsTable.

/**
	 * Gets the scan results table.
	 * 
	 * @return the scan results table
	 */
private JXTable getUrlsTable() {
    if (urlsTable == null) {
        // Create the table with a default, empty TableModel and the proper settings
        urlsTable = new ZapTable(EMPTY_URLS_TABLE_MODEL);
        urlsTable.setColumnSelectionAllowed(false);
        urlsTable.setCellSelectionEnabled(false);
        urlsTable.setRowSelectionAllowed(true);
        urlsTable.setAutoCreateRowSorter(true);
        urlsTable.setAutoCreateColumnsFromModel(false);
        urlsTable.getColumnExt(0).setCellRenderer(new DefaultTableRenderer(new MappedValue(StringValues.EMPTY, IconValues.NONE), JLabel.CENTER));
        urlsTable.getColumnExt(0).setHighlighters(new ProcessedCellItemIconHighlighter(0));
        urlsTable.getColumnModel().getColumn(0).setMinWidth(80);
        // processed
        urlsTable.getColumnModel().getColumn(0).setPreferredWidth(90);
        urlsTable.getColumnModel().getColumn(1).setMinWidth(60);
        // method
        urlsTable.getColumnModel().getColumn(1).setPreferredWidth(70);
        // name
        urlsTable.getColumnModel().getColumn(2).setMinWidth(300);
        urlsTable.getColumnModel().getColumn(3).setMinWidth(50);
        // flags
        urlsTable.getColumnModel().getColumn(3).setPreferredWidth(250);
        urlsTable.setName(PANEL_NAME);
        urlsTable.setDoubleBuffered(true);
        urlsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        urlsTable.setComponentPopupMenu(new JPopupMenu() {

            private static final long serialVersionUID = 6608291059686282641L;

            @Override
            public void show(Component invoker, int x, int y) {
                View.getSingleton().getPopupMenu().show(invoker, x, y);
            }
        });
    }
    return urlsTable;
}
Also used : ZapTable(org.zaproxy.zap.view.ZapTable) MappedValue(org.jdesktop.swingx.renderer.MappedValue) Component(java.awt.Component) DefaultTableRenderer(org.jdesktop.swingx.renderer.DefaultTableRenderer) JPopupMenu(javax.swing.JPopupMenu)

Example 43 with Component

use of java.awt.Component in project otapij by FellowTraveler.

the class CustomTable method prepareRenderer.

public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex) {
    Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
    if (c instanceof JComponent) {
        JComponent jc = (JComponent) c;
        if (getValueAt(rowIndex, vColIndex) instanceof String) {
            //Utility.getKeyFromName((String)getValueAt(rowIndex, vColIndex));
            String value = (String) getValueAt(rowIndex, vColIndex);
            if (this.getModel() instanceof AccountTableModel && vColIndex == 0) {
                value = (String) this.getModel().getValueAt(rowIndex, 3);
            }
            if (this.getModel() instanceof NYMTableModel && vColIndex == 0) {
                value = (String) this.getModel().getValueAt(rowIndex, 1);
            }
            if (this.getModel() instanceof BasketTableModel && vColIndex == 0) {
                value = (String) this.getModel().getValueAt(rowIndex, 1);
            }
            if (this.getModel() instanceof AssetContractTableModel && vColIndex == 0) {
                value = (String) this.getModel().getValueAt(rowIndex, 1);
            }
            if (this.getModel() instanceof ServerContractTableModel && vColIndex == 0) {
                value = (String) this.getModel().getValueAt(rowIndex, 1);
            }
            if (this.getModel() instanceof OTOutboxTableModel) {
                if (vColIndex == 4)
                    value = (String) this.getModel().getValueAt(rowIndex, 8);
                if (vColIndex == 5)
                    value = (String) this.getModel().getValueAt(rowIndex, 9);
            }
            if (this.getModel() instanceof OTInboxTableModel) {
                if (vColIndex == 4)
                    value = (String) this.getModel().getValueAt(rowIndex, 10);
                if (vColIndex == 5)
                    value = (String) this.getModel().getValueAt(rowIndex, 11);
            }
            if (this.getModel() instanceof NYMOutboxTableModel) {
                if (vColIndex == 1)
                    value = (String) this.getModel().getValueAt(rowIndex, 4);
                if (vColIndex == 2)
                    value = (String) this.getModel().getValueAt(rowIndex, 5);
            }
            if (this.getModel() instanceof NYMBoxTableModel) {
                if (vColIndex == 1)
                    value = (String) this.getModel().getValueAt(rowIndex, 4);
                if (vColIndex == 2)
                    value = (String) this.getModel().getValueAt(rowIndex, 5);
            }
            jc.setToolTipText(value);
        }
    }
    return c;
}
Also used : BasketTableModel(com.moneychanger.ui.model.BasketTableModel) NYMTableModel(com.moneychanger.ui.model.NYMTableModel) OTInboxTableModel(com.moneychanger.ui.model.OTInboxTableModel) NYMBoxTableModel(com.moneychanger.ui.model.NYMBoxTableModel) AccountTableModel(com.moneychanger.ui.model.AccountTableModel) NYMOutboxTableModel(com.moneychanger.ui.model.NYMOutboxTableModel) JComponent(javax.swing.JComponent) OTOutboxTableModel(com.moneychanger.ui.model.OTOutboxTableModel) JComponent(javax.swing.JComponent) Component(java.awt.Component) ServerContractTableModel(com.moneychanger.ui.model.ServerContractTableModel) AssetContractTableModel(com.moneychanger.ui.model.AssetContractTableModel)

Example 44 with Component

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

the class StandardFieldsDialog method setComboFields.

public void setComboFields(String fieldLabel, String[] choices, String value) {
    Component c = this.fieldMap.get(fieldLabel);
    if (c instanceof JComboBox) {
        @SuppressWarnings("unchecked") JComboBox<String> comboBox = (JComboBox<String>) c;
        comboBox.removeAllItems();
        for (String str : choices) {
            comboBox.addItem(str);
        }
        if (value != null) {
            comboBox.setSelectedItem(value);
        }
    } else if (c == null) {
        // Ignore - could be during init
        logger.debug("No field for " + fieldLabel);
    } else {
        logger.error("Unrecognised field class " + fieldLabel + ": " + c.getClass().getCanonicalName());
    }
}
Also used : JComboBox(javax.swing.JComboBox) JComponent(javax.swing.JComponent) Component(java.awt.Component)

Example 45 with Component

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

the class TabbedPanel2 method setCloseButtonStates.

private void setCloseButtonStates() {
    // Hide all 'close' buttons except for the selected tab
    for (int i = 0; i < this.getTabCount(); i++) {
        Component tabCom = this.getTabComponentAt(i);
        if (tabCom != null && tabCom instanceof TabbedPanelTab) {
            TabbedPanelTab jp = (TabbedPanelTab) tabCom;
            jp.setEnabled(i == getSelectedIndex());
        }
    }
}
Also used : Component(java.awt.Component)

Aggregations

Component (java.awt.Component)645 JComponent (javax.swing.JComponent)163 Dimension (java.awt.Dimension)81 JLabel (javax.swing.JLabel)65 JPanel (javax.swing.JPanel)60 Insets (java.awt.Insets)55 Point (java.awt.Point)55 TableCellRenderer (javax.swing.table.TableCellRenderer)47 Container (java.awt.Container)46 JScrollPane (javax.swing.JScrollPane)42 JTable (javax.swing.JTable)36 JButton (javax.swing.JButton)35 BorderLayout (java.awt.BorderLayout)34 GridBagConstraints (java.awt.GridBagConstraints)34 JTextComponent (javax.swing.text.JTextComponent)34 GridBagLayout (java.awt.GridBagLayout)33 Color (java.awt.Color)32 JList (javax.swing.JList)31 TableColumn (javax.swing.table.TableColumn)31 MouseEvent (java.awt.event.MouseEvent)27