Example usage for javax.swing JCheckBox doClick

List of usage examples for javax.swing JCheckBox doClick

Introduction

In this page you can find the example usage for javax.swing JCheckBox doClick.

Prototype

public void doClick() 

Source Link

Document

Programmatically perform a "click".

Usage

From source file:com.romraider.logger.ecu.ui.handler.graph.GraphUpdateHandler.java

public GraphUpdateHandler(final JPanel panel) {
    this.graphPanel = new JPanel(new SpringLayout());
    final JCheckBox combinedCheckbox = new JCheckBox("Combine Graphs", combinedChart);
    combinedCheckbox.addActionListener(new CombinedActionListener(combinedCheckbox));
    JToggleButton playPauseButton = new JToggleButton("Pause Graphs");
    playPauseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            paused = !paused;//from   w  w w.  j  av  a2s  .  c o  m
            if (paused) {
                pauseStartTime = System.currentTimeMillis();
            } else {
                startTime = startTime + (System.currentTimeMillis() - pauseStartTime);
            }
        }
    });
    panel.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(getKeyStroke("F12"), "toggleCombineGraphs");
    panel.getActionMap().put("toggleCombineGraphs", new AbstractAction() {
        private static final long serialVersionUID = 1540427179539775534L;

        public void actionPerformed(ActionEvent e) {
            combinedCheckbox.doClick();
        }
    });
    JPanel controlPanel = new JPanel();
    controlPanel.add(combinedCheckbox);
    controlPanel.add(playPauseButton);
    panel.add(controlPanel, NORTH);
    panel.add(this.graphPanel, CENTER);
}