Search in sources :

Example 21 with ImageIcon

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

the class SplineEditor method buildHeader.

private Component buildHeader() {
    ImageIcon icon = new ImageIcon(getClass().getResource("images/simulator.png"));
    JXHeader header = new JXHeader(NbBundle.getMessage(SplineEditor.class, "splineEditor_title"), NbBundle.getMessage(SplineEditor.class, "splineEditor_header"), icon);
    return header;
}
Also used : ImageIcon(javax.swing.ImageIcon) JXHeader(org.jdesktop.swingx.JXHeader)

Example 22 with ImageIcon

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

the class DesktopToolController method getToolbar.

@Override
public JComponent getToolbar() {
    //Get tools ui
    HashMap<ToolUI, Tool> toolMap = new HashMap<>();
    List<ToolUI> toolsUI = new ArrayList<>();
    for (Tool tool : tools) {
        ToolUI ui = tool.getUI();
        if (ui != null) {
            toolsUI.add(ui);
            toolMap.put(ui, tool);
        }
    }
    //Sort by priority
    Collections.sort(toolsUI, new Comparator() {

        @Override
        public int compare(Object o1, Object o2) {
            Integer p1 = ((ToolUI) o1).getPosition();
            Integer p2 = ((ToolUI) o2).getPosition();
            return p1.compareTo(p2);
        }
    });
    //Create toolbar
    final Toolbar toolbar = new Toolbar();
    for (final ToolUI toolUI : toolsUI) {
        final Tool tool = toolMap.get(toolUI);
        JToggleButton btn;
        if (toolUI.getIcon() != null) {
            btn = new JToggleButton(toolUI.getIcon());
        } else {
            btn = new JToggleButton(new ImageIcon(getClass().getResource("/org/gephi/desktop/tools/tool.png")));
        }
        btn.setToolTipText(toolUI.getName() + " - " + toolUI.getDescription());
        btn.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                //Let the user unselect a tool (by clicking on it again) without having to select other tool:
                if (tool == currentTool) {
                    toolbar.clearSelection();
                    unselect();
                } else {
                    try {
                        select(tool);
                        propertiesBar.select(toolUI.getPropertiesBar(tool));
                    } catch (UnselectToolException unselectToolException) {
                        toolbar.clearSelection();
                        unselect();
                    }
                }
            }
        });
        toolbar.add(btn);
    }
    //SelectionManager events
    VizController.getInstance().getSelectionManager().addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            SelectionManager selectionManager = VizController.getInstance().getSelectionManager();
            if (selectionManager.isRectangleSelection() && currentTool != null) {
                toolbar.clearSelection();
                unselect();
            } else if (selectionManager.isSelectionEnabled() && currentTool != null && currentTool.getSelectionType() == ToolSelectionType.NONE) {
                toolbar.clearSelection();
                unselect();
            } else if (selectionManager.isDraggingEnabled() && currentTool != null) {
                toolbar.clearSelection();
                unselect();
            }
        }
    });
    return toolbar;
}
Also used : ImageIcon(javax.swing.ImageIcon) SelectionManager(org.gephi.visualization.api.selection.SelectionManager) HashMap(java.util.HashMap) UnselectToolException(org.gephi.tools.spi.UnselectToolException) ActionEvent(java.awt.event.ActionEvent) ArrayList(java.util.ArrayList) ToolUI(org.gephi.tools.spi.ToolUI) Comparator(java.util.Comparator) JToggleButton(javax.swing.JToggleButton) ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) Tool(org.gephi.tools.spi.Tool)

Example 23 with ImageIcon

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

the class PropertiesBar method getFullScreenIcon.

private JComponent getFullScreenIcon() {
    int logoWidth = 27;
    int logoHeight = 28;
    //fullscreen icon size
    if (UIUtils.isAquaLookAndFeel()) {
        logoWidth = 34;
    }
    JPanel c = new JPanel(new BorderLayout());
    c.setBackground(Color.WHITE);
    JButton fullScreenButton = new JButton();
    fullScreenButton.setIcon(new ImageIcon(getClass().getResource("/org/gephi/desktop/tools/gephilogo_std.png")));
    fullScreenButton.setRolloverEnabled(true);
    fullScreenButton.setRolloverIcon(new ImageIcon(getClass().getResource("/org/gephi/desktop/tools/gephilogo_glow.png")));
    fullScreenButton.setToolTipText(NbBundle.getMessage(PropertiesBar.class, "PropertiesBar.fullScreenButton.tooltip"));
    fullScreenButton.setBorderPainted(false);
    fullScreenButton.setContentAreaFilled(false);
    fullScreenButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    fullScreenButton.setBorder(BorderFactory.createEmptyBorder());
    fullScreenButton.setPreferredSize(new Dimension(logoWidth, logoHeight));
    fullScreenButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Lookup lookup = Lookups.forPath("org-gephi-desktop-tools/Actions/ToggleFullScreenAction");
            for (Action a : lookup.lookupAll(Action.class)) {
                a.actionPerformed(null);
            }
        }
    });
    c.add(fullScreenButton, BorderLayout.CENTER);
    return c;
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) Action(javax.swing.Action) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) Lookup(org.openide.util.Lookup) Dimension(java.awt.Dimension)

Example 24 with ImageIcon

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

the class AbstractParamContainerPanel method getHelpButton.

/**
     * Gets the button that allows to show the help page of the panel.
     *
     * @return the button to show the help page of the panel, never {@code null}.
     * @see #getShowHelpAction()
     */
private JButton getHelpButton() {
    if (btnHelp == null) {
        btnHelp = new JButton();
        btnHelp.setBorder(null);
        // help icon
        btnHelp.setIcon(new ImageIcon(AbstractParamContainerPanel.class.getResource("/resource/icon/16/201.png")));
        btnHelp.addActionListener(getShowHelpAction());
        btnHelp.setToolTipText(Constant.messages.getString("menu.help"));
    }
    return btnHelp;
}
Also used : ImageIcon(javax.swing.ImageIcon) JButton(javax.swing.JButton)

Example 25 with ImageIcon

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

the class SiteMapPanel method getCreateContextButton.

private JButton getCreateContextButton() {
    if (createContextButton == null) {
        createContextButton = new JButton();
        createContextButton.setIcon(DisplayUtils.getScaledIcon(new ImageIcon(LogPanel.class.getResource("/resource/icon/fugue/application-blue-plus.png"))));
        createContextButton.setToolTipText(Constant.messages.getString("menu.file.context.create"));
        createContextButton.addActionListener(new java.awt.event.ActionListener() {

            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
                ContextCreateDialog ccd = new ContextCreateDialog(View.getSingleton().getMainFrame());
                ccd.setVisible(true);
            }
        });
    }
    return createContextButton;
}
Also used : ImageIcon(javax.swing.ImageIcon) LogPanel(org.parosproxy.paros.extension.history.LogPanel) JButton(javax.swing.JButton) ContextCreateDialog(org.zaproxy.zap.view.ContextCreateDialog)

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