Search in sources :

Example 81 with ImageIcon

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

the class SwingUtil method resizeIcon.

public static ImageIcon resizeIcon(final ImageIcon icon, int width, int height) {
    final Image img = icon.getImage().getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING);
    final BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    final Graphics2D g = bi.createGraphics();
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.drawImage(img, 0, 0, width, height, null);
    g.dispose();
    return new ImageIcon(bi);
}
Also used : ImageIcon(javax.swing.ImageIcon) Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage) BufferedImage(java.awt.image.BufferedImage) Graphics2D(java.awt.Graphics2D)

Example 82 with ImageIcon

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

the class RequestSplitComponent method initUi.

protected void initUi() {
    buttonShowView = new JToggleButton(DisplayUtils.getScaledIcon(new ImageIcon(RequestSplitComponent.class.getResource("/resource/icon/view_split.png"))));
    buttonShowView.setToolTipText(BUTTON_TOOL_TIP);
    panelOptions = new JPanel();
    panelOptions.add(headerViews.getSelectableViewsComponent());
    panelOptions.add(bodyViews.getSelectableViewsComponent());
    headerViews.addView(createHttpPanelHeaderTextView());
    splitMain = new JSplitPane();
    splitMain.setDividerSize(3);
    splitMain.setResizeWeight(0.5d);
    splitMain.setContinuousLayout(false);
    splitMain.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitMain.setTopComponent(headerViews.getViewsPanel());
    splitMain.setBottomComponent(bodyViews.getViewsPanel());
    initViews();
    panelMain = new JPanel(new BorderLayout());
    panelMain.add(splitMain, BorderLayout.CENTER);
    setSelected(false);
}
Also used : ImageIcon(javax.swing.ImageIcon) JPanel(javax.swing.JPanel) JToggleButton(javax.swing.JToggleButton) BorderLayout(java.awt.BorderLayout) JSplitPane(javax.swing.JSplitPane)

Example 83 with ImageIcon

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

the class SearchPanel method getBtnNext.

private JButton getBtnNext() {
    if (btnNext == null) {
        btnNext = new JButton();
        btnNext.setText(Constant.messages.getString("search.toolbar.label.next"));
        // 'arrow down' icon
        btnNext.setIcon(new ImageIcon(SearchPanel.class.getResource("/resource/icon/16/107.png")));
        btnNext.setToolTipText(Constant.messages.getString("search.toolbar.tooltip.next"));
        DisplayUtils.scaleIcon(btnNext);
        btnNext.addActionListener(new java.awt.event.ActionListener() {

            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
                highlightNextResult();
            }
        });
    }
    return btnNext;
}
Also used : ImageIcon(javax.swing.ImageIcon) ActionListener(java.awt.event.ActionListener) JButton(javax.swing.JButton) ActionEvent(java.awt.event.ActionEvent)

Example 84 with ImageIcon

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

the class SearchPanel method initialize.

/**
	 * This method initializes this
	 */
private void initialize() {
    resultsModel = new SearchResultsTableModel();
    resultsTable = new SearchResultsTable(resultsModel);
    resultsTable.setName(HTTP_MESSAGE_CONTAINER_NAME);
    resultsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                SearchResult searchResult = resultsTable.getSelectedSearchResult();
                if (searchResult == null) {
                    return;
                }
                displayMessage(resultsTable.getSelectedSearchResult());
                // Get the focus back so that the arrow keys work
                resultsTable.requestFocusInWindow();
            }
        }
    });
    this.setLayout(new CardLayout());
    //this.setSize(474, 251);
    this.setName(Constant.messages.getString("search.panel.title"));
    // 'magnifying glass' icon
    this.setIcon(new ImageIcon(SearchPanel.class.getResource("/resource/icon/16/049.png")));
    this.add(getPanelCommand(), getPanelCommand().getName());
    this.setShowByDefault(true);
}
Also used : CardLayout(java.awt.CardLayout) ImageIcon(javax.swing.ImageIcon) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 85 with ImageIcon

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

the class SearchPanel method getScopeButton.

private JToggleButton getScopeButton() {
    if (scopeButton == null) {
        scopeButton = new ZapToggleButton();
        scopeButton.setIcon(new ImageIcon(SearchPanel.class.getResource("/resource/icon/fugue/target-grey.png")));
        scopeButton.setToolTipText(Constant.messages.getString("search.toolbar.tooltip.scope.unselected"));
        scopeButton.setSelectedIcon(new ImageIcon(SearchPanel.class.getResource("/resource/icon/fugue/target.png")));
        scopeButton.setSelectedToolTipText(Constant.messages.getString("search.toolbar.tooltip.scope.selected"));
        DisplayUtils.scaleIcon(scopeButton);
        scopeButton.addActionListener(new java.awt.event.ActionListener() {

            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
                extension.setSearchJustInScope(scopeButton.isSelected());
            }
        });
    }
    return scopeButton;
}
Also used : ImageIcon(javax.swing.ImageIcon) ActionListener(java.awt.event.ActionListener) ZapToggleButton(org.zaproxy.zap.view.ZapToggleButton) ActionEvent(java.awt.event.ActionEvent)

Aggregations

ImageIcon (javax.swing.ImageIcon)427 JButton (javax.swing.JButton)109 ActionEvent (java.awt.event.ActionEvent)83 ActionListener (java.awt.event.ActionListener)70 JLabel (javax.swing.JLabel)67 Dimension (java.awt.Dimension)62 BufferedImage (java.awt.image.BufferedImage)51 JPanel (javax.swing.JPanel)48 Insets (java.awt.Insets)42 Image (java.awt.Image)31 BorderLayout (java.awt.BorderLayout)28 IOException (java.io.IOException)28 URL (java.net.URL)26 GridBagLayout (java.awt.GridBagLayout)23 JMenuItem (javax.swing.JMenuItem)23 Color (java.awt.Color)21 Point (java.awt.Point)21 LogTypeHelper (com.cosylab.logging.engine.log.LogTypeHelper)20 JToggleButton (javax.swing.JToggleButton)20 JScrollPane (javax.swing.JScrollPane)19