List of usage examples for javax.swing JComboBox JComboBox
public JComboBox(Vector<E> items)
JComboBox
that contains the elements in the specified Vector. From source file:cool.pandora.modeller.ui.jpanel.base.NewBagFrame.java
/** * layoutProfileSelection./*from w ww .jav a2 s. c o m*/ * * @param contentPane JPanel * @param row int */ private void layoutProfileSelection(final JPanel contentPane, final int row) { // content // profile selection final JLabel bagProfileLabel = new JLabel(bagView.getPropertyMessage("Select Profile:")); bagProfileLabel.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help")); profileList = new JComboBox<>(bagView.getProfileStore().getProfileNames()); profileList.setName(bagView.getPropertyMessage("bag.label.projectlist")); profileList.setSelectedItem(bagView.getPropertyMessage("bag.project.noproject")); profileList.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help")); GridBagConstraints glbc = new GridBagConstraints(); final JLabel spacerLabel = new JLabel(); glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); contentPane.add(bagProfileLabel, glbc); glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); contentPane.add(profileList, glbc); glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 40, 50, GridBagConstraints.NONE, GridBagConstraints.EAST); contentPane.add(spacerLabel, glbc); }
From source file:net.pandoragames.far.ui.swing.dialog.SettingsDialog.java
private void init() { this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS)); this.setResizable(false); JPanel basePanel = new JPanel(); basePanel.setLayout(new BoxLayout(basePanel, BoxLayout.Y_AXIS)); basePanel.setBorder(// w ww. j ava 2 s. c o m BorderFactory.createEmptyBorder(0, SwingConfig.PADDING, SwingConfig.PADDING, SwingConfig.PADDING)); registerCloseWindowKeyListener(basePanel); // sink for error messages MessageLabel errorField = new MessageLabel(); errorField.setMinimumSize(new Dimension(100, swingConfig.getStandardComponentHight())); errorField.setBorder(BorderFactory.createEmptyBorder(1, SwingConfig.PADDING, 2, SwingConfig.PADDING)); TwoComponentsPanel lineError = new TwoComponentsPanel(errorField, Box.createRigidArea(new Dimension(1, swingConfig.getStandardComponentHight()))); lineError.setAlignmentX(Component.LEFT_ALIGNMENT); basePanel.add(lineError); // character set JLabel labelCharset = new JLabel(swingConfig.getLocalizer().localize("label.default-characterset")); labelCharset.setAlignmentX(Component.LEFT_ALIGNMENT); basePanel.add(labelCharset); JComboBox listCharset = new JComboBox(swingConfig.getCharsetList().toArray()); listCharset.setAlignmentX(Component.LEFT_ALIGNMENT); listCharset.setSelectedItem(swingConfig.getDefaultCharset()); listCharset.setEditable(true); listCharset.setMaximumSize( new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, swingConfig.getStandardComponentHight())); listCharset.addActionListener(new CharacterSetListener(errorField)); listCharset.setEditor(new CharacterSetEditor(errorField)); basePanel.add(listCharset); basePanel.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING))); // select the group selector JPanel selectorPanel = new JPanel(); selectorPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); selectorPanel.setAlignmentX(Component.LEFT_ALIGNMENT); // linePattern.setAlignmentX( Component.LEFT_ALIGNMENT ); JLabel labelSelector = new JLabel(swingConfig.getLocalizer().localize("label.group-ref-indicator")); selectorPanel.add(labelSelector); JComboBox selectorBox = new JComboBox(FARConfig.GROUPREFINDICATORLIST); selectorBox.setSelectedItem(Character.toString(groupReference)); selectorBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { JComboBox cbox = (JComboBox) event.getSource(); String indicator = (String) cbox.getSelectedItem(); groupReference = indicator.charAt(0); } }); selectorPanel.add(selectorBox); basePanel.add(selectorPanel); basePanel.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING))); // checkbox DO BACKUP JCheckBox doBackupFlag = new JCheckBox(swingConfig.getLocalizer().localize("label.create-backup")); doBackupFlag.setAlignmentX(Component.LEFT_ALIGNMENT); doBackupFlag.setHorizontalTextPosition(SwingConstants.LEADING); doBackupFlag.setSelected(replaceForm.isDoBackup()); doBackupFlag.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent event) { doBackup = ItemEvent.SELECTED == event.getStateChange(); backupFlagEvent = event; } }); basePanel.add(doBackupFlag); JTextField backupDirPathTextField = new JTextField(); backupDirPathTextField.setPreferredSize( new Dimension(SwingConfig.COMPONENT_WIDTH, swingConfig.getStandardComponentHight())); backupDirPathTextField.setMaximumSize( new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, swingConfig.getStandardComponentHight())); backupDirPathTextField.setText(backupDirectory.getPath()); backupDirPathTextField.setToolTipText(backupDirectory.getPath()); backupDirPathTextField.setEditable(false); JButton openBaseDirFileChooserButton = new JButton(swingConfig.getLocalizer().localize("button.browse")); BrowseButtonListener backupDirButtonListener = new BrowseButtonListener(backupDirPathTextField, new BackUpDirectoryRepository(swingConfig, findForm, replaceForm, errorField), swingConfig.getLocalizer().localize("label.choose-backup-directory")); openBaseDirFileChooserButton.addActionListener(backupDirButtonListener); TwoComponentsPanel lineBaseDir = new TwoComponentsPanel(backupDirPathTextField, openBaseDirFileChooserButton); lineBaseDir.setAlignmentX(Component.LEFT_ALIGNMENT); basePanel.add(lineBaseDir); basePanel.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING))); JPanel fileInfoPanel = new JPanel(); fileInfoPanel .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), swingConfig.getLocalizer().localize("label.default-file-info"))); fileInfoPanel.setAlignmentX(Component.LEFT_ALIGNMENT); fileInfoPanel.setLayout(new BoxLayout(fileInfoPanel, BoxLayout.Y_AXIS)); JLabel fileInfoLabel = new JLabel(swingConfig.getLocalizer().localize("message.displayed-in-info-column")); fileInfoLabel.setAlignmentX(Component.LEFT_ALIGNMENT); fileInfoPanel.add(fileInfoLabel); fileInfoPanel.add(Box.createHorizontalGlue()); JRadioButton nothingRadio = new JRadioButton(swingConfig.getLocalizer().localize("label.nothing")); nothingRadio.setAlignmentX(Component.LEFT_ALIGNMENT); nothingRadio.setActionCommand(SwingConfig.DefaultFileInfo.NOTHING.name()); nothingRadio.setSelected(swingConfig.getDefaultFileInfo() == SwingConfig.DefaultFileInfo.NOTHING); fileInfoOptions.add(nothingRadio); fileInfoPanel.add(nothingRadio); JRadioButton readOnlyRadio = new JRadioButton( swingConfig.getLocalizer().localize("label.read-only-warning")); readOnlyRadio.setAlignmentX(Component.LEFT_ALIGNMENT); readOnlyRadio.setActionCommand(SwingConfig.DefaultFileInfo.READONLY.name()); readOnlyRadio.setSelected(swingConfig.getDefaultFileInfo() == SwingConfig.DefaultFileInfo.READONLY); fileInfoOptions.add(readOnlyRadio); fileInfoPanel.add(readOnlyRadio); JRadioButton sizeRadio = new JRadioButton(swingConfig.getLocalizer().localize("label.filesize")); sizeRadio.setAlignmentX(Component.LEFT_ALIGNMENT); sizeRadio.setActionCommand(SwingConfig.DefaultFileInfo.SIZE.name()); sizeRadio.setSelected(swingConfig.getDefaultFileInfo() == SwingConfig.DefaultFileInfo.SIZE); fileInfoOptions.add(sizeRadio); fileInfoPanel.add(sizeRadio); JCheckBox showPlainBytesFlag = new JCheckBox( " " + swingConfig.getLocalizer().localize("label.show-plain-bytes")); showPlainBytesFlag.setAlignmentX(Component.LEFT_ALIGNMENT); showPlainBytesFlag.setHorizontalTextPosition(SwingConstants.LEADING); showPlainBytesFlag.setSelected(swingConfig.isShowPlainBytes()); showPlainBytesFlag.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent event) { showBytes = ItemEvent.SELECTED == event.getStateChange(); } }); fileInfoPanel.add(showPlainBytesFlag); JRadioButton lastModifiedRadio = new JRadioButton( swingConfig.getLocalizer().localize("label.last-modified")); lastModifiedRadio.setAlignmentX(Component.LEFT_ALIGNMENT); lastModifiedRadio.setActionCommand(SwingConfig.DefaultFileInfo.LAST_MODIFIED.name()); lastModifiedRadio .setSelected(swingConfig.getDefaultFileInfo() == SwingConfig.DefaultFileInfo.LAST_MODIFIED); fileInfoOptions.add(lastModifiedRadio); fileInfoPanel.add(lastModifiedRadio); basePanel.add(fileInfoPanel); // buttons JPanel buttonPannel = new JPanel(); buttonPannel.setAlignmentX(Component.LEFT_ALIGNMENT); buttonPannel.setLayout(new FlowLayout(FlowLayout.TRAILING)); // cancel JButton cancelButton = new JButton(swingConfig.getLocalizer().localize("button.cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { SettingsDialog.this.dispose(); } }); buttonPannel.add(cancelButton); // save JButton saveButton = new JButton(swingConfig.getLocalizer().localize("button.save")); saveButton.addActionListener(new SaveButtonListener()); buttonPannel.add(saveButton); this.getRootPane().setDefaultButton(saveButton); this.add(basePanel); this.add(buttonPannel); placeOnScreen(swingConfig.getScreenCenter()); }
From source file:fedroot.dacs.swingdemo.DacsClientFrame.java
/** * //from www .java2 s .c o m * @param dacsClientContext * @param feduri * @throws java.lang.Exception */ public DacsClientFrame(DacsClientContext dacsClientContext, Federation federation) throws Exception { logger.log(Level.INFO, "Federation {0}", federation.getFederationName()); this.federation = federation; this.dacsClientContext = dacsClientContext; // this.dacsClientContext.setDacs902EventHandler(federation, new Event902Handler(this)); // this.dacsClientContext.setDacs905EventHandler(federation, new Event905Handler(this)); JPanel mainPanel = new JPanel(new BorderLayout()); JPanel gotoUrlPanel = new JPanel(new FlowLayout()); JPanel actionPanel = new JPanel(new FlowLayout()); JPanel modifiersPanel = new JPanel(new FlowLayout()); /** Enable/Disable DACS Check_only mode */ checkOnlyCheckBox = new JCheckBox("Enable DACS Check Only", false); checkOnlyCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (checkOnlyCheckBox.isSelected()) { enableEventHandlingCheckBox.setSelected(false); enableEventHandlingCheckBox.setEnabled(false); } else { enableEventHandlingCheckBox.setEnabled(true); } } }); /** Enable/Disable Event Handling */ enableEventHandlingCheckBox = new JCheckBox("Enable Event Handling", false); final JButton btnGOTO = new JButton("Goto URL"); btnGOTO.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { try { followUrl(new URI(urlTextField.getText().trim())); } catch (URISyntaxException ex) { // TODO implement popup for error messages } } }); final JButton btnGO = new JButton("GO"); btnGO.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { try { followUrl(new URI(actionUrls[actionsComboBox.getSelectedIndex()])); } catch (URISyntaxException ex) { // TODO implement popup for error messages } } }); final JButton btnUSERNAMES = new JButton("Usernames"); btnUSERNAMES.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { createAndShowDacsUsernameFrame(); } }); final JButton btnLOGIN = new JButton("Login"); btnLOGIN.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { createAndShowLoginFrame(); } }); final JButton btnNAT = new JButton("NATs"); btnNAT.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { createAndShowDacsNatFrame(); } }); Container container = this.getContentPane(); actionsComboBox = new JComboBox(actions); actionsComboBox.setToolTipText("Select an Action"); actionsComboBox.setEditable(true); actionsComboBox.setSelectedIndex(0); JLabel actionLabel = new JLabel("Action:"); urlTextField = new TextField(70); urlTextField.setEditable(true); gotoUrlPanel.add(urlTextField); gotoUrlPanel.add(btnGOTO); actionPanel.add(actionLabel); actionPanel.add(actionsComboBox); actionPanel.add(btnGO); actionPanel.add(btnLOGIN); actionPanel.add(btnUSERNAMES); actionPanel.add(btnNAT); mainPanel.add(gotoUrlPanel, BorderLayout.NORTH); mainPanel.add(actionPanel, BorderLayout.SOUTH); modifiersPanel.add(checkOnlyCheckBox); modifiersPanel.add(enableEventHandlingCheckBox); JSplitPane splitInputPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, mainPanel, modifiersPanel); splitInputPane.setOneTouchExpandable(false); responseTextArea = new JTextArea(); responseTextArea.setEditable(false); responseTextArea.setCaretPosition(0); htmlPane = new JEditorPane(); // htmlPane.setContentType("image/png"); htmlPane.setEditable(false); JSplitPane splitResponsePane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(responseTextArea), new JScrollPane(htmlPane)); splitResponsePane.setOneTouchExpandable(false); splitResponsePane.setResizeWeight(0.35); container.setLayout(new BorderLayout()); container.add(splitInputPane, BorderLayout.NORTH); container.add(splitResponsePane, BorderLayout.CENTER); }
From source file:net.mumie.coursecreator.gui.ClassChooser.java
private void buildLayout() { // Dimensions of the Dialog int width = 10; int height = 160; int buttonWidth = 100; int buttonHeight = 30; // sets the Layout this.getContentPane().setLayout(new GridBagLayout()); // the Button and Label Text String okButtonText = "Zuweisen"; String cancelButtonText = "Cancel"; headlineLabelText = ""; // the Fonts// www.j av a2 s . c o m Font font = new Font("SansSerif", Font.PLAIN, 14); Font headlineLabelFont = new Font("SansSerif", Font.PLAIN, 12); Font textFieldFont = new Font("Monospaced", Font.PLAIN, 10); // GridBagContraints for rootPanel (s.b.): GridBagConstraints rootPanelStyle = createGridBagContrains(GridBagConstraints.CENTER, 4, 4, 4, 4, 0, 0); // GridBagContraints for headlineLabel: GridBagConstraints headlineLabelStyle = createGridBagContrains(GridBagConstraints.CENTER, 6, 6, 6, 6, 0, 0); // GridBagConstraints for textFieldPanel (s.b.): GridBagConstraints textFieldPanelStyle = createGridBagContrains(GridBagConstraints.CENTER, 4, 4, 4, 4, 0, 1); // GridBagConstraints for buttonPanel (s.b.): GridBagConstraints buttonPanelStyle = createGridBagContrains(GridBagConstraints.CENTER, 4, 4, 4, 4, 0, 2); // GridBagConstraints for serverTextField: GridBagConstraints serverTextFieldStyle = createGridBagContrains(GridBagConstraints.WEST, 6, 6, 6, 6, 1, 0); // GridBagContraints for okButton (s.b.): GridBagConstraints okButtonStyle = createGridBagContrains(GridBagConstraints.CENTER, 6, 6, 6, 6, 0, 0); // GridBagContraints for cancelButton (s.b.): GridBagConstraints cancelButtonStyle = createGridBagContrains(GridBagConstraints.CENTER, 6, 6, 6, 6, 1, 0); // Creating rootPanel (contains all components) JPanel rootPanel = new JPanel(new GridBagLayout()); rootPanel.setFont(font); // Creating headlineLabel: JLabel headlineLabel = new JLabel(headlineLabelText); headlineLabel.setFont(headlineLabelFont); // Creating textFieldPanel: JPanel textFieldPanel = new JPanel(new GridBagLayout()); textFieldPanel.setFont(font); // Creating classTextField: classBox = new JComboBox(this.classList); classBox.setFont(textFieldFont); String classPath = this.controller.getMetaInfoField().getMetaInfos().getClassPath(); String className = this.controller.getMetaInfoField().getMetaInfos().getClassName(); if (setSelectedClass(classPath, className) == -1) headlineLabel.setForeground(Color.RED); else headlineLabel.setForeground(Color.BLACK); headlineLabel.setText(this.headlineLabelText); // Creating buttonPanel: JPanel buttonPanel = new JPanel(new GridBagLayout()); buttonPanel.setFont(font); // okButton: JButton okButton = new JButton(okButtonText); okButton.setPreferredSize(new Dimension(buttonWidth, buttonHeight)); okButton.setActionCommand(CommandConstants.META_INFO_FIELD_OK); okButton.addActionListener(this.controller); // cancelButton: JButton cancelButton = new JButton(cancelButtonText); cancelButton.setPreferredSize(new Dimension(buttonWidth, buttonHeight)); cancelButton.setActionCommand(CommandConstants.META_INFO_FIELD_CANCEL); cancelButton.addActionListener(this.controller); // Composing the GUI: this.getContentPane().setLayout(new GridBagLayout()); this.getContentPane().add(rootPanel, rootPanelStyle); rootPanel.add(headlineLabel, headlineLabelStyle); rootPanel.add(textFieldPanel, textFieldPanelStyle); textFieldPanel.add(classBox, serverTextFieldStyle); rootPanel.add(buttonPanel, buttonPanelStyle); buttonPanel.add(okButton, okButtonStyle); buttonPanel.add(cancelButton, cancelButtonStyle); this.addWindowListener(this.windowListener); int maxString = this.headlineLabelText.length(); for (int i = 0; i < this.classList.size(); i++) { maxString = Math.max(((String) this.classList.get(i).toString()).length(), maxString); } width = Math.max(width, maxString * 8); this.setSize(width, height); }
From source file:com.floreantpos.main.SetUpWindow.java
protected void initUI() { getContentPane().setLayout(new BorderLayout()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ JPanel databaseConfigPanel = new JPanel(new MigLayout("fill,hidemode 3", "[150px][fill, grow]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ databaseConfigPanel.setBorder(new TitledBorder(Messages.getString("SetUpWindow.3"))); //$NON-NLS-1$ tfServerAddress = new POSTextField(); tfServerPort = new POSTextField(); tfDatabaseName = new POSTextField(); tfUserName = new POSTextField(); tfPassword = new POSPasswordField(); databaseCombo = new JComboBox(Database.values()); String databaseProviderName = AppConfig.getDatabaseProviderName(); if (StringUtils.isNotEmpty(databaseProviderName)) { databaseCombo.setSelectedItem(Database.getByProviderName(databaseProviderName)); }// ww w.j a v a2 s . com btnTestConnection = new PosButton("Test"); //$NON-NLS-1$ btnTestConnection.setActionCommand(TEST); btnCreateDb = new PosButton("Create New"); //$NON-NLS-1$ btnCreateDb.setActionCommand(CREATE_DATABASE); btnCreateSampleData = new PosButton("Create sample data"); //$NON-NLS-1$ btnCreateSampleData.setActionCommand(CREATE_SAMPLE_DATA); databaseConfigPanel.add(new JLabel(Messages.getString("DatabaseConfigurationDialog.8"))); //$NON-NLS-1$ databaseConfigPanel.add(databaseCombo, "w 200!,grow, split 4"); //$NON-NLS-1$ databaseConfigPanel.add(btnTestConnection, "w 50!,h 30!"); //$NON-NLS-1$ databaseConfigPanel.add(btnCreateDb, "w 100!,h 30!"); //$NON-NLS-1$ databaseConfigPanel.add(btnCreateSampleData, "h 30!,wrap"); //$NON-NLS-1$ lblServerAddress = new JLabel(Messages.getString("DatabaseConfigurationDialog.10") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ databaseConfigPanel.add(lblServerAddress); databaseConfigPanel.add(tfServerAddress, "grow, split 3"); //$NON-NLS-1$ lblServerPort = new JLabel("Port" + ":"); //$NON-NLS-1$ //$NON-NLS-2$ databaseConfigPanel.add(lblServerPort); tfServerPort.setHorizontalAlignment(JTextField.RIGHT); databaseConfigPanel.add(tfServerPort, "w 50!,wrap"); //$NON-NLS-1$ lblDbName = new JLabel(Messages.getString("DatabaseConfigurationDialog.16") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ databaseConfigPanel.add(lblDbName); databaseConfigPanel.add(tfDatabaseName, "grow, wrap"); //$NON-NLS-1$ lblUserName = new JLabel(Messages.getString("DatabaseConfigurationDialog.19") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ databaseConfigPanel.add(lblUserName); databaseConfigPanel.add(tfUserName, "grow, split 3"); //$NON-NLS-1$ lblDbPassword = new JLabel("Password" + ":"); //$NON-NLS-1$ //$NON-NLS-2$ databaseConfigPanel.add(lblDbPassword); databaseConfigPanel.add(tfPassword, "grow, wrap"); //$NON-NLS-1$ btnSave = new PosButton(Messages.getString("DatabaseConfigurationDialog.27").toUpperCase()); //$NON-NLS-1$ btnSave.setActionCommand(SAVE); btnExit = new PosButton(Messages.getString("DatabaseConfigurationDialog.28").toUpperCase()); //$NON-NLS-1$ btnExit.setActionCommand(CANCEL); JPanel buttonPanel = new JPanel(new MigLayout("fillx,right")); //$NON-NLS-1$ buttonPanel.add(btnSave, "h 40!,split 2,right"); //$NON-NLS-1$ buttonPanel.add(btnExit, "h 40!"); //$NON-NLS-1$ JPanel contentPanel = new JPanel(new MigLayout("fillx")); //$NON-NLS-1$ contentPanel.add(databaseConfigPanel, "grow,wrap"); //$NON-NLS-1$ //contentPanel.add(createUserPanel(), "grow,wrap"); contentPanel.add(createTerminalConfigPanel(), "grow,wrap"); //$NON-NLS-1$ getContentPane().add(new JideScrollPane(contentPanel), BorderLayout.CENTER); //$NON-NLS-1$ getContentPane().add(buttonPanel, BorderLayout.SOUTH); //$NON-NLS-1$ getContentPane().setBackground(databaseConfigPanel.getBackground()); }
From source file:fedroot.dacs.swingdemo.DemoFrame.java
/** * // w w w. ja v a2 s.c om * @param dacsClientContext * @param feduri * @throws java.lang.Exception */ public DemoFrame(DacsClientContext dacsClientContext, Federation federation) throws Exception { logger.log(Level.INFO, "Federation {0}", federation.getFederationName()); this.federation = federation; this.dacsClientContext = dacsClientContext; // this.dacsClientContext.setDacs902EventHandler(federation, new Event902Handler(this)); // this.dacsClientContext.setDacs905EventHandler(federation, new Event905Handler(this)); JPanel mainPanel = new JPanel(new BorderLayout()); JPanel gotoUrlPanel = new JPanel(new FlowLayout()); JPanel actionPanel = new JPanel(new FlowLayout()); JPanel modifiersPanel = new JPanel(new FlowLayout()); /** Enable/Disable DACS Check_only mode */ checkOnlyCheckBox = new JCheckBox("Enable DACS Check Only", false); checkOnlyCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (checkOnlyCheckBox.isSelected()) { enableEventHandlingCheckBox.setSelected(false); enableEventHandlingCheckBox.setEnabled(false); } else { enableEventHandlingCheckBox.setEnabled(true); } } }); /** Enable/Disable Event Handling */ enableEventHandlingCheckBox = new JCheckBox("Enable Event Handling", false); final JButton btnGOTO = new JButton("Goto URL"); btnGOTO.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { try { followUrl(new URI(urlTextField.getText().trim())); } catch (URISyntaxException ex) { // TODO implement popup for error messages } } }); final JButton btnGO = new JButton("GO"); btnGO.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { try { followUrl(new URI(actionUrls[actionsComboBox.getSelectedIndex()])); } catch (URISyntaxException ex) { // TODO implement popup for error messages } } }); final JButton btnUSERNAMES = new JButton("Usernames"); btnUSERNAMES.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { createAndShowDacsUsernameFrame(); } }); final JButton btnLOGIN = new JButton("Login"); btnLOGIN.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { createAndShowLoginFrame(); } }); final JButton btnNAT = new JButton("NATs"); btnNAT.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { createAndShowDacsNatFrame(); } }); Container container = this.getContentPane(); actionsComboBox = new JComboBox(actions); actionsComboBox.setToolTipText("Select an Action"); actionsComboBox.setEditable(true); actionsComboBox.setSelectedIndex(0); JLabel actionLabel = new JLabel("Action:"); urlTextField = new TextField(70); urlTextField.setEditable(true); gotoUrlPanel.add(urlTextField); gotoUrlPanel.add(btnGOTO); actionPanel.add(actionLabel); actionPanel.add(actionsComboBox); actionPanel.add(btnGO); actionPanel.add(btnLOGIN); actionPanel.add(btnUSERNAMES); actionPanel.add(btnNAT); mainPanel.add(gotoUrlPanel, BorderLayout.NORTH); mainPanel.add(actionPanel, BorderLayout.SOUTH); modifiersPanel.add(checkOnlyCheckBox); modifiersPanel.add(enableEventHandlingCheckBox); JSplitPane splitInputPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, mainPanel, modifiersPanel); splitInputPane.setOneTouchExpandable(false); responseTextArea = new JTextArea(); responseTextArea.setEditable(false); responseTextArea.setCaretPosition(0); htmlPane = new JEditorPane(); // htmlPane.setContentType("image/png"); htmlPane.setEditable(false); JSplitPane splitResponsePane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(responseTextArea), new JScrollPane(htmlPane)); splitResponsePane.setOneTouchExpandable(false); splitResponsePane.setResizeWeight(0.35); container.setLayout(new BorderLayout()); container.add(splitInputPane, BorderLayout.NORTH); container.add(splitResponsePane, BorderLayout.CENTER); }
From source file:com.intuit.tank.tools.script.ScriptFilterRunner.java
/** * @return//www .ja v a2s . c o m */ private Component createTopPanel() { JPanel topPanel = new JPanel(new GridBagLayout()); List<ConfiguredLanguage> configuredLanguages = ConfiguredLanguage.getConfiguredLanguages(); languageSelector = new JComboBox(configuredLanguages.toArray()); languageSelector.setSelectedIndex(0); languageSelector.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { setSyntaxStyle(); } }); currentFileLabel = new JLabel(); final JFileChooser jFileChooser = new JFileChooser(); jFileChooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "Tank XML Files"; } @Override public boolean accept(File f) { return f.isDirectory() || f.getName().toLowerCase().endsWith("_ts.xml"); } }); JButton button = new JButton("Select File..."); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int showOpenDialog = jFileChooser.showOpenDialog(ScriptFilterRunner.this); if (showOpenDialog == JFileChooser.APPROVE_OPTION) { loadTSXml(jFileChooser.getSelectedFile()); } } }); xmlViewDialog = new XMlViewDialog(this); xmlViewDialog.setSize(new Dimension(800, 500)); showXmlBT = new JButton("Show XML"); showXmlBT.setEnabled(false); showXmlBT.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { displayXml(); } }); saveBT = new JButton("Save XML"); saveBT.setEnabled(false); saveBT.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveXml(); } }); JPanel xmlPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 20)); xmlPanel.add(button); xmlPanel.add(showXmlBT); xmlPanel.add(saveBT); int y = 0; topPanel.add(new JLabel("Current Tank XML: "), getConstraints(0, y, GridBagConstraints.NONE)); topPanel.add(currentFileLabel, getConstraints(1, y++, GridBagConstraints.HORIZONTAL)); topPanel.add(new JLabel("Select Script Language: "), getConstraints(0, y, GridBagConstraints.NONE)); topPanel.add(languageSelector, getConstraints(1, y++, GridBagConstraints.HORIZONTAL)); topPanel.add(new JLabel("Select Tank XML: "), getConstraints(0, y, GridBagConstraints.NONE)); topPanel.add(xmlPanel, getConstraints(1, y++, GridBagConstraints.HORIZONTAL)); return topPanel; }
From source file:hermes.browser.dialog.EditNamingConfigDialog.java
public JComponent createContentPanel() { topPanel.setLayout(new BorderLayout()); topPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); comboBox = new JComboBox(createComboBoxModel()); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSelectionChanged();/*from w w w . jav a 2 s . c om*/ } }); topPanel.add(comboBox, BorderLayout.NORTH); topPanel.add(scrollPane, BorderLayout.CENTER); comboBox.setSelectedItem(selectedConfig); return topPanel; }
From source file:net.sourceforge.doddle_owl.ui.InputDocumentSelectionPanel.java
public InputDocumentSelectionPanel(InputTermSelectionPanel iwsPanel, DODDLEProject p) { project = p;/*from www . java 2 s.c om*/ inputTermSelectionPanel = iwsPanel; termInfoMap = new HashMap<String, TermInfo>(); stopWordSet = new HashSet<String>(); docList = new JList(new DefaultListModel()); docList.addListSelectionListener(this); JScrollPane docListScroll = new JScrollPane(docList); inputDocList = new JList(new DefaultListModel()); inputDocList.addListSelectionListener(this); JScrollPane inputDocListScroll = new JScrollPane(inputDocList); DefaultComboBoxModel docLangBoxModel = new DefaultComboBoxModel(new Object[] { "en", "ja" }); docLangBox = new JComboBox(docLangBoxModel); docLangBox.addActionListener(this); addDocButton = new JButton(new AddDocAction(Translator.getTerm("AddDocumentButton"))); removeDocButton = new JButton(new RemoveDocAction(Translator.getTerm("RemoveDocumentButton"))); DefaultComboBoxModel inputDocLangBoxModel = new DefaultComboBoxModel(new Object[] { "en", "ja" }); inputDocLangBox = new JComboBox(inputDocLangBoxModel); inputDocLangBox.addActionListener(this); addInputDocButton = new JButton(new AddInputDocAction(Translator.getTerm("AddInputDocumentButton"))); removeInputDocButton = new JButton( new RemoveInputDocAction(Translator.getTerm("RemoveInputDocumentButton"))); inputDocArea = new JTextArea(); inputDocArea.setLineWrap(true); JScrollPane inputDocAreaScroll = new JScrollPane(inputDocArea); JPanel docButtonPanel = new JPanel(); docButtonPanel.setLayout(new BorderLayout()); docButtonPanel.setLayout(new GridLayout(1, 3)); docButtonPanel.add(docLangBox); docButtonPanel.add(addDocButton); docButtonPanel.add(removeDocButton); JPanel docPanel = new JPanel(); docPanel.setLayout(new BorderLayout()); docPanel.add(docListScroll, BorderLayout.CENTER); docPanel.add(docButtonPanel, BorderLayout.SOUTH); punctuationField = new JTextField(10); punctuationField.setText(PUNCTUATION_CHARS); setPunctuationButton = new JButton(Translator.getTerm("SetPunctuationCharacterButton")); setPunctuationButton.addActionListener(this); JPanel punctuationPanel = new JPanel(); punctuationPanel.add(punctuationField); punctuationPanel.add(setPunctuationButton); JPanel inputDocButtonPanel = new JPanel(); inputDocButtonPanel.setLayout(new GridLayout(1, 3)); inputDocButtonPanel.add(inputDocLangBox); inputDocButtonPanel.add(addInputDocButton); inputDocButtonPanel.add(removeInputDocButton); JPanel southPanel = new JPanel(); southPanel.setLayout(new BorderLayout()); southPanel.add(inputDocButtonPanel, BorderLayout.WEST); southPanel.add(punctuationPanel, BorderLayout.EAST); JPanel inputDocPanel = new JPanel(); inputDocPanel.setLayout(new BorderLayout()); inputDocPanel.add(inputDocListScroll, BorderLayout.CENTER); inputDocPanel.add(southPanel, BorderLayout.SOUTH); termExtractionButton = new JButton(Translator.getTerm("InputTermExtractionButton"), Utils.getImageIcon("input_term_selection.png")); termExtractionButton.addActionListener(this); genSenCheckBox = new JCheckBox(Translator.getTerm("GensenCheckBox")); genSenCheckBox.setSelected(false); cabochaCheckBox = new JCheckBox(Translator.getTerm("CabochaCheckBox")); cabochaCheckBox.setSelected(true); showImportanceCheckBox = new JCheckBox("??"); nounCheckBox = new JCheckBox(Translator.getTerm("NounCheckBox")); nounCheckBox.setSelected(true); verbCheckBox = new JCheckBox(Translator.getTerm("VerbCheckBox")); verbCheckBox.setSelected(false); otherCheckBox = new JCheckBox(Translator.getTerm("OtherPOSCheckBox")); oneWordCheckBox = new JCheckBox(Translator.getTerm("OneCharacterCheckBox")); JPanel morphemeAnalysisPanel = new JPanel(); morphemeAnalysisPanel.add(genSenCheckBox); morphemeAnalysisPanel.add(cabochaCheckBox); morphemeAnalysisPanel.add(nounCheckBox); morphemeAnalysisPanel.add(verbCheckBox); morphemeAnalysisPanel.add(otherCheckBox); morphemeAnalysisPanel.add(oneWordCheckBox); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BorderLayout()); buttonPanel.add(morphemeAnalysisPanel, BorderLayout.WEST); buttonPanel.add(termExtractionButton, BorderLayout.EAST); mainViews = new View[2]; ViewMap viewMap = new ViewMap(); // mainViews[0] = new View(Translator.getTerm("DocumentList"), null, // docPanel); mainViews[0] = new View(Translator.getTerm("InputDocumentList"), null, inputDocPanel); mainViews[1] = new View(Translator.getTerm("InputDocumentArea"), null, inputDocAreaScroll); for (int i = 0; i < mainViews.length; i++) { viewMap.addView(i, mainViews[i]); } rootWindow = Utils.createDODDLERootWindow(viewMap); setLayout(new BorderLayout()); add(rootWindow, BorderLayout.CENTER); add(buttonPanel, BorderLayout.SOUTH); }
From source file:com.streamhub.StreamHubLicenseGenerator.java
private static JPanel createMacAddressRow() { JPanel macAddressPanel = new JPanel(new FlowLayout()); Calendar yesterday = Calendar.getInstance(); yesterday.setTime(new Date()); yesterday.add(Calendar.DAY_OF_MONTH, -1); Calendar expiry = Calendar.getInstance(); expiry.setTime(yesterday.getTime()); expiry.add(Calendar.DAY_OF_MONTH, 60); JLabel macAddressLabel = new JLabel("MAC Address:"); JTextField macAddress = new JTextField(17); JLabel startDateLabel = new JLabel("Start Date"); final JFormattedTextField startDate = new JFormattedTextField(new SimpleDateFormat(DATE_FORMAT)); startDate.setValue(yesterday.getTime()); JLabel expiryDateLabel = new JLabel("Expiry Date"); final JFormattedTextField expiryDate = new JFormattedTextField(new SimpleDateFormat(DATE_FORMAT)); expiryDate.setValue(expiry.getTime()); startDate.addKeyListener(new KeyListener() { @Override//from ww w. j a va2 s . c o m public void keyTyped(KeyEvent arg0) { // Get the new date and change expiry to suit Date date = (Date) startDate.getValue(); Calendar tempCal = Calendar.getInstance(); tempCal.setTime(date); tempCal.add(Calendar.DAY_OF_MONTH, 60); expiryDate.setValue(tempCal.getTime()); } @Override public void keyPressed(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } }); JComboBox edition = new JComboBox(new String[] { "web", "enterprise" }); JLabel nameLabel = new JLabel("Name:"); JTextField name = new JTextField(15); JLabel numUsersLabel = new JLabel("Num. Users:"); JTextField numUsers = new JTextField(DEFAULT_NUM_USERS); macAddressPanel.add(macAddressLabel); macAddressPanel.add(macAddress); macAddressPanel.add(startDateLabel); macAddressPanel.add(startDate); macAddressPanel.add(expiryDateLabel); macAddressPanel.add(expiryDate); macAddressPanel.add(edition); macAddressPanel.add(nameLabel); macAddressPanel.add(name); macAddressPanel.add(numUsersLabel); macAddressPanel.add(numUsers); return macAddressPanel; }