java.awt.Checkbox Java Examples
The following examples show how to use
java.awt.Checkbox.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DrawTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override public void paint(Graphics g) { Rectangle r = getBounds(); g.setColor(Color.lightGray); g.draw3DRect(0, 0, r.width, r.height, false); int n = getComponentCount(); for (int i = 0; i < n; i++) { Component comp = getComponent(i); if (comp instanceof Checkbox) { Point loc = comp.getLocation(); Dimension d = comp.getSize(); g.setColor(comp.getForeground()); g.drawRect(loc.x - 1, loc.y - 1, d.width + 1, d.height + 1); } } }
Example #2
Source File: DrawTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public void paint(Graphics g) { Rectangle r = getBounds(); g.setColor(Color.lightGray); g.draw3DRect(0, 0, r.width, r.height, false); int n = getComponentCount(); for (int i = 0; i < n; i++) { Component comp = getComponent(i); if (comp instanceof Checkbox) { Point loc = comp.getLocation(); Dimension d = comp.getSize(); g.setColor(comp.getForeground()); g.drawRect(loc.x - 1, loc.y - 1, d.width + 1, d.height + 1); } } }
Example #3
Source File: ExportFusedPhylip.java From MesquiteCore with GNU Lesser General Public License v3.0 | 6 votes |
public boolean getExportOptions(boolean dataSelected, boolean taxaSelected){ MesquiteInteger buttonPressed = new MesquiteInteger(1); PhylipExporterDialog exportDialog = new PhylipExporterDialog(this,containerOfModule(), "Export Phylip Options", buttonPressed); Checkbox excludedCharactersCheckbox = exportDialog.addCheckBox("export excluded characters", localWriteExcludedChars); Checkbox exportTreesCheckbox = exportDialog.addCheckBox("export trees if present", exportTrees); Checkbox exportRAxMLModelFileCheckbox = exportDialog.addCheckBox("save RAxML model file", exportRAxMLModelFile); Checkbox useTranslationTableCheckbox = exportDialog.addCheckBox("use simple taxon names (for RAxML)", useTranslationTable); exportDialog.completeAndShowDialog(dataSelected, taxaSelected); boolean ok = (exportDialog.query(dataSelected, taxaSelected)==0); if (ok) { localWriteExcludedChars = excludedCharactersCheckbox.getState(); exportTrees = exportTreesCheckbox.getState(); exportRAxMLModelFile = exportRAxMLModelFileCheckbox.getState(); useTranslationTable = useTranslationTableCheckbox.getState(); userSpecifiedWriteExcludedChars = true; taxonNameLength = exportDialog.getTaxonNamesLength(); } exportDialog.dispose(); return ok; }
Example #4
Source File: DrawTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override public void paint(Graphics g) { Rectangle r = getBounds(); g.setColor(Color.lightGray); g.draw3DRect(0, 0, r.width, r.height, false); int n = getComponentCount(); for (int i = 0; i < n; i++) { Component comp = getComponent(i); if (comp instanceof Checkbox) { Point loc = comp.getLocation(); Dimension d = comp.getSize(); g.setColor(comp.getForeground()); g.drawRect(loc.x - 1, loc.y - 1, d.width + 1, d.height + 1); } } }
Example #5
Source File: RadialLayout.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Run a demonstration. * * @param args ignored. * * @throws Exception when an error occurs. */ public static void main(final String[] args) throws Exception { final Frame frame = new Frame(); final Panel panel = new Panel(); panel.setLayout(new RadialLayout()); panel.add(new Checkbox("One")); panel.add(new Checkbox("Two")); panel.add(new Checkbox("Three")); panel.add(new Checkbox("Four")); panel.add(new Checkbox("Five")); panel.add(new Checkbox("One")); panel.add(new Checkbox("Two")); panel.add(new Checkbox("Three")); panel.add(new Checkbox("Four")); panel.add(new Checkbox("Five")); frame.add(panel); frame.setSize(300, 500); frame.setVisible(true); }
Example #6
Source File: DrawTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Override public void paint(Graphics g) { Rectangle r = getBounds(); g.setColor(Color.lightGray); g.draw3DRect(0, 0, r.width, r.height, false); int n = getComponentCount(); for (int i = 0; i < n; i++) { Component comp = getComponent(i); if (comp instanceof Checkbox) { Point loc = comp.getLocation(); Dimension d = comp.getSize(); g.setColor(comp.getForeground()); g.drawRect(loc.x - 1, loc.y - 1, d.width + 1, d.height + 1); } } }
Example #7
Source File: DrawTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override public void paint(Graphics g) { Rectangle r = getBounds(); g.setColor(Color.lightGray); g.draw3DRect(0, 0, r.width, r.height, false); int n = getComponentCount(); for (int i = 0; i < n; i++) { Component comp = getComponent(i); if (comp instanceof Checkbox) { Point loc = comp.getLocation(); Dimension d = comp.getSize(); g.setColor(comp.getForeground()); g.drawRect(loc.x - 1, loc.y - 1, d.width + 1, d.height + 1); } } }
Example #8
Source File: DrawTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public void paint(Graphics g) { Rectangle r = getBounds(); g.setColor(Color.lightGray); g.draw3DRect(0, 0, r.width, r.height, false); int n = getComponentCount(); for (int i = 0; i < n; i++) { Component comp = getComponent(i); if (comp instanceof Checkbox) { Point loc = comp.getLocation(); Dimension d = comp.getSize(); g.setColor(comp.getForeground()); g.drawRect(loc.x - 1, loc.y - 1, d.width + 1, d.height + 1); } } }
Example #9
Source File: DrawTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public void paint(Graphics g) { Rectangle r = getBounds(); g.setColor(Color.lightGray); g.draw3DRect(0, 0, r.width, r.height, false); int n = getComponentCount(); for (int i = 0; i < n; i++) { Component comp = getComponent(i); if (comp instanceof Checkbox) { Point loc = comp.getLocation(); Dimension d = comp.getSize(); g.setColor(comp.getForeground()); g.drawRect(loc.x - 1, loc.y - 1, d.width + 1, d.height + 1); } } }
Example #10
Source File: DrawTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("LeakingThisInConstructor") public DrawControls(DrawPanel target) { this.target = target; setLayout(new FlowLayout()); setBackground(Color.lightGray); target.setForeground(Color.red); CheckboxGroup group = new CheckboxGroup(); Checkbox b; add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.red); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.green); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.blue); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.pink); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.orange); add(b = new Checkbox(null, group, true)); b.addItemListener(this); b.setForeground(Color.black); target.setForeground(b.getForeground()); Choice shapes = new Choice(); shapes.addItemListener(this); shapes.addItem("Lines"); shapes.addItem("Points"); shapes.setBackground(Color.lightGray); add(shapes); }
Example #11
Source File: DrawTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override public void paint(Graphics g) { Rectangle r = getBounds(); g.setColor(Color.lightGray); g.draw3DRect(0, 0, r.width, r.height, false); int n = getComponentCount(); for (int i = 0; i < n; i++) { Component comp = getComponent(i); if (comp instanceof Checkbox) { Point loc = comp.getLocation(); Dimension d = comp.getSize(); g.setColor(comp.getForeground()); g.drawRect(loc.x - 1, loc.y - 1, d.width + 1, d.height + 1); } } }
Example #12
Source File: DrawTest.java From hottub with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public DrawControls(DrawPanel target) { this.target = target; setLayout(new FlowLayout()); setBackground(Color.lightGray); target.setForeground(Color.red); CheckboxGroup group = new CheckboxGroup(); Checkbox b; add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.red); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.green); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.blue); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.pink); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.orange); add(b = new Checkbox(null, group, true)); b.addItemListener(this); b.setForeground(Color.black); target.setForeground(b.getForeground()); Choice shapes = new Choice(); shapes.addItemListener(this); shapes.addItem("Lines"); shapes.addItem("Points"); shapes.setBackground(Color.lightGray); add(shapes); }
Example #13
Source File: DrawTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public void itemStateChanged(ItemEvent e) { if (e.getSource() instanceof Checkbox) { target.setForeground(((Component) e.getSource()).getForeground()); } else if (e.getSource() instanceof Choice) { String choice = (String) e.getItem(); if (choice.equals("Lines")) { target.setDrawMode(DrawPanel.LINES); } else if (choice.equals("Points")) { target.setDrawMode(DrawPanel.POINTS); } } }
Example #14
Source File: Stitching_3D.java From Stitching with GNU General Public License v2.0 | 5 votes |
public static final void addInverseEnablerListener(/* final GenericDialog gd, */final Checkbox master, final Component[] enable, final Component[] disable) { master.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent ie) { if (ie.getStateChange() == ItemEvent.SELECTED) { process(enable, false); process(disable, true); } else { process(enable, true); process(disable, false); } } private void process(final Component[] c, final boolean state) { if (null == c) return; for (int i = 0; i < c.length; i++) { c[i].setEnabled(state); // c[i].setVisible(state); } // gd.pack(); } }); }
Example #15
Source File: DrawTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public DrawControls(DrawPanel target) { this.target = target; setLayout(new FlowLayout()); setBackground(Color.lightGray); target.setForeground(Color.red); CheckboxGroup group = new CheckboxGroup(); Checkbox b; add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.red); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.green); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.blue); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.pink); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.orange); add(b = new Checkbox(null, group, true)); b.addItemListener(this); b.setForeground(Color.black); target.setForeground(b.getForeground()); Choice shapes = new Choice(); shapes.addItemListener(this); shapes.addItem("Lines"); shapes.addItem("Points"); shapes.setBackground(Color.lightGray); add(shapes); }
Example #16
Source File: DrawTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public void itemStateChanged(ItemEvent e) { if (e.getSource() instanceof Checkbox) { target.setForeground(((Component) e.getSource()).getForeground()); } else if (e.getSource() instanceof Choice) { String choice = (String) e.getItem(); if (choice.equals("Lines")) { target.setDrawMode(DrawPanel.LINES); } else if (choice.equals("Points")) { target.setDrawMode(DrawPanel.POINTS); } } }
Example #17
Source File: DrawTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public DrawControls(DrawPanel target) { this.target = target; setLayout(new FlowLayout()); setBackground(Color.lightGray); target.setForeground(Color.red); CheckboxGroup group = new CheckboxGroup(); Checkbox b; add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.red); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.green); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.blue); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.pink); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.orange); add(b = new Checkbox(null, group, true)); b.addItemListener(this); b.setForeground(Color.black); target.setForeground(b.getForeground()); Choice shapes = new Choice(); shapes.addItemListener(this); shapes.addItem("Lines"); shapes.addItem("Points"); shapes.setBackground(Color.lightGray); add(shapes); }
Example #18
Source File: CheckboxOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code Checkbox.setLabel(String)} through queue */ public void setLabel(final String string) { runMapping(new MapVoidAction("setLabel") { @Override public void map() { ((Checkbox) getSource()).setLabel(string); } }); }
Example #19
Source File: DrawTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void itemStateChanged(ItemEvent e) { if (e.getSource() instanceof Checkbox) { target.setForeground(((Component) e.getSource()).getForeground()); } else if (e.getSource() instanceof Choice) { String choice = (String) e.getItem(); if (choice.equals("Lines")) { target.setDrawMode(DrawPanel.LINES); } else if (choice.equals("Points")) { target.setDrawMode(DrawPanel.POINTS); } } }
Example #20
Source File: CheckboxOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code Checkbox.removeItemListener(ItemListener)} through queue */ public void removeItemListener(final ItemListener itemListener) { runMapping(new MapVoidAction("removeItemListener") { @Override public void map() { ((Checkbox) getSource()).removeItemListener(itemListener); } }); }
Example #21
Source File: CheckboxOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code Checkbox.getState()} through queue */ public boolean getState() { return (runMapping(new MapBooleanAction("getState") { @Override public boolean map() { return ((Checkbox) getSource()).getState(); } })); }
Example #22
Source File: DrawTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") public DrawControls(DrawPanel target) { this.target = target; setLayout(new FlowLayout()); setBackground(Color.lightGray); target.setForeground(Color.red); CheckboxGroup group = new CheckboxGroup(); Checkbox b; add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.red); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.green); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.blue); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.pink); add(b = new Checkbox(null, group, false)); b.addItemListener(this); b.setForeground(Color.orange); add(b = new Checkbox(null, group, true)); b.addItemListener(this); b.setForeground(Color.black); target.setForeground(b.getForeground()); Choice shapes = new Choice(); shapes.addItemListener(this); shapes.addItem("Lines"); shapes.addItem("Points"); shapes.setBackground(Color.lightGray); add(shapes); }
Example #23
Source File: CheckboxOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code Checkbox.getLabel()} through queue */ public String getLabel() { return (runMapping(new MapAction<String>("getLabel") { @Override public String map() { return ((Checkbox) getSource()).getLabel(); } })); }
Example #24
Source File: DrawTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public void itemStateChanged(ItemEvent e) { if (e.getSource() instanceof Checkbox) { target.setForeground(((Component) e.getSource()).getForeground()); } else if (e.getSource() instanceof Choice) { String choice = (String) e.getItem(); if (choice.equals("Lines")) { target.setDrawMode(DrawPanel.LINES); } else if (choice.equals("Points")) { target.setDrawMode(DrawPanel.POINTS); } } }
Example #25
Source File: Stitch_Many_Images.java From Stitching with GNU General Public License v2.0 | 5 votes |
@Override public void itemStateChanged( final ItemEvent event ) { // one cannot deselect, just select another one if ( event.getStateChange() == ItemEvent.DESELECTED ) checkbox.setState( true ); else if ( event.getStateChange() == ItemEvent.SELECTED ) for ( final Object o : checkboxes ) if ( o == checkbox ) ((Checkbox)o).setState( true ); else ((Checkbox)o).setState( false ); }
Example #26
Source File: CheckboxOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public boolean checkComponent(Component comp) { if (comp instanceof Checkbox) { if (((Checkbox) comp).getLabel() != null) { return (comparator.equals(((Checkbox) comp).getLabel(), label)); } } return false; }
Example #27
Source File: CheckboxOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code Checkbox.setState(boolean)} through queue */ public void setState(final boolean state) { runMapping(new MapVoidAction("setState") { @Override public void map() { ((Checkbox) getSource()).setState(state); } }); }
Example #28
Source File: CheckboxOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code Checkbox.getCheckboxGroup()} through queue */ public CheckboxGroup getCheckboxGroup() { return (runMapping(new MapAction<CheckboxGroup>("getCheckboxGroup") { @Override public CheckboxGroup map() { return ((Checkbox) getSource()).getCheckboxGroup(); } })); }
Example #29
Source File: CheckboxOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Returns information about component. */ @Override public Hashtable<String, Object> getDump() { Hashtable<String, Object> result = super.getDump(); result.put(TEXT_DPROP, ((Checkbox) getSource()).getLabel()); return result; }
Example #30
Source File: CheckboxOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code Checkbox.addItemListener(ItemListener)} through queue */ public void addItemListener(final ItemListener itemListener) { runMapping(new MapVoidAction("addItemListener") { @Override public void map() { ((Checkbox) getSource()).addItemListener(itemListener); } }); }