List of usage examples for javax.swing JCheckBox setSelected
public void setSelected(boolean b)
From source file:biomine.bmvis2.pipeline.EdgeLabelOperation.java
public JComponent getSettingsComponent(final SettingsChangeCallback v, VisualGraph graph) { JPanel ret = new JPanel(); ret.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = c.HORIZONTAL;//from ww w . j a v a 2s . c o m c.weightx = 1; c.weighty = 0; c.gridy = 0; final Set<String> avail = graph.getAvailableEdgeLabels(); for (final String str : avail) { final JCheckBox box = new JCheckBox(); box.setSelected(enabledLabels.contains(str)); box.setAction(new AbstractAction(str) { public void actionPerformed(ActionEvent arg0) { if (box.isSelected() != enabledLabels.contains(str)) { if (box.isSelected()) enabledLabels.add(str); else enabledLabels.remove(str); v.settingsChanged(false); } } }); ret.add(box, c); c.gridy++; } return ret; }
From source file:biomine.bmvis2.pipeline.NodeLabelOperation.java
public JComponent getSettingsComponent(final SettingsChangeCallback v, VisualGraph graph) { JPanel ret = new JPanel(); ret.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1;//from w ww . j a v a2 s .co m c.weighty = 0; c.gridy = 0; final Set<String> avail = graph.getAvailableNodeLabels(); for (final String str : avail) { final JCheckBox box = new JCheckBox(); box.setSelected(enabledLabels.contains(str)); box.setAction(new AbstractAction(str) { public void actionPerformed(ActionEvent arg0) { if (box.isSelected() != enabledLabels.contains(str)) { if (box.isSelected()) enabledLabels.add(str); else enabledLabels.remove(str); v.settingsChanged(false); } } }); ret.add(box, c); c.gridy++; } return ret; }
From source file:com.igormaznitsa.mindmap.exporters.PNGImageExporter.java
@Override public JComponent makeOptions() { final JPanel panel = UI_FACTORY.makePanel(); final JCheckBox checkBoxExpandAll = UI_FACTORY.makeCheckBox(); checkBoxExpandAll.setSelected(flagExpandAllNodes); checkBoxExpandAll.setText(BUNDLE.getString("PNGImageExporter.optionUnfoldAll")); checkBoxExpandAll.setActionCommand("unfold"); final JCheckBox checkSaveBackground = UI_FACTORY.makeCheckBox(); checkSaveBackground.setSelected(flagSaveBackground); checkSaveBackground.setText(BUNDLE.getString("PNGImageExporter.optionDrawBackground")); checkSaveBackground.setActionCommand("back"); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(checkBoxExpandAll);//from w ww. j a v a 2s. c o m panel.add(checkSaveBackground); panel.setBorder(BorderFactory.createEmptyBorder(16, 32, 16, 32)); return panel; }
From source file:com.igormaznitsa.mindmap.plugins.exporters.PNGImageExporter.java
@Override @Nullable// w w w . j a v a2s .c o m public JComponent makeOptions() { final JPanel panel = UI_FACTORY.makePanel(); final JCheckBox checkBoxExpandAll = UI_FACTORY.makeCheckBox(); checkBoxExpandAll.setSelected(flagExpandAllNodes); checkBoxExpandAll.setText(Texts.getString("PNGImageExporter.optionUnfoldAll")); checkBoxExpandAll.setActionCommand("unfold"); final JCheckBox checkSaveBackground = UI_FACTORY.makeCheckBox(); checkSaveBackground.setSelected(flagSaveBackground); checkSaveBackground.setText(Texts.getString("PNGImageExporter.optionDrawBackground")); checkSaveBackground.setActionCommand("back"); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(checkBoxExpandAll); panel.add(checkSaveBackground); panel.setBorder(BorderFactory.createEmptyBorder(16, 32, 16, 32)); return panel; }
From source file:gda.util.userOptions.UserOptionsDialog.java
@SuppressWarnings("rawtypes") private JPanel makePane() { JPanel pane = new JPanel(); pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); Iterator<Map.Entry<String, UserOption>> iter = options.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<String, UserOption> entry = iter.next(); UserOption option = entry.getValue(); if (option.defaultValue instanceof Boolean && option.description instanceof String) { JCheckBox box = new JCheckBox((String) option.description); box.setSelected((Boolean) option.value); box.setAlignmentX(Component.LEFT_ALIGNMENT); box.setAlignmentY(Component.LEFT_ALIGNMENT); components.put(entry.getKey(), box); pane.add(box);/*from www .j a va 2s.c o m*/ } } return pane; }
From source file:edu.gmu.cs.sim.util.media.chart.SeriesAttributes.java
/** Builds a SeriesAttributes with the provided generator, name for the series, and index for the series. Calls buildAttributes to construct custom elements in the LabelledList, then finally calls rebuildGraphicsDefinitions() to update the series. *//* w w w. jav a 2 s . c o m*/ public SeriesAttributes(ChartGenerator generator, String name, int index, SeriesChangeListener stoppable) { super(name); setStoppable(stoppable); this.generator = generator; seriesIndex = index; final JCheckBox check = new JCheckBox(); check.setSelected(true); check.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPlotVisible(check.isSelected()); } }); manipulators = new Box(BoxLayout.X_AXIS); buildManipulators(); JLabel spacer = new JLabel(""); spacer.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); Box b = new Box(BoxLayout.X_AXIS); b.add(check); b.add(spacer); b.add(manipulators); b.add(Box.createGlue()); addLabelled("Show", b); final PropertyField nameF = new PropertyField(name) { public String newValue(String newValue) { SeriesAttributes.this.setSeriesName(newValue); rebuildGraphicsDefinitions(); return newValue; } }; addLabelled("Series", nameF); buildAttributes(); rebuildGraphicsDefinitions(); }
From source file:com.emental.mindraider.ui.dialogs.ConnectUriqaServerJDialog.java
/** * Constructor.// w w w .java2s . c om */ public ConnectUriqaServerJDialog() { super(Messages.getString("ConnectUriqaServerJDialog.title")); getContentPane().setLayout(new BorderLayout()); // north JPanel north = new JPanel(); north.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.serverUrl"))); uriqaServerUrl = new JTextField("http://sw.nokia.com/uriqa/", 31); uriqaServerUrl.setMinimumSize(new Dimension(TEXT_AREAS_WIDTH, uriqaServerUrl.getPreferredSize().height)); uriqaServerUrl.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) { connect(); } } public void keyReleased(KeyEvent keyEvent) { } public void keyTyped(KeyEvent keyEvent) { } }); north.add(uriqaServerUrl); getContentPane().add(north, BorderLayout.NORTH); // center JPanel center = new JPanel(); center.setLayout(new BorderLayout()); JPanel centerTop = new JPanel(); centerTop.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.resource"))); String[] knowUriqaUris = new String[] { "http://sw.nokia.com/VOC-1/term", "http://sw.nokia.com/MARS-3/Rank", "http://sw.nokia.com/MARS-3", "http://sw.nokia.com/schemas/nokia/MARS-3.1.rdf" }; resourceUri = new JComboBox(knowUriqaUris); resourceUri.setMinimumSize(new Dimension(TEXT_AREAS_WIDTH, resourceUri.getPreferredSize().height)); resourceUri.setEditable(true); centerTop.add(resourceUri); JPanel centerCenter = new JPanel(); centerCenter.setLayout(new FlowLayout(FlowLayout.LEFT)); centerCenter.setToolTipText(Messages.getString("ConnectUriqaServerJDialog.loadOverToolTip")); centerCenter.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.loadOver"))); JCheckBox loadOver = new JCheckBox(); loadOver.setSelected(true); loadOver.setEnabled(false); centerCenter.add(loadOver); JPanel centerBottom = new JPanel(); centerBottom.setLayout(new FlowLayout(FlowLayout.LEFT)); centerBottom.setToolTipText(Messages.getString("ConnectUriqaServerJDialog.addInferedToolTip")); centerBottom.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.addInfered"))); addInfered = new JCheckBox(); addInfered.setSelected(true); centerBottom.add(addInfered); center.add(centerTop, BorderLayout.NORTH); center.add(centerCenter, BorderLayout.CENTER); center.add(centerBottom, BorderLayout.SOUTH); getContentPane().add(center, BorderLayout.CENTER); // south JPanel south = new JPanel(); JButton uploadButton = new JButton(Messages.getString("ConnectUriqaServerJDialog.connect")); uploadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { connect(); } }); south.add(uploadButton); JButton cancelButton = new JButton(Messages.getString("ConnectUriqaServerJDialog.cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); south.add(cancelButton); getContentPane().add(south, BorderLayout.SOUTH); // show pack(); Gfx.centerAndShowWindow(this); }
From source file:CheckBoxList.java
public CheckBoxList() { super();/*from w w w. ja va2 s. com*/ setModel(new DefaultListModel()); setCellRenderer(new CheckboxCellRenderer()); addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { int index = locationToIndex(e.getPoint()); if (index != -1) { Object obj = getModel().getElementAt(index); if (obj instanceof JCheckBox) { JCheckBox checkbox = (JCheckBox) obj; checkbox.setSelected(!checkbox.isSelected()); repaint(); } } } } ); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); }
From source file:MyData.java
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row) { JCheckBox editor = null; nodeData = getQuestionFromValue(value); if (nodeData != null) { editor = (JCheckBox) (super.getComponent()); editor.setText(nodeData.getQuestion()); editor.setSelected(nodeData.getAnswer()); }// w w w .jav a 2s . c om return editor; }
From source file:edu.gmu.cs.sim.util.media.chart.XYChartGenerator.java
protected void buildGlobalAttributes(LabelledList list) { // create the chart ((XYPlot) (chart.getPlot())).setDomainGridlinesVisible(false); ((XYPlot) (chart.getPlot())).setRangeGridlinesVisible(false); ((XYPlot) (chart.getPlot())).setDomainGridlinePaint(new Color(200, 200, 200)); ((XYPlot) (chart.getPlot())).setRangeGridlinePaint(new Color(200, 200, 200)); xLabel = new PropertyField() { public String newValue(String newValue) { setXAxisLabel(newValue);/*from w w w.j a va 2 s. co m*/ getChartPanel().repaint(); return newValue; } }; xLabel.setValue(getXAxisLabel()); list.add(new JLabel("X Label"), xLabel); yLabel = new PropertyField() { public String newValue(String newValue) { setYAxisLabel(newValue); getChartPanel().repaint(); return newValue; } }; yLabel.setValue(getYAxisLabel()); list.add(new JLabel("Y Label"), yLabel); xLog = new JCheckBox(); xLog.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (xLog.isSelected()) { LogarithmicAxis logAxis = new LogarithmicAxis(xLabel.getValue()); logAxis.setStrictValuesFlag(false); chart.getXYPlot().setDomainAxis(logAxis); } else { chart.getXYPlot().setDomainAxis(new NumberAxis(xLabel.getValue())); } } }); yLog = new JCheckBox(); yLog.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (yLog.isSelected()) { LogarithmicAxis logAxis = new LogarithmicAxis(yLabel.getValue()); logAxis.setStrictValuesFlag(false); chart.getXYPlot().setRangeAxis(logAxis); } else { chart.getXYPlot().setRangeAxis(new NumberAxis(yLabel.getValue())); } } }); Box box = Box.createHorizontalBox(); box.add(new JLabel("X")); box.add(xLog); box.add(new JLabel(" Y")); box.add(yLog); box.add(Box.createGlue()); list.add(new JLabel("Log Axis"), box); final JCheckBox xgridlines = new JCheckBox(); xgridlines.setSelected(false); ItemListener il = new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { chart.getXYPlot().setDomainGridlinesVisible(true); } else { chart.getXYPlot().setDomainGridlinesVisible(false); } } }; xgridlines.addItemListener(il); final JCheckBox ygridlines = new JCheckBox(); ygridlines.setSelected(false); il = new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { chart.getXYPlot().setRangeGridlinesVisible(true); } else { chart.getXYPlot().setRangeGridlinesVisible(false); } } }; ygridlines.addItemListener(il); box = Box.createHorizontalBox(); box.add(new JLabel("X")); box.add(xgridlines); box.add(new JLabel(" Y")); box.add(ygridlines); box.add(Box.createGlue()); list.add(new JLabel("Grid Lines"), box); }