Search in sources :

Example 46 with Component

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

the class TabbedPanel2 method pinVisibleTabs.

public void pinVisibleTabs() {
    for (int i = 0; i < this.getTabCount(); i++) {
        Component tabCom = this.getTabComponentAt(i);
        if (tabCom != null && tabCom instanceof TabbedPanelTab && tabCom.isVisible()) {
            TabbedPanelTab jp = (TabbedPanelTab) tabCom;
            jp.setPinned(true);
            this.saveTabState(jp.getAbstractPanel());
        }
    }
}
Also used : Component(java.awt.Component)

Example 47 with Component

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

the class StandardFieldsDialog method setComboBoxModel.

/**
	 * Sets the given combo box model into the combo box with the given label.
	 * <p>
	 * Control of selection state (i.e. set/get selected item) is done through the combo box model.
	 * 
	 * @param <E> the type of the elements of the combo box model.
	 * @param fieldLabel the name of the label of the combo box field
	 * @param comboBoxModel the model to set into the combo box
	 * @since TODO add version
	 * @see #addComboField(String, ComboBoxModel)
	 * @see #addComboField(int, String, ComboBoxModel)
	 */
public <E> void setComboBoxModel(String fieldLabel, ComboBoxModel<E> comboBoxModel) {
    Component c = this.fieldMap.get(fieldLabel);
    if (c instanceof JComboBox) {
        @SuppressWarnings("unchecked") JComboBox<E> comboBox = (JComboBox<E>) c;
        comboBox.setModel(comboBoxModel);
    } 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 48 with Component

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

the class StandardFieldsDialog method setComboFields.

public void setComboFields(String fieldLabel, List<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 49 with Component

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

the class ViewMenu method updateState.

public void updateState(HttpPanelSyntaxHighlightTextArea httpPanelTextArea) {
    antiAliasingOption.setSelected(httpPanelTextArea.getAntiAliasingEnabled());
    boolean selected = false;
    boolean enabled = false;
    Component c = httpPanelTextArea.getParent();
    if (c instanceof JViewport) {
        c = c.getParent();
        if (c instanceof RTextScrollPane) {
            enabled = true;
            final RTextScrollPane scrollPane = (RTextScrollPane) c;
            selected = scrollPane.getLineNumbersEnabled();
        }
    }
    lineNumbersOption.setVisible(enabled);
    lineNumbersOption.setSelected(selected);
    wordWrapOption.setSelected(httpPanelTextArea.getLineWrap());
    highlightCurrentLineOption.setSelected(httpPanelTextArea.getHighlightCurrentLine());
    fadeCurrentHighlightLineOption.setSelected(httpPanelTextArea.getFadeCurrentLineHighlight());
    showWhitespacesOption.setSelected(httpPanelTextArea.isWhitespaceVisible());
    showNewlinesOption.setSelected(httpPanelTextArea.getEOLMarkersVisible());
    markOccurrencesOption.setSelected(httpPanelTextArea.getMarkOccurrences());
    roundedSelectionEdgesOption.setSelected(httpPanelTextArea.getRoundedSelectionEdges());
    bracketMatchingOption.setSelected(httpPanelTextArea.isBracketMatchingEnabled());
    animatedBracketMatchingOption.setSelected(httpPanelTextArea.getAnimateBracketMatching());
}
Also used : JViewport(javax.swing.JViewport) Component(java.awt.Component) JTextComponent(javax.swing.text.JTextComponent) RTextScrollPane(org.fife.ui.rtextarea.RTextScrollPane)

Example 50 with Component

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

the class PopupMenuUtils method addSeparatorIfNeeded.

/**
     * Appends a separator to the end of the menu if it exists at least one non separator menu component immediately before and
     * if there isn't, already, a separator at the end of the menu.
     * 
     * @param popupMenu the pop up menu that will be processed
     * @return {@code true} if the separator was added, {@code false} otherwise.
     * @see javax.swing.JPopupMenu.Separator
     */
public static boolean addSeparatorIfNeeded(JPopupMenu popupMenu) {
    final int menuComponentCount = popupMenu.getComponentCount();
    if (menuComponentCount == 0) {
        return false;
    }
    final Component lastMenuComponent = popupMenu.getComponent(menuComponentCount - 1);
    if (isPopupMenuSeparator(lastMenuComponent)) {
        return false;
    }
    popupMenu.addSeparator();
    return true;
}
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