Search in sources :

Example 6 with JToggleButton

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

the class HttpPanelSender method getButtonFollowRedirects.

private JToggleButton getButtonFollowRedirects() {
    if (followRedirect == null) {
        followRedirect = new JToggleButton(new ImageIcon(HttpPanelSender.class.getResource(// Arrow
        "/resource/icon/16/118.png")));
        // turn
        // around
        // left
        followRedirect.setToolTipText(Constant.messages.getString("manReq.checkBox.followRedirect"));
        followRedirect.setSelected(true);
    }
    return followRedirect;
}
Also used : ImageIcon(javax.swing.ImageIcon) JToggleButton(javax.swing.JToggleButton)

Example 7 with JToggleButton

use of javax.swing.JToggleButton in project jdk8u_jdk by JetBrains.

the class DimensionEncapsulation method run.

@Override
public void run() {
    runTest(new Panel());
    runTest(new Button());
    runTest(new Checkbox());
    runTest(new Canvas());
    runTest(new Choice());
    runTest(new Label());
    runTest(new Scrollbar());
    runTest(new TextArea());
    runTest(new TextField());
    runTest(new Dialog(new JFrame()));
    runTest(new Frame());
    runTest(new Window(new JFrame()));
    runTest(new FileDialog(new JFrame()));
    runTest(new List());
    runTest(new ScrollPane());
    runTest(new JFrame());
    runTest(new JDialog(new JFrame()));
    runTest(new JWindow(new JFrame()));
    runTest(new JLabel("hi"));
    runTest(new JMenu());
    runTest(new JTree());
    runTest(new JTable());
    runTest(new JMenuItem());
    runTest(new JCheckBoxMenuItem());
    runTest(new JToggleButton());
    runTest(new JSpinner());
    runTest(new JSlider());
    runTest(Box.createVerticalBox());
    runTest(Box.createHorizontalBox());
    runTest(new JTextField());
    runTest(new JTextArea());
    runTest(new JTextPane());
    runTest(new JPasswordField());
    runTest(new JFormattedTextField());
    runTest(new JEditorPane());
    runTest(new JButton());
    runTest(new JColorChooser());
    runTest(new JFileChooser());
    runTest(new JCheckBox());
    runTest(new JInternalFrame());
    runTest(new JDesktopPane());
    runTest(new JTableHeader());
    runTest(new JLayeredPane());
    runTest(new JRootPane());
    runTest(new JMenuBar());
    runTest(new JOptionPane());
    runTest(new JRadioButton());
    runTest(new JRadioButtonMenuItem());
    runTest(new JPopupMenu());
    //runTest(new JScrollBar()); --> don't test defines max and min in
    // terms of preferred
    runTest(new JScrollPane());
    runTest(new JViewport());
    runTest(new JSplitPane());
    runTest(new JTabbedPane());
    runTest(new JToolBar());
    runTest(new JSeparator());
    runTest(new JProgressBar());
    if (!failures.isEmpty()) {
        System.out.println("These classes failed");
        for (final Component failure : failures) {
            System.out.println(failure.getClass());
        }
        throw new RuntimeException("Test failed");
    }
}
Also used : JDesktopPane(javax.swing.JDesktopPane) Choice(java.awt.Choice) JTextArea(javax.swing.JTextArea) TextArea(java.awt.TextArea) JTextArea(javax.swing.JTextArea) Label(java.awt.Label) JLabel(javax.swing.JLabel) JTableHeader(javax.swing.table.JTableHeader) JToggleButton(javax.swing.JToggleButton) JToggleButton(javax.swing.JToggleButton) Button(java.awt.Button) JRadioButton(javax.swing.JRadioButton) JButton(javax.swing.JButton) JFrame(javax.swing.JFrame) Checkbox(java.awt.Checkbox) JDialog(javax.swing.JDialog) FileDialog(java.awt.FileDialog) Dialog(java.awt.Dialog) JTextField(javax.swing.JTextField) TextField(java.awt.TextField) JFormattedTextField(javax.swing.JFormattedTextField) JSlider(javax.swing.JSlider) ArrayList(java.util.ArrayList) List(java.awt.List) Canvas(java.awt.Canvas) JWindow(javax.swing.JWindow) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JOptionPane(javax.swing.JOptionPane) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JCheckBox(javax.swing.JCheckBox) JTree(javax.swing.JTree) JFileChooser(javax.swing.JFileChooser) JPasswordField(javax.swing.JPasswordField) ScrollPane(java.awt.ScrollPane) JScrollPane(javax.swing.JScrollPane) JTable(javax.swing.JTable) JSpinner(javax.swing.JSpinner) JSplitPane(javax.swing.JSplitPane) JColorChooser(javax.swing.JColorChooser) JInternalFrame(javax.swing.JInternalFrame) JDialog(javax.swing.JDialog) JFrame(javax.swing.JFrame) Frame(java.awt.Frame) JInternalFrame(javax.swing.JInternalFrame) JRadioButton(javax.swing.JRadioButton) JLayeredPane(javax.swing.JLayeredPane) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) JProgressBar(javax.swing.JProgressBar) JTextField(javax.swing.JTextField) JSeparator(javax.swing.JSeparator) JTextPane(javax.swing.JTextPane) JMenuItem(javax.swing.JMenuItem) Component(java.awt.Component) Scrollbar(java.awt.Scrollbar) Window(java.awt.Window) JWindow(javax.swing.JWindow) JScrollPane(javax.swing.JScrollPane) JViewport(javax.swing.JViewport) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) JToolBar(javax.swing.JToolBar) JPopupMenu(javax.swing.JPopupMenu) Panel(java.awt.Panel) JEditorPane(javax.swing.JEditorPane) JRootPane(javax.swing.JRootPane) FileDialog(java.awt.FileDialog) JMenu(javax.swing.JMenu) JMenuBar(javax.swing.JMenuBar)

