use of javax.swing.JToggleButton in project ACS by ACS-Community.
the class BeanGrouper method getSaveButton.
private JToggleButton getSaveButton() {
if (saveButton == null) {
saveButton = new JToggleButton();
saveButton.setIcon(new ImageIcon(getClass().getClassLoader().getResource("cl/utfsm/samplingSystemUI/img/filesave.png")));
saveButton.setSelected(false);
saveButton.setToolTipText("Press to start saving sampled data to file");
saveButton.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (saveButton.isSelected() == true) {
saveButton.setToolTipText("Press to stop saving sampled data to file");
for (DataPrinter dp : samplers) {
((PlotPrinter) dp).setDumpToFile(true);
}
} else {
saveButton.setToolTipText("Press to start saving sampled data to file");
for (DataPrinter dp : samplers) {
((PlotPrinter) dp).setDumpToFile(false);
}
}
}
});
}
return saveButton;
}
use of javax.swing.JToggleButton in project ACS by ACS-Community.
the class Toolbar method initialize.
/**
* Initialize the toolbar
*
* @param <code>true</code> if the reduction rules are applied at startup
*/
private void initialize(boolean reduce) {
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
// Add the button to inhibit sounds
add(soundComponent);
// Add the label and the combobox for auto ack
Font fnt = autoAckLbl.getFont();
Font newFont = fnt.deriveFont(fnt.getSize() * 80 / 100);
autoAckLbl.setFont(newFont);
add(Box.createHorizontalStrut(2));
add(autoAckLbl);
autoAckLevelCB.setFont(newFont);
autoAckLevelCB.setEditable(false);
autoAckLevelCB.setOpaque(true);
// Set the colors of the renderers
ComboBoxValues.initSizes();
autoAckLevelCB.setRenderer(new ComboBoxRenderer());
autoAckLevelCB.setSelectedIndex(ComboBoxValues.NONE.ordinal());
autoAckLevelCB.setMaximumRowCount(ComboBoxValues.values().length);
autoAckLevelCB.setEditable(false);
autoAckLevelCB.addActionListener(this);
Dimension d = new Dimension(ComboBoxValues.getWidth(), ComboBoxValues.getHeight());
autoAckLevelCB.setMinimumSize(d);
add(Box.createHorizontalStrut(5));
add(autoAckLevelCB);
activeReductionIcon = new ImageIcon(this.getClass().getResource("/alma/acsplugins/alarmsystem/gui/resources/arrow_in.png"));
inactiveReductionIcon = new ImageIcon(this.getClass().getResource("/alma/acsplugins/alarmsystem/gui/resources/arrow_out.png"));
reductionRulesBtn = new JToggleButton("Reduce", activeReductionIcon, reduce);
reductionRulesBtn.setFont(newFont);
add(Box.createHorizontalStrut(5));
add(reductionRulesBtn);
reductionRulesBtn.addActionListener(this);
add(Box.createHorizontalStrut(5));
add(pauseBtn);
pauseBtn.addActionListener(this);
pauseBtn.setFont(newFont);
add(Box.createHorizontalStrut(5));
add(new JSeparator(JSeparator.VERTICAL));
add(Box.createHorizontalStrut(5));
JLabel searchLbl = new JLabel("Search");
add(searchLbl);
searchLbl.setFont(newFont);
add(Box.createHorizontalStrut(5));
add(searchTF);
searchTF.setEditable(true);
searchTF.getDocument().addDocumentListener(this);
searchTF.setToolTipText("Search");
add(Box.createHorizontalStrut(3));
add(prevSearchBtn);
prevSearchBtn.setToolTipText("Search prev");
prevSearchBtn.addActionListener(this);
add(Box.createHorizontalStrut(3));
add(nextSearchBtn);
nextSearchBtn.setToolTipText("Search next");
nextSearchBtn.addActionListener(this);
add(Box.createHorizontalStrut(3));
add(showBtn);
showBtn.setFont(newFont);
showBtn.setToolTipText("Filter in");
showBtn.addActionListener(this);
add(Box.createHorizontalStrut(3));
add(hideBtn);
hideBtn.setFont(newFont);
hideBtn.setToolTipText("Filter out");
hideBtn.addActionListener(this);
add(Box.createHorizontalStrut(2));
ratioSearchBtns();
}
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;
}
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();
}
}
});
}
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");
}
}
Aggregations