List of usage examples for javax.swing JCheckBox isSelected
public boolean isSelected()
From source file:nz.govt.natlib.ndha.manualdeposit.StructMapFileDescManagement.java
private void initComponents() { scrlDescription = new javax.swing.JScrollPane(); lstDescription = new javax.swing.JList(); pnlDetails = new javax.swing.JPanel(); btnMoveUp = new javax.swing.JButton(); btnMoveDown = new javax.swing.JButton(); btnAddNew = new javax.swing.JButton(); btnDelete = new javax.swing.JButton(); btnSave = new javax.swing.JButton(); btnCancel = new javax.swing.JButton(); btnClose = new javax.swing.JButton(); btnGenMainDesc = new javax.swing.JButton(); setTitle("Manage Structure Map File Descriptions"); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt);//from w ww .j a va 2 s . co m } public void windowClosing(java.awt.event.WindowEvent evt) { dialogWindowClosing(evt); } }); scrlDescription.setViewportView(lstDescription); JPanel panelLayer1 = new JPanel(); panelLayer1.setAlignmentY(Component.TOP_ALIGNMENT); panel_ExtraLayers = new JPanel(); panel_ExtraLayers.setAlignmentY(Component.TOP_ALIGNMENT); panel_ExtraLayers.setMinimumSize(new Dimension(300, 0)); panel_ExtraLayers.setPreferredSize(new Dimension(300, 500)); panel_ExtraLayers.setMaximumSize(new Dimension(300, 500)); panel_ExtraLayers.setVisible(false); JLabel lblDescriptionL2 = new JLabel("Layer 2"); lblDescriptionL2.setFont(new Font("Tahoma", Font.PLAIN, 11)); JLabel lblDescription_1 = new JLabel("Description"); textfldDescriptionL2 = new JTextField(); textfldDescriptionL2.setName("DescriptionL2"); textfldDescriptionL2.setColumns(10); JLabel lblFilePrefixL2 = new JLabel("File Prefix/Suffix"); textfldFilePrefixL2 = new JTextField(); textfldFilePrefixL2.setName("FilePrefixL2"); textfldFilePrefixL2.setColumns(10); JLabel lblAllowMultiplesL2 = new JLabel("Allow Multiples?"); checkAllowMultiplesL2 = new JCheckBox(""); checkAllowMultiplesL2.setName("AllowMultiplesL2"); JLabel lblDescriptionL3 = new JLabel("Layer 3"); lblDescriptionL3.setFont(new Font("Tahoma", Font.PLAIN, 11)); JLabel lblDescription_2 = new JLabel("Description"); textfldDescriptionL3 = new JTextField(); textfldDescriptionL3.setName("DescriptionL3"); textfldDescriptionL3.setColumns(10); JLabel lblFilePrefixL3 = new JLabel("File Prefix/Suffix"); textfldFilePrefixL3 = new JTextField(); textfldFilePrefixL3.setName("FilePrefixL3"); textfldFilePrefixL3.setColumns(10); JLabel lblAllowMultiplesL3 = new JLabel("Allow Multiples?"); checkAllowMultiplesL3 = new JCheckBox(""); checkAllowMultiplesL3.setName("AllowMultiplesL3"); JLabel lblDescriptionL4 = new JLabel("Layer 4"); lblDescriptionL4.setFont(new Font("Tahoma", Font.PLAIN, 11)); JLabel lblDescription_3 = new JLabel("Description"); textfldDescriptionL4 = new JTextField(); textfldDescriptionL4.setName("DescriptionL4"); textfldDescriptionL4.setColumns(10); lblFilePrefixL4 = new JLabel("File Prefix/Suffix"); textfldFilePrefixL4 = new JTextField(); textfldFilePrefixL4.setName("FilePrefixL4"); textfldFilePrefixL4.setColumns(10); lblAllowMultiplesL4 = new JLabel("Allow Multiples?"); checkAllowMultiplesL4 = new JCheckBox(""); checkAllowMultiplesL4.setName("AllowMultiplesL4"); GroupLayout gl_panel_ExtraLayers = new GroupLayout(panel_ExtraLayers); gl_panel_ExtraLayers .setHorizontalGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_ExtraLayers.createSequentialGroup().addContainerGap() .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addComponent(lblDescriptionL2) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblDescription_1).addGap(44) .addComponent(textfldDescriptionL2, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblFilePrefixL2).addGap(18) .addComponent(textfldFilePrefixL2, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblAllowMultiplesL2).addGap(18) .addComponent(checkAllowMultiplesL2)) .addComponent(lblDescriptionL3) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addComponent(lblDescription_2) .addComponent(lblFilePrefixL3) .addComponent(lblAllowMultiplesL3)) .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addGap(21) .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addComponent(textfldFilePrefixL3, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE) .addComponent( textfldDescriptionL3, GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE))) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addGap(18) .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addComponent(textfldDescriptionL4, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE) .addGroup(gl_panel_ExtraLayers .createSequentialGroup() .addComponent(checkAllowMultiplesL3) .addPreferredGap( ComponentPlacement.RELATED, 172, Short.MAX_VALUE)))))) .addComponent(lblDescriptionL4).addComponent(lblDescription_3) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblFilePrefixL4).addGap(18) .addComponent(textfldFilePrefixL4, GroupLayout.PREFERRED_SIZE, 54, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblAllowMultiplesL4).addGap(18) .addComponent(checkAllowMultiplesL4))) .addContainerGap())); gl_panel_ExtraLayers.setVerticalGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_ExtraLayers.createSequentialGroup().addContainerGap() .addComponent(lblDescriptionL2).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription_1) .addComponent(textfldDescriptionL2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblFilePrefixL2) .addComponent(textfldFilePrefixL2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblAllowMultiplesL2).addComponent(checkAllowMultiplesL2)) .addGap(18).addComponent(lblDescriptionL3).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription_2) .addComponent(textfldDescriptionL3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblFilePrefixL3) .addComponent(textfldFilePrefixL3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addComponent(lblAllowMultiplesL3).addComponent(checkAllowMultiplesL3)) .addGap(18).addComponent(lblDescriptionL4).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription_3) .addComponent(textfldDescriptionL4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblFilePrefixL4) .addComponent(textfldFilePrefixL4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblAllowMultiplesL4).addComponent(checkAllowMultiplesL4)) .addContainerGap(39, Short.MAX_VALUE))); panel_ExtraLayers.setLayout(gl_panel_ExtraLayers); lblDescription = new JLabel(); lblDescription.setText("Description"); textfldDescription = new JTextField(); textfldDescription.setName("Description"); textfldFilePrefix = new JTextField(); textfldFilePrefix.setName("FilePrefix"); lblFilePrefix = new JLabel(); lblFilePrefix.setText("File Prefix/Suffix"); lblPosition = new JLabel(); lblPosition.setText("Position"); cmbPosition = new JComboBox(); cmbPosition.setName("Position"); lblMandatory = new JLabel(); lblMandatory.setText("Mandatory?"); checkMandatory = new JCheckBox(); checkMandatory.setName("Mandatory"); lblAllowMultiples = new JLabel(); lblAllowMultiples.setText("Allow Multiples?"); checkAllowMultiples = new JCheckBox(); checkAllowMultiples.setName("AllowMultiples"); lblExtraLayers = new JLabel("Extra Layers?"); checkExtraLayers = new JCheckBox(""); checkExtraLayers.setName("ExtraLayers"); checkExtraLayers.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { JCheckBox button = (JCheckBox) e.getSource(); if (button.isSelected()) { panel_MainDesc.setVisible(true); panel_ExtraLayers.setVisible(true); pnlDetails.revalidate(); pnlDetails.repaint(); } else { panel_MainDesc.setVisible(false); panel_ExtraLayers.setVisible(false); pnlDetails.revalidate(); pnlDetails.repaint(); } } }); GroupLayout gl_panelLayer1 = new GroupLayout(panelLayer1); gl_panelLayer1.setHorizontalGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelLayer1.createSequentialGroup().addContainerGap() .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelLayer1.createSequentialGroup() .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(lblFilePrefix).addComponent(lblDescription) .addComponent(lblPosition)) .addGap(18) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(textfldFilePrefix, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addComponent(textfldDescription, GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE) .addComponent(cmbPosition, 0, 169, Short.MAX_VALUE))) .addGroup( gl_panelLayer1.createSequentialGroup() .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(lblAllowMultiples) .addComponent(lblExtraLayers).addComponent(lblMandatory)) .addGap(18) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(checkExtraLayers).addComponent(checkMandatory) .addComponent(checkAllowMultiples)))) .addContainerGap())); gl_panelLayer1 .setVerticalGroup(gl_panelLayer1.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING, gl_panelLayer1.createSequentialGroup().addGap(24) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription) .addComponent(textfldDescription, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelLayer1 .createParallelGroup(Alignment.BASELINE).addComponent(lblFilePrefix) .addComponent(textfldFilePrefix, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.BASELINE) .addComponent(lblPosition) .addComponent(cmbPosition, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(8) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(checkMandatory).addComponent(lblMandatory)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(checkAllowMultiples).addComponent(lblAllowMultiples)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.BASELINE) .addComponent(lblExtraLayers).addComponent(checkExtraLayers)) .addContainerGap(26, Short.MAX_VALUE))); panelLayer1.setLayout(gl_panelLayer1); btnMoveUp.setPreferredSize(new java.awt.Dimension(91, 23)); btnMoveUp.setText("Move Up"); btnMoveDown.setText("Move Down"); btnAddNew.setText("Add New"); btnDelete.setText("Delete"); btnSave.setText("Save"); btnCancel.setText("Cancel"); btnClose.setText("Close"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.TRAILING).addGroup(layout.createSequentialGroup() .addComponent(scrlDescription, GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE).addGap(18) .addGroup(layout.createParallelGroup(Alignment.TRAILING) .addGroup(layout.createSequentialGroup().addComponent(btnAddNew).addGap(18) .addComponent(btnDelete, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE) .addGap(19)) .addComponent(pnlDetails, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addComponent(btnMoveUp, GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnMoveDown, GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE).addGap(89) .addComponent(btnSave, GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(btnCancel, GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(btnClose, GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup() .addComponent(pnlDetails, GroupLayout.PREFERRED_SIZE, 597, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(btnDelete) .addComponent(btnAddNew))) .addComponent(scrlDescription, GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)) .addGap(18) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(btnMoveUp, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btnMoveDown)) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(btnClose) .addComponent(btnCancel).addComponent(btnSave))) .addContainerGap())); pnlDetails.setLayout(new BoxLayout(pnlDetails, BoxLayout.Y_AXIS)); panel_MainDesc = new JPanel(); panel_MainDesc.setMinimumSize(new Dimension(300, 0)); panel_MainDesc.setPreferredSize(new Dimension(300, 60)); panel_MainDesc.setMaximumSize(new Dimension(300, 60)); panel_MainDesc.setVisible(false); lblDescriptionMain = new JLabel("Main Description"); textfldDescriptionMain = new JTextField(); textfldDescriptionMain.setName("DescriptionMain"); textfldDescriptionMain.setColumns(10); btnGenMainDesc_1 = new JButton(""); btnGenMainDesc_1.setToolTipText("Generate a main description by concatenating layer descriptions."); btnGenMainDesc_1.setContentAreaFilled(false); btnGenMainDesc_1.setIcon(new ImageIcon(StructMapFileDescManagement.class .getResource("/org/jdesktop/swingx/plaf/basic/resources/month-down.png"))); GroupLayout gl_panel_MainDesc = new GroupLayout(panel_MainDesc); gl_panel_MainDesc.setHorizontalGroup(gl_panel_MainDesc.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_MainDesc.createSequentialGroup().addContainerGap() .addComponent(lblDescriptionMain).addGap(18) .addComponent(textfldDescriptionMain, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnGenMainDesc_1, GroupLayout.PREFERRED_SIZE, 25, Short.MAX_VALUE) .addContainerGap())); gl_panel_MainDesc.setVerticalGroup(gl_panel_MainDesc.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_MainDesc.createSequentialGroup().addContainerGap().addGroup(gl_panel_MainDesc .createParallelGroup(Alignment.LEADING) .addComponent(btnGenMainDesc_1, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panel_MainDesc.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescriptionMain).addComponent(textfldDescriptionMain, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_MainDesc.setLayout(gl_panel_MainDesc); pnlDetails.add(panel_MainDesc); pnlDetails.add(panelLayer1); pnlDetails.add(panel_ExtraLayers); getContentPane().setLayout(layout); pack(); }
From source file:nz.govt.natlib.ndha.manualdeposit.StructMapFileDescMgmtPresenter.java
private HashMap<String, String> convertExtraLayersToStrings() { HashMap<String, String> extraLayersToStrings = new HashMap<String, String>(); for (Entry<String, JComponent> attr : extraLayers.entrySet()) { // If JComponent is a checkbox if (attr.getKey().startsWith("Allow")) { JCheckBox field = (JCheckBox) attr.getValue(); extraLayersToStrings.put(attr.getKey(), String.valueOf(field.isSelected())); }// w ww. ja v a 2s . c om // Else it is a text field else { JTextField field = (JTextField) attr.getValue(); extraLayersToStrings.put(attr.getKey(), field.getText()); } } return extraLayersToStrings; }
From source file:nz.govt.natlib.ndha.manualdeposit.StructMapFileDescMgmtPresenter.java
private boolean valuesChangedExtraLayers(HashMap<String, String> extraLayers) { for (Entry<String, JComponent> attr : this.extraLayers.entrySet()) { String value = extraLayers.get(attr.getKey()); // If JComponent is a checkbox if (attr.getKey().startsWith("Allow")) { JCheckBox field = (JCheckBox) attr.getValue(); if (value == null) { if (field.isSelected()) return true; } else { if (Boolean.parseBoolean(value) != field.isSelected()) return true; }/*from w w w .j av a 2 s . com*/ } // Else it is a text field else { JTextField field = (JTextField) attr.getValue(); if (value == null) { if (!field.getText().equals("")) return true; } else { if (!value.equals(field.getText())) return true; } } } return false; }
From source file:op.controlling.PnlControlling.java
private JPanel createContentPanel4Hygiene() { JPanel pnlContent = new JPanel(new VerticalLayout()); JPanel pnlPrevalence = new JPanel(new BorderLayout()); final JButton btnPrevalence = GUITools.createHyperlinkButton("opde.controlling.hygiene.prevalence", null, null);/*w w w. j a v a2 s. c o m*/ final JDateChooser jdc = new JDateChooser(new Date()); final JCheckBox cbAnonymous = new JCheckBox(SYSTools.xx("misc.msg.anon")); cbAnonymous.setSelected(true); jdc.setMaxSelectableDate(new Date()); btnPrevalence.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { OPDE.getMainframe().setBlocked(true); SwingWorker worker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { MREPrevalenceSheets mre = new MREPrevalenceSheets(new LocalDate(), cbAnonymous.isSelected(), progressClosure); return mre.createSheet(); } @Override protected void done() { try { File source = (File) get(); Object[] options = { SYSTools.xx("prevalence.optiondialog.option1"), SYSTools.xx("prevalence.optiondialog.option2"), SYSTools.xx("opde.wizards.buttontext.cancel") }; int n = JOptionPane.showOptionDialog(OPDE.getMainframe(), SYSTools.xx("prevalence.optiondialog.question"), SYSTools.xx("prevalence.optiondialog.title"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]); File copyTargetDirectory = null; if (n == 1) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("title"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setMultiSelectionEnabled(false); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(pnlPrevalence) == JFileChooser.APPROVE_OPTION) { copyTargetDirectory = chooser.getSelectedFile(); } } if (copyTargetDirectory != null) { FileUtils.copyFile(source, copyTargetDirectory); } else { if (n == 0) { SYSFilesTools.handleFile((File) get(), Desktop.Action.OPEN); } } } catch (Exception e) { OPDE.fatal(e); } OPDE.getDisplayManager().setProgressBarMessage(null); OPDE.getMainframe().setBlocked(false); } }; worker.execute(); } }); pnlPrevalence.add(btnPrevalence, BorderLayout.WEST); JPanel optionPanel = new JPanel(); optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.LINE_AXIS)); optionPanel.add(cbAnonymous); optionPanel.add(jdc); pnlPrevalence.add(optionPanel, BorderLayout.EAST); pnlContent.add(pnlPrevalence); return pnlContent; }
From source file:org.accretegb.modules.phenotype.PhenotypeInfoPanel.java
public ArrayList<String> getSelectedParameters() { ArrayList<String> parameters = new ArrayList<String>(); for (JCheckBox b : parametersCheckBoxes) { if (b.isSelected()) { parameters.add(b.getText()); }//from w w w . j ava 2s. co m } return parameters; }
From source file:org.codinjutsu.tools.jenkins.view.BuildParamDialog.java
private Map<String, String> getParamValueMap() {//TODO transformer en visiteur HashMap<String, String> valueByNameMap = new HashMap<String, String>(); for (Map.Entry<JobParameter, JComponent> inputFieldByParameter : inputFieldByParameterMap.entrySet()) { JobParameter jobParameter = inputFieldByParameter.getKey(); String name = jobParameter.getName(); JobParameter.JobParameterType jobParameterType = jobParameter.getJobParameterType(); JComponent inputField = inputFieldByParameter.getValue(); if (JobParameter.JobParameterType.ChoiceParameterDefinition.equals(jobParameterType)) { JComboBox comboBox = (JComboBox) inputField; valueByNameMap.put(name, String.valueOf(comboBox.getSelectedItem())); } else if (JobParameter.JobParameterType.BooleanParameterDefinition.equals(jobParameterType)) { JCheckBox checkBox = (JCheckBox) inputField; valueByNameMap.put(name, Boolean.toString(checkBox.isSelected())); } else if (JobParameter.JobParameterType.StringParameterDefinition.equals(jobParameterType)) { JTextField textField = (JTextField) inputField; valueByNameMap.put(name, textField.getText()); }// ww w. j a v a 2s . co m } return valueByNameMap; }
From source file:org.columba.mail.main.MailMain.java
private void checkDefaultClient() { // Check if Columba is the default mail client SystemDefaultMailClientHandler defaultClientHandler = new SystemDefaultMailClientHandler(); IDefaultItem item = new DefaultItem(MailConfig.getInstance().get("options")); boolean checkDefault = item.getBooleanWithDefault("options/defaultclient", "check", true); if (checkDefault && defaultClientHandler.platfromSupportsDefaultMailClient()) { if (!defaultClientHandler.isDefaultMailClient()) { JPanel panel = new JPanel(new BorderLayout(0, 10)); panel.add(/*from www. j a va 2s. com*/ new MultiLineLabel(MailResourceLoader.getString("dialog", "defaultclient", "make_default")), BorderLayout.NORTH); JCheckBox askAgain = new JCheckBox( MailResourceLoader.getString("dialog", "defaultclient", "ask_no_more")); panel.add(askAgain, BorderLayout.CENTER); // Some error in the client/server communication // --> fall back to default login process // @author hubms: wait until the first frame is displayable // fix for bug [#CA-177] while (!(FrameManager.getInstance().getActiveFrame().isDisplayable())) { try { Thread.sleep(100); } catch (InterruptedException e) { LOG.severe(e.getMessage()); } } // fix for bug [#CA-199] java 1.6.0-b105 trick if (!FrameManager.getInstance().getActiveFrame().isValid()) FrameManager.getInstance().getActiveFrame().doLayout(); int result = JOptionPane.showConfirmDialog(FrameManager.getInstance().getActiveFrame(), panel, MailResourceLoader.getString("dialog", "defaultclient", "title"), JOptionPane.YES_NO_OPTION); if (result == JOptionPane.OK_OPTION) { defaultClientHandler.setDefaultMailClient(); } item.setBoolean("options/defaultclient", "check", !askAgain.isSelected()); } } }
From source file:org.datacleaner.widgets.properties.AbstractMultipleCheckboxesPropertyWidget.java
@Override public boolean isSet() { for (JCheckBox checkBox : getCheckBoxes()) { if (checkBox.isSelected()) { return true; }/*www . ja v a2 s . c om*/ } return false; }
From source file:org.datacleaner.widgets.properties.MultipleInputColumnsPropertyWidget.java
@Override public boolean isSet() { for (JCheckBox checkBox : _checkBoxes.values()) { if (checkBox.isSelected()) { return true; }/*w w w . ja va2s .c o m*/ } return false; }
From source file:org.formic.wizard.step.gui.FeatureListStep.java
/** * {@inheritDoc}/* w w w.ja v a 2 s . c o m*/ * @see org.formic.wizard.step.GuiStep#init() */ public Component init() { featureInfo = new JEditorPane("text/html", StringUtils.EMPTY); featureInfo.setEditable(false); featureInfo.addHyperlinkListener(new HyperlinkListener()); Feature[] features = provider.getFeatures(); JTable table = new JTable(features.length, 1) { private static final long serialVersionUID = 1L; public Class getColumnClass(int column) { return getValueAt(0, column).getClass(); } public boolean isCellEditable(int row, int column) { return false; } }; table.setBackground(new javax.swing.JList().getBackground()); GuiForm form = createForm(); for (int ii = 0; ii < features.length; ii++) { final Feature feature = (Feature) features[ii]; final JCheckBox box = new JCheckBox(); String name = getName() + '.' + feature.getKey(); form.bind(name, box); box.putClientProperty("feature", feature); featureMap.put(feature.getKey(), box); if (feature.getInfo() == null) { feature.setInfo(Installer.getString(getName() + "." + feature.getKey() + ".html")); } feature.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (Feature.ENABLED_PROPERTY.equals(event.getPropertyName())) { if (box.isSelected() != feature.isEnabled()) { box.setSelected(feature.isEnabled()); } } } }); box.setText(Installer.getString(name)); box.setBackground(table.getBackground()); if (!feature.isAvailable()) { box.setSelected(false); box.setEnabled(false); } table.setValueAt(box, ii, 0); } FeatureListMouseListener mouseListener = new FeatureListMouseListener(); for (int ii = 0; ii < features.length; ii++) { Feature feature = (Feature) features[ii]; if (feature.isEnabled() && feature.isAvailable()) { JCheckBox box = (JCheckBox) featureMap.get(feature.getKey()); box.setSelected(true); mouseListener.processDependencies(feature); mouseListener.processExclusives(feature); } } table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setShowHorizontalLines(false); table.setShowVerticalLines(false); table.setDefaultRenderer(JCheckBox.class, new ComponentTableCellRenderer()); table.addKeyListener(new FeatureListKeyListener()); table.addMouseListener(mouseListener); table.getSelectionModel().addListSelectionListener(new FeatureListSelectionListener(table)); table.setRowSelectionInterval(0, 0); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JPanel container = new JPanel(new BorderLayout()); container.add(table, BorderLayout.CENTER); panel.add(new JScrollPane(container), BorderLayout.CENTER); JScrollPane infoScroll = new JScrollPane(featureInfo); infoScroll.setMinimumSize(new Dimension(0, 50)); infoScroll.setMaximumSize(new Dimension(0, 50)); infoScroll.setPreferredSize(new Dimension(0, 50)); panel.add(infoScroll, BorderLayout.SOUTH); return panel; }