List of usage examples for javax.swing JCheckBox JCheckBox
public JCheckBox()
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);//ww w . jav a 2 s. com 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); }
From source file:ca.phon.app.session.editor.TranscriberSelectionDialog.java
/** Init display and listeners */ private void initDialog() { // setup layout // layout will be seperated into two sections, existing // and new transcripts FormLayout outerLayout = new FormLayout("3dlu, pref, right:pref:grow, 3dlu", "pref, 3dlu, top:pref:noGrow, 3dlu, pref, 3dlu, fill:pref:grow, 3dlu, pref"); this.getContentPane().setLayout(outerLayout); // create the 'new' panel first FormLayout newLayout = new FormLayout("left:pref:noGrow, 3dlu, fill:pref:grow", "bottom:pref:noGrow, 3dlu, bottom:pref:noGrow, 3dlu, bottom:pref:noGrow, 3dlu, bottom:pref:noGrow, 3dlu, bottom:pref:noGrow, fill:pref:grow"); JPanel newPanel = new JPanel(newLayout); this.newTranscriptButton = new JRadioButton(); this.newTranscriptButton.setText("New Transcriber"); this.newTranscriptButton.setSelected(true); this.newTranscriptButton.addActionListener(new ActionListener() { @Override//w w w . java2 s . c o m public void actionPerformed(ActionEvent arg0) { realNameField.setEnabled(true); usernameField.setEnabled(true); passwordRequiredBox.setEnabled(true); if (passwordRequiredBox.isSelected()) { passwordField.setEnabled(true); checkField.setEnabled(true); } existingUserList.setEnabled(false); } }); this.existingTranscriptButton = new JRadioButton(); this.existingTranscriptButton.setText("Existing Transcriber"); this.existingTranscriptButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { realNameField.setEnabled(false); usernameField.setEnabled(false); passwordRequiredBox.setEnabled(false); passwordField.setEnabled(false); checkField.setEnabled(false); existingUserList.setEnabled(true); } }); ButtonGroup bg = new ButtonGroup(); bg.add(this.newTranscriptButton); bg.add(this.existingTranscriptButton); this.realNameField = new JTextField(); this.usernameField = new JTextField(); this.passwordRequiredBox = new JCheckBox(); this.passwordRequiredBox.setText("Use password"); this.passwordRequiredBox.setSelected(false); this.passwordRequiredBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { passwordField.setEnabled(passwordRequiredBox.isSelected()); checkField.setEnabled(passwordRequiredBox.isSelected()); } }); this.passwordField = new JPasswordField(); this.passwordField.setEnabled(false); this.checkField = new JPasswordField(); this.checkField.setEnabled(false); CellConstraints cc = new CellConstraints(); newPanel.add(new JLabel("Full Name:"), cc.xy(1, 1)); newPanel.add(this.realNameField, cc.xy(3, 1)); newPanel.add(new JLabel("Username:"), cc.xy(1, 3)); newPanel.add(this.usernameField, cc.xy(3, 3)); newPanel.add(this.passwordRequiredBox, cc.xyw(1, 5, 3)); newPanel.add(new JLabel("Password:"), cc.xy(1, 7)); newPanel.add(this.passwordField, cc.xy(3, 7)); newPanel.add(this.checkField, cc.xy(3, 9)); // create the 'existing' panel FormLayout existingLayout = new FormLayout( // just a list "fill:pref:grow", "fill:pref:grow"); JPanel existingPanel = new JPanel(existingLayout); List<String> existingUserData = new ArrayList<String>(); for (Transcriber t : session.getTranscribers()) existingUserData.add(t.getRealName() + " - " + t.getUsername()); this.existingUserList = new JList(existingUserData.toArray()); this.existingUserList.setEnabled(false); existingPanel.add(this.existingUserList, cc.xy(1, 1)); // create the button panel this.okButton = new JButton("OK"); this.okButton.setDefaultCapable(true); this.okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (checkDialog()) { okHandler(); } } }); getRootPane().setDefaultButton(okButton); this.cancelButton = new JButton("Cancel"); this.cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { cancelHandler(); } }); final JComponent bar = ButtonBarBuilder.buildOkCancelBar(okButton, cancelButton); this.getContentPane().add(bar, cc.xy(3, 9)); this.getContentPane().add(this.newTranscriptButton, cc.xy(2, 1)); this.getContentPane().add(newPanel, cc.xyw(2, 3, 2)); this.getContentPane().add(this.existingTranscriptButton, cc.xy(2, 5)); this.getContentPane().add(new JScrollPane(existingPanel), cc.xyw(2, 7, 2)); }
From source file: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);// ww w .jav a 2 s . com 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); }
From source file:de.atomfrede.tools.evalutation.options.ui.OptionsDialog.java
private JCheckBox getRecordReferenceChambersCheckbox() { if (recordReferenceValveCheckbox == null) { recordReferenceValveCheckbox = new JCheckBox(); recordReferenceValveCheckbox.setText(Messages.getString("OptionsDialog.2")); //$NON-NLS-1$ recordReferenceValveCheckbox.setSelected(TypeAEvaluationOptions.isRecordReferenceValve()); }//from w w w. j a v a2 s . c o m return recordReferenceValveCheckbox; }
From source file:net.pms.movieinfo.MovieInfo.java
@Override public JComponent config() { FormLayout layout = new FormLayout( "left:pref, 2dlu, p,2dlu, p,2dlu, p, 2dlu, p, 2dlu, p,2dlu, p,200dlu, pref:grow", //$NON-NLS-1$ "p, 5dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p,0:grow"); //$NON-NLS-1$ PanelBuilder builder = new PanelBuilder(layout); builder.border(Borders.EMPTY);/*w w w.j a va 2 s .co m*/ builder.opaque(false); CellConstraints cc = new CellConstraints(); JComponent cmp = builder.addSeparator("MOVIE INFO CONFIG", cc.xy(1, 1)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); pluginsField = new JTextField(); pluginsField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented if (configuration.getPlugins() != null) pluginsField.setText(configuration.getPlugins()); pluginsField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { configuration.setPlugins(pluginsField.getText()); } }); builder.addLabel("Plugins to use (in prioritized order):", cc.xy(1, 3)); builder.add(pluginsField, cc.xyw(3, 3, 12)); maxNumberOfActorsField = new JSpinner(new SpinnerNumberModel()); maxNumberOfActorsField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented maxNumberOfActorsField.setValue(configuration.getMaxNumberOfActors()); maxNumberOfActorsField.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { configuration.setMaxNumberOfActors((Integer) maxNumberOfActorsField.getValue()); } }); builder.addLabel("Maximum number of actors to display:", cc.xy(1, 5)); builder.add(maxNumberOfActorsField, cc.xy(3, 5)); downloadCoverField = new JCheckBox(); downloadCoverField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented downloadCoverField.setSelected(configuration.getDownloadCover()); downloadCoverField.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { configuration.setDownloadCover(downloadCoverField.isSelected()); } }); builder.addLabel("Download cover to movie folder:", cc.xy(5, 5)); builder.add(downloadCoverField, cc.xy(7, 5)); displayInfoField = new JTextField(); displayInfoField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented if (configuration.getDisplayInfo() != null) { displayInfoField.setText(configuration.getDisplayInfoAsString()); } displayInfoField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //TODO: Needs verification logics configuration.setDisplayInfoFromString(displayInfoField.getText()); } }); builder.addLabel("DisplayInfo:", cc.xy(13, 5)); builder.add(displayInfoField, cc.xyw(14, 5, 2)); plotLineLengthField = new JSpinner(new SpinnerNumberModel()); plotLineLengthField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented plotLineLengthField.setValue(configuration.getPlotLineLength()); plotLineLengthField.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { configuration.setPlotLineLength((Integer) plotLineLengthField.getValue()); } }); builder.addLabel("Plot line length:", cc.xy(9, 5)); builder.add(plotLineLengthField, cc.xy(11, 5)); filterField = new JTextField(); filterField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented if (configuration.getFilters() != null) { filterField.setText(configuration.getFiltersAsString()); } filterField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //TODO: Needs verification logics configuration.setFiltersFromString(filterField.getText()); } }); ScanPath = new JTextField(); builder.addLabel("Filter:", cc.xy(1, 7)); builder.add(filterField, cc.xyw(3, 7, 12)); builder.addLabel("Scan path:", cc.xy(1, 9)); builder.add(ScanPath, cc.xyw(3, 9, 12)); ScanPath.setText((String) PMS.getConfiguration().getCustomProperty("movieinfo.scan_path")); JButton scan = new JButton("Scan files"); scan.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (mdb != null) { if (!mdb.isScanLibraryRunning()) { int option = JOptionPane.showConfirmDialog(LooksFrame.get(), Messages.getString("FoldTab.3") + Messages.getString("FoldTab.4"), Messages.getString("Dialog.Question"), JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { mdb.scanLibrary(ScanPath.getText()); } } else { int option = JOptionPane.showConfirmDialog(LooksFrame.get(), Messages.getString("FoldTab.10"), Messages.getString("Dialog.Question"), JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { mdb.stopScanLibrary(); } } } } }); builder.add(scan, cc.xy(1, 11)); return builder.getPanel(); }
From source file:gtu._work.ui.ObnfInsertCreaterUI.java
private void initGUI() { try {//from w w w . j a v a 2 s .c o m JCommonUtil.defaultToolTipDelay(); BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); jTabbedPane1.addTab("?schema", null, jPanel1, null); { jLabel1 = new JLabel(); jPanel1.add(jLabel1); jLabel1.setText("tableName"); } { tableNameText = new JTextField(); jPanel1.add(tableNameText); tableNameText.setPreferredSize(new java.awt.Dimension(155, 22)); } { useDomainJarDefineChkBox = new JCheckBox(); jPanel1.add(useDomainJarDefineChkBox); useDomainJarDefineChkBox.setText("\u4ee5dominJar\u70ba\u6e96"); } { dominJarFileText = new JTextField(); File currentFile = new File(PropertiesUtil.getJarCurrentPath(getClass()), "sris-db-domain-2.5.0-SRIS-SNAPSHOT.jar"); if (currentFile.exists()) { dominJarFileText.setText(currentFile.getAbsolutePath()); } else { File cUserFile = new File("C:\\Users"); if (cUserFile.exists()) { String domainJarPath = "C:/Users/%s/.m2/repository/tw/gov/sris-db-domain/2.5.0-SRIS-SNAPSHOT/sris-db-domain-2.5.0-SRIS-SNAPSHOT.jar"; for (File f : cUserFile.listFiles()) { File jf = new File(String.format(domainJarPath, f.getName())); if (jf.exists()) { dominJarFileText.setText(jf.getAbsolutePath()); break; } } } } jPanel1.add(dominJarFileText); dominJarFileText.setPreferredSize(new java.awt.Dimension(219, 22)); JCommonUtil.jTextFieldSetFilePathMouseEvent(dominJarFileText, false); } { jLabel5 = new JLabel(); jPanel1.add(jLabel5); jLabel5.setText("obnfString"); jLabel5.setPreferredSize(new java.awt.Dimension(83, 15)); } { jScrollPane2 = new JScrollPane(); jPanel1.add(jScrollPane2); jScrollPane2.setPreferredSize(new java.awt.Dimension(544, 76)); { obnfArea = new JTextArea(); jScrollPane2.setViewportView(obnfArea); } } { jLabel6 = new JLabel(); jPanel1.add(jLabel6); jLabel6.setText("sql"); jLabel6.setPreferredSize(new java.awt.Dimension(58, 15)); } { jScrollPane3 = new JScrollPane(); jPanel1.add(jScrollPane3); jScrollPane3.setPreferredSize(new java.awt.Dimension(543, 116)); { insertSqlArea = new JTextArea(); jScrollPane3.setViewportView(insertSqlArea); } } { executeBtn = new JButton(); jPanel1.add(executeBtn); executeBtn.setText("\u8b80\u53d6ObnfString"); executeBtn.setPreferredSize(new java.awt.Dimension(146, 29)); executeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { executeBtnAction(); } }); } { processSqlBtn = new JButton(); jPanel1.add(processSqlBtn); processSqlBtn.setText("\u7522\u751fSQL"); processSqlBtn.setPreferredSize(new java.awt.Dimension(135, 29)); processSqlBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { processSqlBtnAction(); } }); } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("?", null, jPanel2, null); { jPanel3 = new JPanel(); jPanel2.add(jPanel3, BorderLayout.NORTH); jPanel3.setPreferredSize(new java.awt.Dimension(585, 61)); { jLabel4 = new JLabel(); jPanel3.add(jLabel4); jLabel4.setText("dbField"); } { dbFieldText = new JTextField(); jPanel3.add(dbFieldText); dbFieldText.setPreferredSize(new java.awt.Dimension(216, 22)); } { jLabel3 = new JLabel(); jPanel3.add(jLabel3); jLabel3.setText("value"); } { dbValue = new JTextField(); jPanel3.add(dbValue); dbValue.setPreferredSize(new java.awt.Dimension(244, 22)); } { pkCheckBox = new JCheckBox(); jPanel3.add(pkCheckBox); pkCheckBox.setText("\u662fPK"); } { addFieldBtn = new JButton(); jPanel3.add(addFieldBtn); addFieldBtn.setText("saveOrUpdate"); addFieldBtn.setPreferredSize(new java.awt.Dimension(116, 22)); addFieldBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { addFieldBtnAction(); } }); } { deleteFieldBtn = new JButton(); jPanel3.add(deleteFieldBtn); deleteFieldBtn.setText("delete"); deleteFieldBtn.setPreferredSize(new java.awt.Dimension(88, 22)); deleteFieldBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { deleteFieldBtnAction(); } }); } } { jScrollPane1 = new JScrollPane(); jPanel2.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(585, 258)); { DefaultListModel dbFieldListModel = new DefaultListModel(); dbFieldList = new JList(); jScrollPane1.setViewportView(dbFieldList); dbFieldList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { dbFieldListMousePreformd(evt); } }); dbFieldList.setModel(dbFieldListModel); dbFieldList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { JListUtil.newInstance(dbFieldList).defaultJListKeyPressed(evt); } }); } } } { jPanel4 = new JPanel(); GridLayout jPanel4Layout = new GridLayout(1, 1); jPanel4Layout.setColumns(1); jPanel4Layout.setHgap(5); jPanel4Layout.setVgap(5); jPanel4.setLayout(jPanel4Layout); jTabbedPane1.addTab("?", null, jPanel4, null); { manualDefineArea = new JTextArea(); jPanel4.add(manualDefineArea); manualDefineArea.setText(""); manualDefineArea.setToolTipText("?"); } { manualDefinePkArea = new JTextArea(); jPanel4.add(manualDefinePkArea); manualDefinePkArea.setText(""); manualDefinePkArea.setToolTipText("PK?"); } { manualDefineDbFieldBtn = new JButton(); jPanel4.add(manualDefineDbFieldBtn); manualDefineDbFieldBtn .setText("\u4ee5\u8cbc\u5165\u6b04\u4f4d\u5b9a\u7fa9\u6c7a\u5b9a\u6b04\u4f4d"); manualDefineDbFieldBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { manualDefineDbFieldBtnAction(); } }); } } } pack(); this.setSize(598, 366); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }
From source file:com.stefanbrenner.droplet.utils.UiUtilsTest.java
@Test public void testSetEnabled() { JPanel testPanel = new JPanel(); JButton btnTest = new JButton(); testPanel.add(btnTest);/*from w w w .j a v a 2s . c om*/ JTextField txtTest = new JTextField(); testPanel.add(txtTest); JPanel testPanel2 = new JPanel(); JCheckBox chTest = new JCheckBox(); testPanel2.add(chTest); testPanel.add(testPanel2); List<JComponent> allComps = Arrays .asList(new JComponent[] { testPanel, btnTest, txtTest, testPanel2, chTest }); List<JComponent> childComps = Arrays.asList(new JComponent[] { testPanel, btnTest, txtTest, testPanel2 }); // disable all components UiUtils.setEnabled(testPanel, false); for (JComponent comp : allComps) { if (childComps.contains(comp)) { assertEquals(false, comp.isEnabled()); } else { assertEquals(true, comp.isEnabled()); } } // re-enable all components UiUtils.setEnabled(testPanel, true); for (JComponent comp : allComps) { assertEquals(true, comp.isEnabled()); } // disable all except txtTest UiUtils.setEnabled(testPanel, false, txtTest); for (JComponent comp : allComps) { if (childComps.contains(comp) && ObjectUtils.notEqual(comp, txtTest)) { assertEquals(false, comp.isEnabled()); } else { assertEquals(true, comp.isEnabled()); } } // re-enable all components UiUtils.setEnabled(testPanel, true); for (JComponent comp : allComps) { assertEquals(true, comp.isEnabled()); } // disable all except chTest in testPanel2 UiUtils.setEnabled(testPanel, false, chTest); for (JComponent comp : allComps) { if (childComps.contains(comp) && ObjectUtils.notEqual(comp, chTest)) { assertEquals(false, comp.isEnabled()); } else { assertEquals(true, comp.isEnabled()); } } // re-enable all components UiUtils.setEnabled(testPanel, true); for (JComponent comp : allComps) { assertEquals(true, comp.isEnabled()); } // disable all except txtTest in testPanel and chTest in testPanel2 JComponent[] except = new JComponent[] { txtTest, chTest }; UiUtils.setEnabled(testPanel, false, except); for (JComponent comp : allComps) { if (childComps.contains(comp) && !Arrays.asList(except).contains(comp)) { assertEquals(false, comp.isEnabled()); } else { assertEquals(true, comp.isEnabled()); } } // re-enable all components UiUtils.setEnabled(testPanel, true); for (JComponent comp : allComps) { assertEquals(true, comp.isEnabled()); } }
From source file:biomine.bmvis2.pipeline.BestPathHiderOperation.java
public JComponent getSettingsComponent(final SettingsChangeCallback settingsChangeCallback, final VisualGraph graph) { long nodeCount = graph.getAllNodes().size(); if (oldCount != 0) { long newTarget = (target * nodeCount) / oldCount; this.target = Math.max(newTarget, target); } else//from ww w . ja va2 s . c o m this.target = nodeCount; this.oldCount = nodeCount; JPanel ret = new JPanel(); // if int overflows, we're fucked final JSlider sl = new JSlider(0, (int) nodeCount, (int) Math.min(target, nodeCount)); sl.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { if (target == sl.getValue()) return; target = sl.getValue(); settingsChangeCallback.settingsChanged(false); } }); ret.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; //c.gridwidth=2; ret.add(sl, c); c.gridy++; int choices = graph.getNodesOfInterest().size() + 1; Object[] items = new Object[choices]; items[0] = "All PoIs"; for (int i = 1; i < choices; i++) { items[i] = i + " nearest"; } final JComboBox pathTypeBox = new JComboBox(items); pathTypeBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int i = pathTypeBox.getSelectedIndex(); grader.setPathK(i); settingsChangeCallback.settingsChanged(false); } }); ret.add(new JLabel("hide by best path quality to:"), c); c.gridy++; ret.add(pathTypeBox, c); c.gridy++; System.out.println("new confpane nodeCount = " + nodeCount); final JCheckBox useMatchingColoring = new JCheckBox(); ret.add(useMatchingColoring, c); useMatchingColoring.setAction(new AbstractAction("Use matching coloring") { public void actionPerformed(ActionEvent arg0) { matchColoring = useMatchingColoring.isSelected(); settingsChangeCallback.settingsChanged(false); } }); useMatchingColoring.setAlignmentX(JComponent.CENTER_ALIGNMENT); c.gridy++; final JCheckBox labelsBox = new JCheckBox(); ret.add(labelsBox, c); labelsBox.setAction(new AbstractAction("Show goodness in node labels") { public void actionPerformed(ActionEvent arg0) { showLabel = labelsBox.isSelected(); settingsChangeCallback.settingsChanged(false); } }); return ret; }
From source file:de.atomfrede.tools.evalutation.options.ui.OptionsDialog.java
private JCheckBox getShiftByOneHourCheckBox() { if (shiftByOneHourCheckBox == null) { shiftByOneHourCheckBox = new JCheckBox(); shiftByOneHourCheckBox.setText(Messages.getString("OptionsDialog.1")); //$NON-NLS-1$ shiftByOneHourCheckBox.setSelected(TypeAEvaluationOptions.isShiftByOneHour()); }//from ww w . j a v a 2s . com return shiftByOneHourCheckBox; }
From source file:com.microsoft.alm.plugin.idea.git.ui.branch.CreateBranchForm.java
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL//from w w w . j a v a 2 s . com */ private void $$$setupUI$$$() { contentPanel = new JPanel(); contentPanel.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1)); nameLabel = new JLabel(); this.$$$loadLabelText$$$(nameLabel, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin") .getString("CreateBranchDialog.NameLabel")); contentPanel.add(nameLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); remoteBranchComboBox = new JComboBox(); contentPanel.add(remoteBranchComboBox, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); nameTextField = new JTextField(); contentPanel.add(nameTextField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); basedOn = new JLabel(); this.$$$loadLabelText$$$(basedOn, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin") .getString("CreateBranchDialog.BasedOn")); contentPanel.add(basedOn, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); checkoutBranch = new JCheckBox(); checkoutBranch.setSelected(true); this.$$$loadButtonText$$$(checkoutBranch, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin") .getString("CreateBranchDialog.CheckoutBranch")); contentPanel.add(checkoutBranch, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); }