List of usage examples for java.awt.event ItemEvent getItem
public Object getItem()
From source file:Statement.Statement.java
private void cbShopIDItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbShopIDItemStateChanged cbShopID = (JComboBox) evt.getSource(); code = "" + evt.getItem(); if (evt.getStateChange() == java.awt.event.ItemEvent.SELECTED) { loadRevenue();//from w w w. jav a2 s . c o m loadExpense(); } else if (evt.getStateChange() == java.awt.event.ItemEvent.DESELECTED) { evaluator.list.clear(); } }
From source file:org.geopublishing.atlasStyler.swing.PolygonSymbolEditGUI.java
/** * This method initializes jComboBox/*from w w w . j a v a 2s . c o m*/ * * This {@link JComboBox} has the same Model as the FillOpacity * * @return javax.swing.JComboBox */ private JComboBox getJComboBoxFillGraphicOpacity() { if (jComboBoxGraphicFillOpacity == null) { jComboBoxGraphicFillOpacity = new OpacityJComboBox(); // Initialize correctly boolean enabled = (symbolizer.getFill() != null && symbolizer.getFill().getGraphicFill() != null); jComboBoxGraphicFillOpacity.setEnabled(enabled); jLabelGraphicFillOpacity.setEnabled(enabled); // This {@link JComboBox} has the same Model as the // FillOpacityCOmboBox jComboBoxGraphicFillOpacity.setModel(getJComboBoxFillOpacity().getModel()); final Fill ff = symbolizer.getFill(); if (ff != null) { ASUtil.selectOrInsert(jComboBoxGraphicFillOpacity, ff.getOpacity()); } jComboBoxGraphicFillOpacity.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { symbolizer.getFill().setOpacity(ASUtil.ff2.literal(e.getItem())); firePropertyChange(PROPERTY_UPDATED, null, null); } } }); SwingUtil.addMouseWheelForCombobox(jComboBoxGraphicFillOpacity); } return jComboBoxGraphicFillOpacity; }
From source file:org.geopublishing.atlasStyler.swing.PolygonSymbolEditGUI.java
/** * This method initializes jComboBox1//from w w w . j av a2s. co m * * @return javax.swing.JComboBox */ private JComboBox getJComboBoxFillOpacity() { if (jComboBoxFillOpacity == null) { jComboBoxFillOpacity = new OpacityJComboBox(); jComboBoxFillOpacity.setModel(new DefaultComboBoxModel(OPACITY_VALUES)); Fill ff = symbolizer.getFill(); if (ff != null) { if (ff.getOpacity() == null) ff.setOpacity(ASUtil.ff2.literal(1f)); ASUtil.selectOrInsert(jComboBoxFillOpacity, ff.getOpacity()); } // Initialize the enabled state boolean enabled = (symbolizer.getFill() != null && symbolizer.getFill().getGraphicFill() != null); jComboBoxFillOpacity.setEnabled(enabled); jLabelFillOpacity.setEnabled(enabled); jComboBoxFillOpacity.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { symbolizer.getFill().setOpacity(ASUtil.ff2.literal(e.getItem())); firePropertyChange(PROPERTY_UPDATED, null, null); } } }); SwingUtil.addMouseWheelForCombobox(jComboBoxFillOpacity); } return jComboBoxFillOpacity; }
From source file:org.geopublishing.atlasStyler.swing.PolygonSymbolEditGUI.java
/** * This method initializes jComboBox1/*from ww w . j a v a 2 s. c o m*/ * * @return javax.swing.JComboBox */ private JComboBox getJComboBoxStrokeOpacity() { if (jComboBoxStrokeOpacity == null) { jComboBoxStrokeOpacity = new OpacityJComboBox(); jComboBoxStrokeOpacity.setModel(new DefaultComboBoxModel(OPACITY_VALUES)); if (symbolizer.getStroke() != null) { // We have a stroke, so now we need opacity if (symbolizer.getStroke().getOpacity() == null) { symbolizer.getStroke().setOpacity(ASUtil.ff2.literal("1.")); } ASUtil.selectOrInsert(jComboBoxStrokeOpacity, symbolizer.getStroke().getOpacity()); } else { jComboBoxStrokeOpacity.setEnabled(false); } jComboBoxStrokeOpacity.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { symbolizer.getStroke().setOpacity(ASUtil.ff2.literal(e.getItem())); PolygonSymbolEditGUI.this.firePropertyChange(PROPERTY_UPDATED, null, null); } } }); SwingUtil.addMouseWheelForCombobox(jComboBoxStrokeOpacity); } return jComboBoxStrokeOpacity; }
From source file:org.geopublishing.atlasStyler.swing.PolygonSymbolEditGUI.java
/** * This method initializes jComboBox1/*from w w w.j av a 2 s.c o m*/ * * @return javax.swing.JComboBox */ private JComboBox getJComboBoxStrokeWidth() { if (jComboBoxStrokeWidth == null) { jComboBoxStrokeWidth = new JComboBox(); jComboBoxStrokeWidth.setModel(new DefaultComboBoxModel(WIDTH_VALUES)); jComboBoxStrokeWidth.setRenderer(WIDTH_VALUES_RENDERER); // TODO .. might not be in list... Stroke s = symbolizer.getStroke(); if (s != null) if (s.getWidth() == null) { // Having a Stroke but no StrokeWidth doesn't make sense. s.setWidth(ASUtil.ff2.literal("1.")); } else { ASUtil.selectOrInsert(jComboBoxStrokeWidth, s.getWidth()); } else { jComboBoxStrokeWidth.setEnabled(false); } jComboBoxStrokeWidth.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { symbolizer.getStroke().setWidth(ASUtil.ff2.literal(e.getItem())); PolygonSymbolEditGUI.this.firePropertyChange(PROPERTY_UPDATED, null, null); } } }); SwingUtil.addMouseWheelForCombobox(jComboBoxStrokeWidth); } return jComboBoxStrokeWidth; }
From source file:org.apache.oodt.cas.workflow.gui.perspective.view.impl.DefaultPropView.java
private JPanel getExecutionTypePanel(final ModelGraph graph, final ViewState state) { JPanel panel = new JPanel(); panel.setBorder(new EtchedBorder()); panel.setLayout(new BorderLayout()); panel.add(new JLabel("ExecutionType:"), BorderLayout.WEST); JComboBox comboBox = new JComboBox(); if (graph.hasChildren()) { comboBox.addItem("parallel"); comboBox.addItem("sequential"); } else if (graph.getModel().getExecutionType().equals("task")) { comboBox.addItem("parallel"); comboBox.addItem("sequential"); comboBox.addItem("task"); } else if (graph.isCondition() || graph.getModel().getExecutionType().equals("condition")) { comboBox.addItem("parallel"); comboBox.addItem("sequential"); comboBox.addItem("condition"); } else {//from w w w . jav a 2s . c om comboBox.addItem("parallel"); comboBox.addItem("sequential"); comboBox.addItem("task"); } comboBox.setSelectedItem(graph.getModel().getExecutionType()); comboBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (!graph.getModel().getExecutionType().equals(e.getItem())) { graph.getModel().setExecutionType((String) e.getItem()); DefaultPropView.this.notifyListeners(); DefaultPropView.this.refreshView(state); } } }); panel.add(comboBox, BorderLayout.CENTER); return panel; }
From source file:com.litt.core.security.license.gui.ConfigPanel.java
/** * Create the panel./*from www . j av a 2s . c om*/ */ public ConfigPanel(final Gui gui) { GridBagLayout gbl_configPanel = new GridBagLayout(); gbl_configPanel.columnWidths = new int[] { 0, 0, 0, 0 }; gbl_configPanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_configPanel.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE }; gbl_configPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE }; this.setLayout(gbl_configPanel); JLabel label_18 = new JLabel("?"); GridBagConstraints gbc_label_18 = new GridBagConstraints(); gbc_label_18.insets = new Insets(0, 0, 5, 5); gbc_label_18.anchor = GridBagConstraints.EAST; gbc_label_18.gridx = 0; gbc_label_18.gridy = 0; this.add(label_18, gbc_label_18); comboBox_config = new JComboBox(); comboBox_config.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { try { LicenseConfig licenseConfig = (LicenseConfig) e.getItem(); File licenseFile = new File(licenseConfig.getLicenseFilePath()); currentLicenseConfig = licenseConfig; loadLicense(licenseFile); gui.setCurrentLicenseConfig(currentLicenseConfig); } catch (Exception e1) { JOptionPane.showMessageDialog(self, e1.getMessage()); } } } }); GridBagConstraints gbc_comboBox_config = new GridBagConstraints(); gbc_comboBox_config.insets = new Insets(0, 0, 5, 5); gbc_comboBox_config.fill = GridBagConstraints.HORIZONTAL; gbc_comboBox_config.gridx = 1; gbc_comboBox_config.gridy = 0; this.add(comboBox_config, gbc_comboBox_config); JButton button_3 = new JButton("?"); button_3.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { try { comboBox_config.removeAllItems(); File configFile = new File(Gui.HOME_PATH + File.separator + "config.xml"); Document document = XmlUtils.readXml(configFile); Element rootE = document.getRootElement(); List productList = rootE.elements(); for (int i = 0; i < productList.size(); i++) { Element productE = (Element) productList.get(i); String productCode = productE.attributeValue("code"); List customerList = productE.elements(); for (int j = 0; j < customerList.size(); j++) { Element customerE = (Element) customerList.get(j); String customerCode = customerE.attributeValue("code"); LicenseConfig licenseConfig = new LicenseConfig(); licenseConfig.setProductCode(productCode); licenseConfig.setCustomerCode(customerCode); licenseConfig.setLicenseId(customerE.elementText("licenseId")); licenseConfig.setEncryptedLicense(customerE.elementText("encryptedLicense")); licenseConfig.setRootFilePath(Gui.HOME_PATH); licenseConfig.setLicenseFilePath(Gui.HOME_PATH + File.separator + productCode + File.separator + customerCode + File.separator + "license.xml"); licenseConfig.setPriKeyFilePath( Gui.HOME_PATH + File.separator + productCode + File.separator + "private.key"); licenseConfig.setPubKeyFilePath( Gui.HOME_PATH + File.separator + productCode + File.separator + "license.key"); comboBox_config.addItem(licenseConfig); if (i == 0 && j == 0) { File licenseFile = new File(licenseConfig.getLicenseFilePath()); currentLicenseConfig = licenseConfig; loadLicense(licenseFile); gui.setCurrentLicenseConfig(currentLicenseConfig); btnDelete.setEnabled(true); } } } } catch (Exception e1) { e1.printStackTrace(); JOptionPane.showMessageDialog(self, e1.getMessage()); } } }); btnDelete = new JButton(); btnDelete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (currentLicenseConfig != null) { try { String productCode = currentLicenseConfig.getProductCode(); String customerCode = currentLicenseConfig.getCustomerCode(); //congfig.xml File configFile = new File(Gui.HOME_PATH + File.separator + "config.xml"); Document document = XmlUtils.readXml(configFile); Element customerNode = (Element) document.selectSingleNode( "//product[@code='" + productCode + "']/customer[@code='" + customerCode + "']"); if (customerNode != null) { customerNode.detach(); XmlUtils.writeXml(configFile, document); } // File licensePathFile = new File(currentLicenseConfig.getLicenseFilePath()); if (licensePathFile.exists()) { FileUtils.deleteDirectory(licensePathFile.getParentFile()); } //comboboxitem comboBox_config.removeItemAt(comboBox_config.getSelectedIndex()); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if (comboBox_config.getItemCount() <= 0) { btnDelete.setEnabled(false); } } } }); btnDelete.setEnabled(false); btnDelete.setIcon(new ImageIcon(ConfigPanel.class.getResource("/images/icon_delete.png"))); GridBagConstraints gbc_btnDelete = new GridBagConstraints(); gbc_btnDelete.insets = new Insets(0, 0, 5, 0); gbc_btnDelete.gridx = 2; gbc_btnDelete.gridy = 0; add(btnDelete, gbc_btnDelete); GridBagConstraints gbc_button_3 = new GridBagConstraints(); gbc_button_3.insets = new Insets(0, 0, 5, 5); gbc_button_3.gridx = 1; gbc_button_3.gridy = 1; this.add(button_3, gbc_button_3); JLabel lblid = new JLabel("?ID"); GridBagConstraints gbc_lblid = new GridBagConstraints(); gbc_lblid.anchor = GridBagConstraints.EAST; gbc_lblid.insets = new Insets(0, 0, 5, 5); gbc_lblid.gridx = 0; gbc_lblid.gridy = 2; this.add(lblid, gbc_lblid); textField_licenseId = new JTextField(); GridBagConstraints gbc_textField_licenseId = new GridBagConstraints(); gbc_textField_licenseId.insets = new Insets(0, 0, 5, 5); gbc_textField_licenseId.fill = GridBagConstraints.HORIZONTAL; gbc_textField_licenseId.gridx = 1; gbc_textField_licenseId.gridy = 2; this.add(textField_licenseId, gbc_textField_licenseId); textField_licenseId.setColumns(10); JLabel label = new JLabel("?"); GridBagConstraints gbc_label = new GridBagConstraints(); gbc_label.anchor = GridBagConstraints.EAST; gbc_label.insets = new Insets(0, 0, 5, 5); gbc_label.gridx = 0; gbc_label.gridy = 3; add(label, gbc_label); comboBox_licenseType = new JComboBox(MapComboBoxModel.getLicenseTypeOptions().toArray()); GridBagConstraints gbc_comboBox_licenseType = new GridBagConstraints(); gbc_comboBox_licenseType.insets = new Insets(0, 0, 5, 5); gbc_comboBox_licenseType.fill = GridBagConstraints.HORIZONTAL; gbc_comboBox_licenseType.gridx = 1; gbc_comboBox_licenseType.gridy = 3; add(comboBox_licenseType, gbc_comboBox_licenseType); JLabel label_23 = new JLabel("???"); GridBagConstraints gbc_label_23 = new GridBagConstraints(); gbc_label_23.anchor = GridBagConstraints.EAST; gbc_label_23.insets = new Insets(0, 0, 5, 5); gbc_label_23.gridx = 0; gbc_label_23.gridy = 4; this.add(label_23, gbc_label_23); textField_productName = new JTextField(); GridBagConstraints gbc_textField_productName = new GridBagConstraints(); gbc_textField_productName.insets = new Insets(0, 0, 5, 5); gbc_textField_productName.fill = GridBagConstraints.HORIZONTAL; gbc_textField_productName.gridx = 1; gbc_textField_productName.gridy = 4; this.add(textField_productName, gbc_textField_productName); textField_productName.setColumns(10); JLabel label_24 = new JLabel("???"); GridBagConstraints gbc_label_24 = new GridBagConstraints(); gbc_label_24.anchor = GridBagConstraints.EAST; gbc_label_24.insets = new Insets(0, 0, 5, 5); gbc_label_24.gridx = 0; gbc_label_24.gridy = 5; this.add(label_24, gbc_label_24); textField_companyName = new JTextField(); GridBagConstraints gbc_textField_companyName = new GridBagConstraints(); gbc_textField_companyName.insets = new Insets(0, 0, 5, 5); gbc_textField_companyName.fill = GridBagConstraints.HORIZONTAL; gbc_textField_companyName.gridx = 1; gbc_textField_companyName.gridy = 5; this.add(textField_companyName, gbc_textField_companyName); textField_companyName.setColumns(10); JLabel label_25 = new JLabel("??"); GridBagConstraints gbc_label_25 = new GridBagConstraints(); gbc_label_25.anchor = GridBagConstraints.EAST; gbc_label_25.insets = new Insets(0, 0, 5, 5); gbc_label_25.gridx = 0; gbc_label_25.gridy = 6; this.add(label_25, gbc_label_25); textField_customerName = new JTextField(); GridBagConstraints gbc_textField_customerName = new GridBagConstraints(); gbc_textField_customerName.insets = new Insets(0, 0, 5, 5); gbc_textField_customerName.fill = GridBagConstraints.HORIZONTAL; gbc_textField_customerName.gridx = 1; gbc_textField_customerName.gridy = 6; this.add(textField_customerName, gbc_textField_customerName); textField_customerName.setColumns(10); JLabel label_26 = new JLabel(""); GridBagConstraints gbc_label_26 = new GridBagConstraints(); gbc_label_26.anchor = GridBagConstraints.EAST; gbc_label_26.insets = new Insets(0, 0, 5, 5); gbc_label_26.gridx = 0; gbc_label_26.gridy = 7; this.add(label_26, gbc_label_26); textField_version = new JTextField(); GridBagConstraints gbc_textField_version = new GridBagConstraints(); gbc_textField_version.insets = new Insets(0, 0, 5, 5); gbc_textField_version.fill = GridBagConstraints.HORIZONTAL; gbc_textField_version.gridx = 1; gbc_textField_version.gridy = 7; this.add(textField_version, gbc_textField_version); textField_version.setColumns(10); JLabel label_27 = new JLabel(""); GridBagConstraints gbc_label_27 = new GridBagConstraints(); gbc_label_27.insets = new Insets(0, 0, 5, 5); gbc_label_27.gridx = 0; gbc_label_27.gridy = 8; this.add(label_27, gbc_label_27); datePicker_expiredDate = new DatePicker(new Date(), "yyyy-MM-dd", null, null); //datePicker_expiredDate.setTimePanleVisible(false); GridBagConstraints gbc_datePicker_expiredDate = new GridBagConstraints(); gbc_datePicker_expiredDate.anchor = GridBagConstraints.WEST; gbc_datePicker_expiredDate.insets = new Insets(0, 0, 5, 5); gbc_datePicker_expiredDate.gridx = 1; gbc_datePicker_expiredDate.gridy = 8; this.add(datePicker_expiredDate, gbc_datePicker_expiredDate); JButton button_5 = new JButton(""); button_5.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (currentLicenseConfig != null) { try { File priKeyFile = new File(currentLicenseConfig.getPriKeyFilePath()); File licenseFile = new File(currentLicenseConfig.getLicenseFilePath()); //?? License license = new License(); license.setLicenseId(textField_licenseId.getText()); license.setLicenseType( ((MapComboBoxModel) comboBox_licenseType.getSelectedItem()).getValue().toString()); license.setProductName(textField_productName.getText()); license.setCompanyName(textField_companyName.getText()); license.setCustomerName(textField_customerName.getText()); license.setVersion(Version.parseVersion(textField_version.getText())); license.setCreateDate(new Date()); license.setExpiredDate(Utility.parseDate(datePicker_expiredDate.getText())); //???? DigitalSignatureTool utils = new DigitalSignatureTool("DSA"); utils.readPriKey(priKeyFile.getAbsolutePath()); //?? String signedData = utils.sign(license.toString()); //?????? license.setSignature(signedData); LicenseManager.writeLicense(license, licenseFile); //config.xml String licenseContent = XmlUtils.readXml(licenseFile).asXML(); //DES ISecurity security = new DESTool(currentLicenseConfig.getLicenseId(), Algorithm.BLOWFISH); licenseContent = security.encrypt(licenseContent); txt_encryptContent.setText(licenseContent); currentLicenseConfig.setEncryptedLicense(licenseContent); System.out.println(licenseContent); File configFile = new File(Gui.HOME_PATH + File.separator + "config.xml"); XMLConfiguration config = new XMLConfiguration(configFile); config.setAutoSave(true); config.setProperty("product.customer.encryptedLicense", licenseContent); //??zip? File customerPath = licenseFile.getParentFile(); //???license????? File licensePath = new File(customerPath.getParent(), "license"); if (!licensePath.exists() && !licensePath.isDirectory()) { licensePath.mkdir(); } else { FileUtils.cleanDirectory(licensePath); } //? FileUtils.copyDirectory(customerPath, licensePath); String currentTime = FormatDateTime.formatDateTimeNum(new Date()); ZipUtils.zip(licensePath, new File(licensePath.getParentFile(), currentLicenseConfig.getCustomerCode() + "-" + currentTime + ".zip")); //license FileUtils.deleteDirectory(licensePath); JOptionPane.showMessageDialog(self, "??"); } catch (Exception e1) { e1.printStackTrace(); JOptionPane.showMessageDialog(self, e1.getMessage()); } } else { JOptionPane.showMessageDialog(self, "???"); } } }); GridBagConstraints gbc_button_5 = new GridBagConstraints(); gbc_button_5.insets = new Insets(0, 0, 5, 5); gbc_button_5.gridx = 1; gbc_button_5.gridy = 9; this.add(button_5, gbc_button_5); JScrollPane scrollPane = new JScrollPane(); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.insets = new Insets(0, 0, 0, 5); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 1; gbc_scrollPane.gridy = 10; this.add(scrollPane, gbc_scrollPane); txt_encryptContent = new JTextArea(); txt_encryptContent.setLineWrap(true); scrollPane.setViewportView(txt_encryptContent); // txt_encryptContent = new JTextArea(20, 20); // GridBagConstraints gbc_6 = new GridBagConstraints(); // gbc_6.gridx = 1; // gbc_6.gridy = 10; // this.add(txt_encryptContent, gbc_6); }
From source file:net.sourceforge.pmd.cpd.GUI.java
public GUI() { frame = new JFrame("PMD Duplicate Code Detector (v " + PMDVersion.VERSION + ')'); timeField.setEditable(false);/* www. j av a 2s.c o m*/ JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); addSaveOptionsTo(fileMenu); JMenuItem exitItem = new JMenuItem("Exit"); exitItem.setMnemonic('x'); exitItem.addActionListener(new CancelListener()); fileMenu.add(exitItem); JMenu viewMenu = new JMenu("View"); fileMenu.setMnemonic('v'); JMenuItem trimItem = new JCheckBoxMenuItem("Trim leading whitespace"); trimItem.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { AbstractButton button = (AbstractButton) e.getItem(); GUI.this.trimLeadingWhitespace = button.isSelected(); } }); viewMenu.add(trimItem); JMenuBar menuBar = new JMenuBar(); menuBar.add(fileMenu); menuBar.add(viewMenu); frame.setJMenuBar(menuBar); // first make all the buttons JButton browseButton = new JButton("Browse"); browseButton.setMnemonic('b'); browseButton.addActionListener(new BrowseListener()); goButton = new JButton("Go"); goButton.setMnemonic('g'); goButton.addActionListener(new GoListener()); cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new CancelListener()); JPanel settingsPanel = makeSettingsPanel(browseButton, goButton, cancelButton); progressPanel = makeProgressPanel(); JPanel resultsPanel = makeResultsPanel(); adjustLanguageControlsFor((LanguageConfig) LANGUAGE_SETS[0][1]); frame.getContentPane().setLayout(new BorderLayout()); JPanel topPanel = new JPanel(); topPanel.setLayout(new BorderLayout()); topPanel.add(settingsPanel, BorderLayout.NORTH); topPanel.add(progressPanel, BorderLayout.CENTER); setProgressControls(false); // not running now frame.getContentPane().add(topPanel, BorderLayout.NORTH); frame.getContentPane().add(resultsPanel, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:com.kenai.redminenb.query.RedmineQueryController.java
@Override public void itemStateChanged(ItemEvent e) { if (e.getSource() == queryPanel.filterComboBox) { onFilterChange((Filter) e.getItem()); }/*from w w w .j av a 2 s . com*/ }
From source file:davmail.ui.SettingsFrame.java
protected JPanel getSmartCardPanel() { JPanel clientKeystorePanel = new JPanel(new GridLayout(2, 1)); clientKeystorePanel.setLayout(new BoxLayout(clientKeystorePanel, BoxLayout.Y_AXIS)); clientKeystorePanel//from ww w.j ava2 s . co m .setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_CLIENT_CERTIFICATE"))); clientKeystoreTypeCombo = new JComboBox(new String[] { "PKCS11", "JKS", "PKCS12" }); clientKeystoreTypeCombo.setSelectedItem(Settings.getProperty("davmail.ssl.clientKeystoreType")); clientKeystoreFileField = new JTextField(Settings.getProperty("davmail.ssl.clientKeystoreFile"), 17); clientKeystorePassField = new JPasswordField(Settings.getProperty("davmail.ssl.clientKeystorePass"), 15); pkcs11LibraryField = new JTextField(Settings.getProperty("davmail.ssl.pkcs11Library"), 17); pkcs11ConfigField = new JTextArea(2, 17); pkcs11ConfigField.setText(Settings.getProperty("davmail.ssl.pkcs11Config")); pkcs11ConfigField.setBorder(pkcs11LibraryField.getBorder()); pkcs11ConfigField.setFont(pkcs11LibraryField.getFont()); JPanel clientKeystoreTypePanel = new JPanel(new GridLayout(1, 2)); addSettingComponent(clientKeystoreTypePanel, BundleMessage.format("UI_CLIENT_KEY_STORE_TYPE"), clientKeystoreTypeCombo, BundleMessage.format("UI_CLIENT_KEY_STORE_TYPE_HELP")); clientKeystorePanel.add(clientKeystoreTypePanel); final JPanel cardPanel = new JPanel(new CardLayout()); clientKeystorePanel.add(cardPanel); JPanel clientKeystoreFilePanel = new JPanel(new GridLayout(2, 2)); addSettingComponent(clientKeystoreFilePanel, BundleMessage.format("UI_CLIENT_KEY_STORE"), clientKeystoreFileField, BundleMessage.format("UI_CLIENT_KEY_STORE_HELP")); addSettingComponent(clientKeystoreFilePanel, BundleMessage.format("UI_CLIENT_KEY_STORE_PASSWORD"), clientKeystorePassField, BundleMessage.format("UI_CLIENT_KEY_STORE_PASSWORD_HELP")); cardPanel.add(clientKeystoreFilePanel, "FILE"); JPanel pkcs11Panel = new JPanel(new GridLayout(2, 2)); addSettingComponent(pkcs11Panel, BundleMessage.format("UI_PKCS11_LIBRARY"), pkcs11LibraryField, BundleMessage.format("UI_PKCS11_LIBRARY_HELP")); addSettingComponent(pkcs11Panel, BundleMessage.format("UI_PKCS11_CONFIG"), pkcs11ConfigField, BundleMessage.format("UI_PKCS11_CONFIG_HELP")); cardPanel.add(pkcs11Panel, "PKCS11"); ((CardLayout) cardPanel.getLayout()).show(cardPanel, (String) clientKeystoreTypeCombo.getSelectedItem()); clientKeystoreTypeCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent event) { CardLayout cardLayout = (CardLayout) (cardPanel.getLayout()); if ("PKCS11".equals(event.getItem())) { cardLayout.show(cardPanel, "PKCS11"); } else { cardLayout.show(cardPanel, "FILE"); } } }); updateMaximumSize(clientKeystorePanel); return clientKeystorePanel; }