Example 8 with JToggleButton

use of javax.swing.JToggleButton in project jdk8u_jdk by JetBrains.

the class Test6817933 method main.

public static void main(String[] args) throws Exception {
    try {
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Exception exception) {
        exception.printStackTrace();
        // ignore test on non-Windows machines
        return;
    }
    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            StyleSheet css = new StyleSheet();
            css.addRule(STYLE);
            HTMLEditorKit kit = new HTMLEditorKit();
            kit.setStyleSheet(css);
            JFrame frame = new JFrame(STYLE);
            frame.add(chooser = new JFileChooser());
            frame.setSize(640, 480);
            frame.setVisible(true);
        }
    });
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync(500);
    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            try {
                JToggleButton button = get(JToggleButton.class, get(WindowsPlacesBar.class, chooser));
                int width = button.getWidth();
                int height = button.getHeight() / 3;
                Point point = new Point(0, height * 2);
                SwingUtilities.convertPointToScreen(point, button);
                width += point.x;
                height += point.y;
                int count = 0;
                Robot robot = new Robot();
                for (int x = point.x; x < width; x++) {
                    for (int y = point.y; y < height; y++) {
                        count += COLOR.equals(robot.getPixelColor(x, y)) ? -2 : 1;
                    }
                }
                if (count < 0) {
                    throw new Exception("TEST ERROR: a lot of red pixels");
                }
            } catch (Exception exception) {
                throw new Error(exception);
            } finally {
                SwingUtilities.getWindowAncestor(chooser).dispose();
            }
        }
    });
}
Also used : StyleSheet(javax.swing.text.html.StyleSheet) JFileChooser(javax.swing.JFileChooser) JToggleButton(javax.swing.JToggleButton) JFrame(javax.swing.JFrame) SunToolkit(sun.awt.SunToolkit) HTMLEditorKit(javax.swing.text.html.HTMLEditorKit) Point(java.awt.Point) Robot(java.awt.Robot)

Example 9 with JToggleButton

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

the class SpiderPanel method getShowMessagesToggleButton.

private JToggleButton getShowMessagesToggleButton() {
    if (showMessageToggleButton == null) {
        showMessageToggleButton = new JToggleButton(Constant.messages.getString("spider.toolbar.button.showmessages.label"), new ImageIcon(SpiderPanel.class.getResource("/resource/icon/16/178.png")));
        showMessageToggleButton.setToolTipText(Constant.messages.getString("spider.toolbar.button.showmessages.tooltip"));
        showMessageToggleButton.addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(ItemEvent e) {
                if (ItemEvent.SELECTED == e.getStateChange()) {
                    showTabs();
                } else {
                    hideMessagesTab();
                }
            }
        });
    }
    return showMessageToggleButton;
}
Also used : ImageIcon(javax.swing.ImageIcon) ItemEvent(java.awt.event.ItemEvent) JToggleButton(javax.swing.JToggleButton) ItemListener(java.awt.event.ItemListener)

Example 10 with JToggleButton

use of javax.swing.JToggleButton 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)

Aggregations

JToggleButton (javax.swing.JToggleButton)51 ActionEvent (java.awt.event.ActionEvent)19 ActionListener (java.awt.event.ActionListener)19 JPanel (javax.swing.JPanel)17 JLabel (javax.swing.JLabel)16 ImageIcon (javax.swing.ImageIcon)14 JButton (javax.swing.JButton)12 Dimension (java.awt.Dimension)8 JScrollPane (javax.swing.JScrollPane)8 ChangeEvent (javax.swing.event.ChangeEvent)8 ChangeListener (javax.swing.event.ChangeListener)8 BoxLayout (javax.swing.BoxLayout)7 JCheckBox (javax.swing.JCheckBox)6 JSlider (javax.swing.JSlider)6 GridBagLayout (java.awt.GridBagLayout)5 GridLayout (java.awt.GridLayout)5 JTabbedPane (javax.swing.JTabbedPane)5 JToolBar (javax.swing.JToolBar)5 BorderLayout (java.awt.BorderLayout)4 Component (java.awt.Component)4