List of usage examples for javax.swing BorderFactory createEtchedBorder
public static Border createEtchedBorder(int type)
From source file:com.digitalgeneralists.assurance.ui.components.ExclusionsPanel.java
@Override protected void initializeComponent() { if (!this.initialized) { if (this.exclusion == null) { this.mode = AssuranceDialogMode.ADD; this.dialogTitle = "Add New Exclusion"; this.exclusion = new FileReference(); } else {//from w w w . j a v a 2 s . co m this.mode = AssuranceDialogMode.EDIT; this.dialogTitle = "Edit Exclusion"; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel exclusionPathPanel = new JPanel(); exclusionPathPanel.setLayout(new GridBagLayout()); Border exclusionPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); exclusionPanelBorder = BorderFactory.createTitledBorder(exclusionPanelBorder, "Exclusion", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints exclusionPathPanelConstraints = new GridBagConstraints(); exclusionPathPanelConstraints.anchor = GridBagConstraints.NORTH; exclusionPathPanelConstraints.fill = GridBagConstraints.HORIZONTAL; exclusionPathPanelConstraints.gridx = 0; exclusionPathPanelConstraints.gridy = 0; exclusionPathPanelConstraints.weightx = 1.0; exclusionPathPanelConstraints.weighty = 1.0; exclusionPathPanelConstraints.gridheight = 1; exclusionPathPanelConstraints.gridwidth = 2; exclusionPathPanelConstraints.insets = new Insets(5, 5, 5, 5); exclusionPathPanel.setBorder(exclusionPanelBorder); this.add(exclusionPathPanel, exclusionPathPanelConstraints); GridBagConstraints exclusionPathFieldConstraints = new GridBagConstraints(); exclusionPathFieldConstraints.anchor = GridBagConstraints.NORTH; exclusionPathFieldConstraints.fill = GridBagConstraints.HORIZONTAL; exclusionPathFieldConstraints.gridx = 0; exclusionPathFieldConstraints.gridy = 1; exclusionPathFieldConstraints.weightx = 1.0; exclusionPathFieldConstraints.weighty = 1.0; exclusionPathFieldConstraints.gridheight = 1; exclusionPathFieldConstraints.gridwidth = 1; exclusionPathFieldConstraints.insets = new Insets(5, 5, 5, 5); exclusionPathPanel.add(this.exclusionPathTextFieldPicker, exclusionPathFieldConstraints); if (this.exclusion != null) { File exclusionPath = exclusion.getFile(); if (exclusionPath != null) { this.exclusionPathTextFieldPicker.setValue(exclusionPath.getPath()); } else { this.exclusionPathTextFieldPicker.setValue(""); } } this.initialized = true; } }
From source file:com.digitalgeneralists.assurance.ui.components.ScanPathMappingPanel.java
protected void initializeComponent() { if (!this.initialized) { if (this.mappingDefinition == null) { this.mode = AssuranceDialogMode.ADD; this.dialogTitle = "Add New Path Mapping"; this.mappingDefinition = new ScanMappingDefinition(); } else {//from www. j a v a2 s .co m this.mode = AssuranceDialogMode.EDIT; this.dialogTitle = "Edit Path Mapping"; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel scanPathsPanel = new JPanel(); scanPathsPanel.setLayout(new GridBagLayout()); Border pathsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); pathsPanelBorder = BorderFactory.createTitledBorder(pathsPanelBorder, "Paths", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints scanPathsPanelConstraints = new GridBagConstraints(); scanPathsPanelConstraints.anchor = GridBagConstraints.NORTH; scanPathsPanelConstraints.fill = GridBagConstraints.HORIZONTAL; scanPathsPanelConstraints.gridx = 0; scanPathsPanelConstraints.gridy = 0; scanPathsPanelConstraints.weightx = 1.0; scanPathsPanelConstraints.weighty = 1.0; scanPathsPanelConstraints.gridheight = 1; scanPathsPanelConstraints.gridwidth = 2; scanPathsPanelConstraints.insets = new Insets(5, 5, 5, 5); scanPathsPanel.setBorder(pathsPanelBorder); this.add(scanPathsPanel, scanPathsPanelConstraints); GridBagConstraints sourcePathFieldConstraints = new GridBagConstraints(); sourcePathFieldConstraints.anchor = GridBagConstraints.NORTH; sourcePathFieldConstraints.fill = GridBagConstraints.HORIZONTAL; sourcePathFieldConstraints.gridx = 0; sourcePathFieldConstraints.gridy = 0; sourcePathFieldConstraints.weightx = 1.0; sourcePathFieldConstraints.weighty = 1.0; sourcePathFieldConstraints.gridheight = 1; sourcePathFieldConstraints.gridwidth = 1; sourcePathFieldConstraints.insets = new Insets(0, 5, 5, 5); GridBagConstraints targetPathFieldConstraints = new GridBagConstraints(); targetPathFieldConstraints.anchor = GridBagConstraints.NORTH; targetPathFieldConstraints.fill = GridBagConstraints.HORIZONTAL; targetPathFieldConstraints.gridx = 0; targetPathFieldConstraints.gridy = 1; targetPathFieldConstraints.weightx = 1.0; targetPathFieldConstraints.weighty = 1.0; targetPathFieldConstraints.gridheight = 1; targetPathFieldConstraints.gridwidth = 1; targetPathFieldConstraints.insets = new Insets(5, 5, 5, 5); scanPathsPanel.add(this.sourcePathPickerField, sourcePathFieldConstraints); scanPathsPanel.add(this.targetPathPickerField, targetPathFieldConstraints); if (mappingDefinition != null) { File source = mappingDefinition.getSource(); if (source != null) { this.sourcePathPickerField.setValue(source.getPath()); } else { this.sourcePathPickerField.setValue(""); } File target = mappingDefinition.getTarget(); if (target != null) { this.targetPathPickerField.setValue(target.getPath()); } else { this.targetPathPickerField.setValue(""); } } Border existingExclusionsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); existingExclusionsPanelBorder = BorderFactory.createTitledBorder(existingExclusionsPanelBorder, "Exclusions", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints existingExclusionsPanelConstraints = new GridBagConstraints(); existingExclusionsPanelConstraints.anchor = GridBagConstraints.WEST; existingExclusionsPanelConstraints.fill = GridBagConstraints.BOTH; existingExclusionsPanelConstraints.gridx = 0; existingExclusionsPanelConstraints.gridy = 1; existingExclusionsPanelConstraints.weightx = 1.0; existingExclusionsPanelConstraints.weighty = 0.9; existingExclusionsPanelConstraints.gridheight = 1; existingExclusionsPanelConstraints.gridwidth = 2; existingExclusionsPanelConstraints.insets = new Insets(0, 5, 0, 5); JPanel existingExclusionsPanel = new JPanel(); GridBagLayout panelGridbag = new GridBagLayout(); existingExclusionsPanel.setLayout(panelGridbag); existingExclusionsPanel.setBorder(existingExclusionsPanelBorder); this.add(existingExclusionsPanel, existingExclusionsPanelConstraints); GridBagConstraints existingExclusionsListConstraints = new GridBagConstraints(); existingExclusionsListConstraints.anchor = GridBagConstraints.WEST; existingExclusionsListConstraints.fill = GridBagConstraints.BOTH; existingExclusionsListConstraints.gridx = 0; existingExclusionsListConstraints.gridy = 0; existingExclusionsListConstraints.weightx = 1.0; existingExclusionsListConstraints.weighty = 0.9; existingExclusionsListConstraints.gridheight = 1; existingExclusionsListConstraints.gridwidth = 2; existingExclusionsListConstraints.insets = new Insets(5, 5, 5, 5); this.mappingDefinition = (ScanMappingDefinition) ModelUtils.initializeEntity(this.mappingDefinition, ScanMappingDefinition.EXCLUSIONS_PROPERTY); this.exclusionsPanel = new ListInputPanel<FileReference>(this.mappingDefinition, this); existingExclusionsPanel.add(this.exclusionsPanel, existingExclusionsListConstraints); this.initialized = true; } }
From source file:com.digitalgeneralists.assurance.ui.components.SettingsPanel.java
@Override protected void initializeComponent() { if (!this.initialized) { this.dialogTitle = Application.applicationShortName + " Settings"; // NOTE: There is no notion of add-mode in this dialog. There should // always be a single instance of the application configuration. if (this.configuration == null) { this.configuration = ApplicationConfiguration.createDefaultConfiguration(); }/*from www . j a v a 2 s. c om*/ this.mode = AssuranceDialogMode.EDIT; GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel scanSettingsPanel = new JPanel(); scanSettingsPanel.setLayout(new GridBagLayout()); Border scanSettingsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); scanSettingsPanelBorder = BorderFactory.createTitledBorder(scanSettingsPanelBorder, "Scan Settings", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints scanSettingsPanelConstraints = new GridBagConstraints(); scanSettingsPanelConstraints.anchor = GridBagConstraints.NORTH; scanSettingsPanelConstraints.fill = GridBagConstraints.HORIZONTAL; scanSettingsPanelConstraints.gridx = 0; scanSettingsPanelConstraints.gridy = 0; scanSettingsPanelConstraints.weightx = 1.0; scanSettingsPanelConstraints.weighty = 1.0; scanSettingsPanelConstraints.gridheight = 1; scanSettingsPanelConstraints.gridwidth = 2; scanSettingsPanelConstraints.insets = new Insets(5, 5, 5, 5); scanSettingsPanel.setBorder(scanSettingsPanelBorder); this.add(scanSettingsPanel, scanSettingsPanelConstraints); GridBagConstraints ignoredFileNamesLabelConstraints = new GridBagConstraints(); ignoredFileNamesLabelConstraints.anchor = GridBagConstraints.NORTHWEST; ignoredFileNamesLabelConstraints.fill = GridBagConstraints.NONE; ignoredFileNamesLabelConstraints.gridx = 0; ignoredFileNamesLabelConstraints.gridy = 0; ignoredFileNamesLabelConstraints.weightx = 1.0; ignoredFileNamesLabelConstraints.weighty = 1.0; ignoredFileNamesLabelConstraints.gridheight = 1; ignoredFileNamesLabelConstraints.gridwidth = 1; ignoredFileNamesLabelConstraints.insets = new Insets(5, 10, 0, 5); final JLabel ignoredFileNamesLabel = new JLabel("Ignored Files", SwingConstants.LEFT); scanSettingsPanel.add(ignoredFileNamesLabel, ignoredFileNamesLabelConstraints); GridBagConstraints ignoredFileNamesTextFieldConstraints = new GridBagConstraints(); ignoredFileNamesTextFieldConstraints.anchor = GridBagConstraints.NORTH; ignoredFileNamesTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL; ignoredFileNamesTextFieldConstraints.gridx = 0; ignoredFileNamesTextFieldConstraints.gridy = 1; ignoredFileNamesTextFieldConstraints.weightx = 1.0; ignoredFileNamesTextFieldConstraints.weighty = 1.0; ignoredFileNamesTextFieldConstraints.gridheight = 1; ignoredFileNamesTextFieldConstraints.gridwidth = 2; ignoredFileNamesTextFieldConstraints.insets = new Insets(2, 5, 5, 5); GridBagConstraints ignoredFileExtensionsLabelConstraints = new GridBagConstraints(); ignoredFileExtensionsLabelConstraints.anchor = GridBagConstraints.NORTHWEST; ignoredFileExtensionsLabelConstraints.fill = GridBagConstraints.NONE; ignoredFileExtensionsLabelConstraints.gridx = 0; ignoredFileExtensionsLabelConstraints.gridy = 2; ignoredFileExtensionsLabelConstraints.weightx = 1.0; ignoredFileExtensionsLabelConstraints.weighty = 1.0; ignoredFileExtensionsLabelConstraints.gridheight = 1; ignoredFileExtensionsLabelConstraints.gridwidth = 1; ignoredFileExtensionsLabelConstraints.insets = new Insets(5, 10, 0, 5); final JLabel ignoredFileExtensionsLabel = new JLabel("Ignored File Extensions", SwingConstants.LEFT); scanSettingsPanel.add(ignoredFileExtensionsLabel, ignoredFileExtensionsLabelConstraints); GridBagConstraints ignoredFileExtensionsTextFieldConstraints = new GridBagConstraints(); ignoredFileExtensionsTextFieldConstraints.anchor = GridBagConstraints.NORTH; ignoredFileExtensionsTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL; ignoredFileExtensionsTextFieldConstraints.gridx = 0; ignoredFileExtensionsTextFieldConstraints.gridy = 3; ignoredFileExtensionsTextFieldConstraints.weightx = 1.0; ignoredFileExtensionsTextFieldConstraints.weighty = 1.0; ignoredFileExtensionsTextFieldConstraints.gridheight = 1; ignoredFileExtensionsTextFieldConstraints.gridwidth = 2; ignoredFileExtensionsTextFieldConstraints.insets = new Insets(2, 5, 5, 5); scanSettingsPanel.add(this.ignoredFileNamesTextField, ignoredFileNamesTextFieldConstraints); this.ignoredFileNamesTextField.getDocument().addDocumentListener(this.textPropertyValidationListener); scanSettingsPanel.add(this.ignoredFileExtensionsTextField, ignoredFileExtensionsTextFieldConstraints); this.ignoredFileExtensionsTextField.getDocument() .addDocumentListener(this.textPropertyValidationListener); GridBagConstraints numberScanThreadsLabelConstraints = new GridBagConstraints(); numberScanThreadsLabelConstraints.anchor = GridBagConstraints.NORTH; numberScanThreadsLabelConstraints.fill = GridBagConstraints.NONE; numberScanThreadsLabelConstraints.gridx = 0; numberScanThreadsLabelConstraints.gridy = 4; numberScanThreadsLabelConstraints.weightx = 1.0; numberScanThreadsLabelConstraints.weighty = 1.0; numberScanThreadsLabelConstraints.gridheight = 1; numberScanThreadsLabelConstraints.gridwidth = 1; numberScanThreadsLabelConstraints.insets = new Insets(10, 5, 0, 5); final JLabel numberOfThreadsLabel = new JLabel("Number of Threads", SwingConstants.RIGHT); scanSettingsPanel.add(numberOfThreadsLabel, numberScanThreadsLabelConstraints); GridBagConstraints numberScanThreadsSpinnerConstraints = new GridBagConstraints(); numberScanThreadsSpinnerConstraints.anchor = GridBagConstraints.NORTHWEST; numberScanThreadsSpinnerConstraints.fill = GridBagConstraints.NONE; numberScanThreadsSpinnerConstraints.gridx = 1; numberScanThreadsSpinnerConstraints.gridy = 4; numberScanThreadsSpinnerConstraints.weightx = 1.0; numberScanThreadsSpinnerConstraints.weighty = 1.0; numberScanThreadsSpinnerConstraints.gridheight = 1; numberScanThreadsSpinnerConstraints.gridwidth = 1; numberScanThreadsSpinnerConstraints.insets = new Insets(5, 5, 5, 5); scanSettingsPanel.add(this.numberScanThreadsSpinner, numberScanThreadsSpinnerConstraints); if (this.configuration != null) { this.ignoredFileNamesTextField.setText(this.configuration.getIgnoredFileNames()); this.ignoredFileExtensionsTextField.setText(this.configuration.getIgnoredFileExtensions()); this.numberScanThreadsSpinner.setValue(this.configuration.getNumberOfScanThreads()); } this.initialized = true; } }
From source file:com._17od.upm.gui.OptionsDialog.java
public OptionsDialog(JFrame frame) { super(frame, Translator.translate("options"), true); Container container = getContentPane(); // Create a pane with an empty border for spacing Border emptyBorder = BorderFactory.createEmptyBorder(2, 5, 5, 5); JPanel emptyBorderPanel = new JPanel(); emptyBorderPanel.setLayout(new BoxLayout(emptyBorderPanel, BoxLayout.Y_AXIS)); emptyBorderPanel.setBorder(emptyBorder); container.add(emptyBorderPanel);/*from w w w.j a v a 2 s. co m*/ // ****************** // *** The DB TO Load On Startup Section // ****************** // Create a pane with an title etched border Border etchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); Border etchedTitleBorder = BorderFactory.createTitledBorder(etchedBorder, ' ' + Translator.translate("general") + ' '); JPanel mainPanel = new JPanel(new GridBagLayout()); mainPanel.setBorder(etchedTitleBorder); emptyBorderPanel.add(mainPanel); GridBagConstraints c = new GridBagConstraints(); // The "Database to Load on Startup" row JLabel urlLabel = new JLabel(Translator.translate("dbToLoadOnStartup")); c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 3, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.NONE; mainPanel.add(urlLabel, c); // The "Database to Load on Startup" input field row dbToLoadOnStartup = new JTextField(Preferences.get(Preferences.ApplicationOptions.DB_TO_LOAD_ON_STARTUP), 25); dbToLoadOnStartup.setHorizontalAlignment(JTextField.LEFT); c.gridx = 0; c.gridy = 1; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 5); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(dbToLoadOnStartup, c); JButton dbToLoadOnStartupButton = new JButton("..."); dbToLoadOnStartupButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getDBToLoadOnStartup(); } }); c.gridx = 1; c.gridy = 1; c.anchor = GridBagConstraints.LINE_END; c.insets = new Insets(0, 0, 5, 5); c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; mainPanel.add(dbToLoadOnStartupButton, c); // The "Language" label row JLabel localeLabel = new JLabel(Translator.translate("language")); c.gridx = 0; c.gridy = 2; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 3, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.NONE; mainPanel.add(localeLabel, c); // The "Locale" field row localeComboBox = new JComboBox(getSupportedLocaleNames()); for (int i = 0; i < localeComboBox.getItemCount(); i++) { // If the locale language is blank then set it to the English language // I'm not sure why this happens. Maybe it's because the default locale // is English??? String currentLanguage = Translator.getCurrentLocale().getLanguage(); if (currentLanguage.equals("")) { currentLanguage = "en"; } if (currentLanguage.equals(Translator.SUPPORTED_LOCALES[i].getLanguage())) { localeComboBox.setSelectedIndex(i); break; } } c.gridx = 0; c.gridy = 3; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 8, 5); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(localeComboBox, c); // The "Hide account password" row Boolean hideAccountPassword = new Boolean( Preferences.get(Preferences.ApplicationOptions.ACCOUNT_HIDE_PASSWORD, "true")); hideAccountPasswordCheckbox = new JCheckBox(Translator.translate("hideAccountPassword"), hideAccountPassword.booleanValue()); c.gridx = 0; c.gridy = 4; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 2, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; mainPanel.add(hideAccountPasswordCheckbox, c); // The "Database auto lock" row Boolean databaseAutoLock = new Boolean( Preferences.get(Preferences.ApplicationOptions.DATABASE_AUTO_LOCK, "false")); databaseAutoLockCheckbox = new JCheckBox(Translator.translate("databaseAutoLock"), databaseAutoLock.booleanValue()); c.gridx = 0; c.gridy = 5; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 2, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; mainPanel.add(databaseAutoLockCheckbox, c); databaseAutoLockCheckbox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { databaseAutoLockTime.setEnabled(e.getStateChange() == ItemEvent.SELECTED); } }); // The "Database auto lock" field row databaseAutoLockTime = new JTextField( Preferences.get(Preferences.ApplicationOptions.DATABASE_AUTO_LOCK_TIME), 5); c.gridx = 1; c.gridy = 5; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(databaseAutoLockTime, c); databaseAutoLockTime.setEnabled(databaseAutoLockCheckbox.isSelected()); // The "Generated password length" row accountPasswordLengthLabel = new JLabel(Translator.translate("generatedPasswodLength")); c.gridx = 0; c.gridy = 6; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 2, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; mainPanel.add(accountPasswordLengthLabel, c); accountPasswordLength = new JTextField( Preferences.get(Preferences.ApplicationOptions.ACCOUNT_PASSWORD_LENGTH, "8"), 5); c.gridx = 1; c.gridy = 6; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(accountPasswordLength, c); // Some spacing emptyBorderPanel.add(Box.createVerticalGlue()); // ****************** // *** The HTTPS Section // ****************** // Create a pane with an title etched border Border httpsEtchedTitleBorder = BorderFactory.createTitledBorder(etchedBorder, " HTTPS "); final JPanel httpsPanel = new JPanel(new GridBagLayout()); httpsPanel.setBorder(httpsEtchedTitleBorder); emptyBorderPanel.add(httpsPanel); // The "Accept Self Sigend Certificates" checkbox row Boolean acceptSelfSignedCerts = new Boolean( Preferences.get(Preferences.ApplicationOptions.HTTPS_ACCEPT_SELFSIGNED_CERTS, "false")); acceptSelfSignedCertsCheckbox = new JCheckBox(Translator.translate("acceptSelfSignedCerts"), acceptSelfSignedCerts.booleanValue()); c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 2, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; httpsPanel.add(acceptSelfSignedCertsCheckbox, c); // ****************** // *** The Proxy Section // ****************** // Create a pane with an title etched border Border proxyEtchedTitleBorder = BorderFactory.createTitledBorder(etchedBorder, ' ' + Translator.translate("httpProxy") + ' '); final JPanel proxyPanel = new JPanel(new GridBagLayout()); proxyPanel.setBorder(proxyEtchedTitleBorder); emptyBorderPanel.add(proxyPanel); // The "Enable Proxy" row Boolean proxyEnabled = new Boolean(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_ENABLED)); enableProxyCheckbox = new JCheckBox(Translator.translate("enableProxy"), proxyEnabled.booleanValue()); enableProxyCheckbox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { enableProxyComponents(true); } else { enableProxyComponents(false); } } }); c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 2, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; proxyPanel.add(enableProxyCheckbox, c); // The "HTTP Proxy" label row proxyLabel = new JLabel(Translator.translate("httpProxy")); c.gridx = 0; c.gridy = 1; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 3, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.NONE; proxyPanel.add(proxyLabel, c); // The "HTTP Proxy Port" label proxyPortLabel = new JLabel(Translator.translate("port")); c.gridx = 1; c.gridy = 1; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 3, 5); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; proxyPanel.add(proxyPortLabel, c); // The "HTTP Proxy" field row httpProxyHost = new JTextField(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_HOST), 20); c.gridx = 0; c.gridy = 2; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; proxyPanel.add(httpProxyHost, c); httpProxyPort = new JTextField(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_PORT), 6); c.gridx = 1; c.gridy = 2; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 5); c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; proxyPanel.add(httpProxyPort, c); // The "HTTP Proxy Username" label row proxyUsernameLabel = new JLabel(Translator.translate("httpProxyUsername")); c.gridx = 0; c.gridy = 3; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 3, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.NONE; proxyPanel.add(proxyUsernameLabel, c); // The "HTTP Proxy Username" field row httpProxyUsername = new JTextField(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_USERNAME), 20); c.gridx = 0; c.gridy = 4; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 5); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.HORIZONTAL; proxyPanel.add(httpProxyUsername, c); // The "HTTP Proxy Password" label row proxyPasswordLabel = new JLabel(Translator.translate("httpProxyPassword")); c.gridx = 0; c.gridy = 5; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 3, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.NONE; proxyPanel.add(proxyPasswordLabel, c); // The "HTTP Proxy Password" field row String encodedPassword = Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_PASSWORD); String decodedPassword = null; if (encodedPassword != null) { decodedPassword = new String(Base64.decodeBase64(encodedPassword.getBytes())); } httpProxyPassword = new JPasswordField(decodedPassword, 20); c.gridx = 0; c.gridy = 6; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 5); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; proxyPanel.add(httpProxyPassword, c); hidePasswordCheckbox = new JCheckBox(Translator.translate("hide"), true); defaultEchoChar = httpProxyPassword.getEchoChar(); hidePasswordCheckbox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { httpProxyPassword.setEchoChar(defaultEchoChar); } else { httpProxyPassword.setEchoChar((char) 0); } } }); c.gridx = 1; c.gridy = 6; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 0); c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; proxyPanel.add(hidePasswordCheckbox, c); // Some spacing emptyBorderPanel.add(Box.createVerticalGlue()); // The buttons row JPanel buttonPanel = new JPanel(new FlowLayout()); emptyBorderPanel.add(buttonPanel); JButton okButton = new JButton(Translator.translate("ok")); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okButtonAction(); } }); buttonPanel.add(okButton); JButton cancelButton = new JButton(Translator.translate("cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); dispose(); } }); buttonPanel.add(cancelButton); enableProxyComponents(proxyEnabled.booleanValue()); }
From source file:com.digitexx.ancestry.gui.FrmUpperLowerData.java
private void initGUI() { try {//w ww . j av a2s . com this.setTitle("Uppercase & Lowercase data"); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); AnchorLayout thisLayout = new AnchorLayout(); getContentPane().setLayout(thisLayout); { panelMain = new JPanel(); BorderLayout panelMainLayout = new BorderLayout(); panelMain.setLayout(panelMainLayout); getContentPane().add(panelMain, new AnchorConstraint(0, 1000, 944, 0, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); panelMain.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); panelMain.setPreferredSize(new java.awt.Dimension(775, 488)); { splitPaneMain = new JSplitPane(); panelMain.add(splitPaneMain, BorderLayout.CENTER); splitPaneMain.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPaneMain.setDividerLocation(200); { panelColumnLog = new JPanel(); BorderLayout panelLogLayout = new BorderLayout(); panelColumnLog.setLayout(panelLogLayout); splitPaneMain.add(panelColumnLog, JSplitPane.RIGHT); panelColumnLog.setPreferredSize(new java.awt.Dimension(417, 482)); { splitPaneColumnAndLog = new JSplitPane(); panelColumnLog.add(splitPaneColumnAndLog, BorderLayout.CENTER); splitPaneColumnAndLog.setDividerLocation(200); { panelLog = new JPanel(); BorderLayout panelLogLayout1 = new BorderLayout(); panelLog.setLayout(panelLogLayout1); splitPaneColumnAndLog.add(panelLog, JSplitPane.RIGHT); { scrollPaneLog = new JScrollPane(); panelLog.add(scrollPaneLog, BorderLayout.CENTER); { textPaneLog = new JTextPane(); scrollPaneLog.setViewportView(textPaneLog); } } } { panelColumn = new JPanel(); BorderLayout panelColumnLayout = new BorderLayout(); panelColumn.setLayout(panelColumnLayout); splitPaneColumnAndLog.add(panelColumn, JSplitPane.LEFT); { scrollPaneColumn = new JScrollPane(); panelColumn.add(scrollPaneColumn, BorderLayout.CENTER); { tableField = new JTable() { @Override public boolean isCellEditable(int row, int column) { if (getColumnName(column).equals("Check")) { return true; } else { return false; } } @Override public Class<?> getColumnClass(int column) { if (getColumnName(column).equals("Check")) { return Boolean.class; } else { return super.getColumnClass(column); } } }; scrollPaneColumn.setViewportView(tableField); } } } } } { panelPath = new JPanel(); BorderLayout panelPathLayout = new BorderLayout(); panelPath.setLayout(panelPathLayout); splitPaneMain.add(panelPath, JSplitPane.LEFT); panelPath.setPreferredSize(new java.awt.Dimension(769, 316)); { scrollPanePath = new JScrollPane(); panelPath.add(scrollPanePath, BorderLayout.CENTER); { jListPath = new JList(); scrollPanePath.setViewportView(jListPath); jListPath.setFont(new java.awt.Font("Arial", 0, 14)); } } } } } { panelFooter = new JPanel(); AnchorLayout panelFooterLayout = new AnchorLayout(); getContentPane().add(panelFooter, new AnchorConstraint(944, 1000, 1000, 0, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); panelFooter.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); panelFooter.setLayout(panelFooterLayout); panelFooter.setPreferredSize(new java.awt.Dimension(775, 29)); { buttonRun = new JButton(); panelFooter.add(buttonRun, new AnchorConstraint(86, 998, 948, 890, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); buttonRun.setText("Run"); buttonRun.setFont(new java.awt.Font("Arial", 1, 16)); buttonRun.setPreferredSize(new java.awt.Dimension(83, 25)); buttonRun.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { buttonRunActionPerformed(evt); } }); } { checkboxRework = new JCheckBox(); panelFooter.add(checkboxRework, new AnchorConstraint(86, 155, 948, 3, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); checkboxRework.setText("Rework"); checkboxRework.setFont(new java.awt.Font("Arial", 1, 16)); checkboxRework.setForeground(new java.awt.Color(255, 0, 0)); checkboxRework.setPreferredSize(new java.awt.Dimension(118, 25)); checkboxRework.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { checkboxReworkActionPerformed(evt); } }); } } pack(); this.setSize(783, 551); AppUtility.centerFrame(this); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { exit(); } }); ; } catch (Exception e) { e.printStackTrace(); } }
From source file:com.digitalgeneralists.assurance.ui.components.FileAttributesPanel.java
private void initializeComponent() { if (!this.initialized) { if (this.file == null) { this.dialogTitle = "No File Provided"; this.file = null; } else {// www . j av a 2 s. c o m StringBuilder title = new StringBuilder(128); this.dialogTitle = title.append("Attributes for ").append(file.getFile().getName()).toString(); title.setLength(0); title = null; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); GridBagConstraints filePanelConstraints = new GridBagConstraints(); filePanelConstraints.anchor = GridBagConstraints.NORTH; filePanelConstraints.fill = GridBagConstraints.HORIZONTAL; filePanelConstraints.gridx = 0; filePanelConstraints.gridy = 0; filePanelConstraints.weightx = 1.0; filePanelConstraints.weighty = 0.1; filePanelConstraints.gridheight = 1; filePanelConstraints.gridwidth = 1; filePanelConstraints.insets = new Insets(5, 5, 5, 5); final JPanel filePanel = new JPanel(); filePanel.setLayout(new GridBagLayout()); GridBagConstraints filePathValueConstraints = new GridBagConstraints(); filePathValueConstraints.anchor = GridBagConstraints.WEST; filePathValueConstraints.gridx = 0; filePathValueConstraints.gridy = 0; filePathValueConstraints.weightx = 1.0; filePathValueConstraints.weighty = 1.0; filePathValueConstraints.gridheight = 1; filePathValueConstraints.gridwidth = 1; filePathValueConstraints.insets = new Insets(5, 5, 5, 5); String filePath = "File is null."; if (file != null) { File diskFile = file.getFile(); if (diskFile == null) { filePath = "The disk file is not set."; } else { filePath = diskFile.getPath(); } diskFile = null; } JLabel filePathValue = new JLabel(filePath); filePath = null; filePanel.add(filePathValue, filePathValueConstraints); this.add(filePanel, filePanelConstraints); Border attributesBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); attributesBorder = BorderFactory.createTitledBorder(attributesBorder, "File Attributes", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints attributesPanelConstraints = new GridBagConstraints(); attributesPanelConstraints.anchor = GridBagConstraints.SOUTH; attributesPanelConstraints.fill = GridBagConstraints.BOTH; attributesPanelConstraints.gridx = 0; attributesPanelConstraints.gridy = 1; attributesPanelConstraints.weightx = 1.0; attributesPanelConstraints.weighty = 0.9; attributesPanelConstraints.gridheight = 1; attributesPanelConstraints.gridwidth = 1; attributesPanelConstraints.insets = new Insets(0, 5, 5, 5); JPanel attributesPanel = this.createFileAttributesPanel(file); attributesPanel.setBorder(attributesBorder); this.add(attributesPanel, attributesPanelConstraints); this.initialized = true; } }
From source file:com.digitalgeneralists.assurance.ui.components.ScanDefinitionPanel.java
@Override protected void initializeComponent() { if (!this.initialized) { if (this.definition == null) { mode = AssuranceDialogMode.ADD; this.dialogTitle = "Add New Scan Definition"; this.definition = new ScanDefinition(); } else {//w w w . jav a 2 s .c o m mode = AssuranceDialogMode.EDIT; this.dialogTitle = "Edit Scan Definition"; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel optionsPanel = new JPanel(); optionsPanel.setLayout(new GridBagLayout()); Border optionsBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); optionsBorder = BorderFactory.createTitledBorder(optionsBorder, "Merge Options", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints nameTextFieldConstraints = new GridBagConstraints(); nameTextFieldConstraints.anchor = GridBagConstraints.NORTH; nameTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL; nameTextFieldConstraints.gridx = 0; nameTextFieldConstraints.gridy = 0; nameTextFieldConstraints.weightx = 1.0; nameTextFieldConstraints.weighty = 1.0; nameTextFieldConstraints.gridheight = 1; nameTextFieldConstraints.gridwidth = 2; nameTextFieldConstraints.insets = new Insets(10, 5, 0, 5); this.nameTextField.setText(this.definition.getName()); this.nameTextField.getDocument().addDocumentListener(this.textPropertyValidationListener); this.add(this.nameTextField, nameTextFieldConstraints); Border existingScanMappingsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); existingScanMappingsPanelBorder = BorderFactory.createTitledBorder(existingScanMappingsPanelBorder, "Paths", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints existingScanMappingsPanelConstraints = new GridBagConstraints(); existingScanMappingsPanelConstraints.anchor = GridBagConstraints.WEST; existingScanMappingsPanelConstraints.fill = GridBagConstraints.BOTH; existingScanMappingsPanelConstraints.gridx = 0; existingScanMappingsPanelConstraints.gridy = 1; existingScanMappingsPanelConstraints.weightx = 1.0; existingScanMappingsPanelConstraints.weighty = 1.0; existingScanMappingsPanelConstraints.gridheight = 1; existingScanMappingsPanelConstraints.gridwidth = 2; existingScanMappingsPanelConstraints.insets = new Insets(5, 5, 0, 5); JPanel existingScanMappingsPanel = new JPanel(); GridBagLayout panelGridbag = new GridBagLayout(); existingScanMappingsPanel.setLayout(panelGridbag); existingScanMappingsPanel.setBorder(existingScanMappingsPanelBorder); this.add(existingScanMappingsPanel, existingScanMappingsPanelConstraints); GridBagConstraints existingScanMappingsListConstraints = new GridBagConstraints(); existingScanMappingsListConstraints.anchor = GridBagConstraints.WEST; existingScanMappingsListConstraints.fill = GridBagConstraints.BOTH; existingScanMappingsListConstraints.gridx = 0; existingScanMappingsListConstraints.gridy = 0; existingScanMappingsListConstraints.weightx = 1.0; existingScanMappingsListConstraints.weighty = 0.9; existingScanMappingsListConstraints.gridheight = 1; existingScanMappingsListConstraints.gridwidth = 2; existingScanMappingsListConstraints.insets = new Insets(5, 5, 5, 5); this.definition = (ScanDefinition) ModelUtils.initializeEntity(this.definition, ScanDefinition.SCAN_MAPPING_PROPERTY); this.scanMappingsList = new ListInputPanel<ScanMappingDefinition>(this.definition, this); existingScanMappingsPanel.add(this.scanMappingsList, existingScanMappingsListConstraints); GridBagConstraints optionsPanelConstraints = new GridBagConstraints(); optionsPanelConstraints.anchor = GridBagConstraints.SOUTH; optionsPanelConstraints.fill = GridBagConstraints.HORIZONTAL; optionsPanelConstraints.gridx = 0; optionsPanelConstraints.gridy = 3; optionsPanelConstraints.weightx = 1.0; optionsPanelConstraints.weighty = 1.0; optionsPanelConstraints.gridheight = 1; optionsPanelConstraints.gridwidth = 2; optionsPanelConstraints.insets = new Insets(5, 5, 5, 5); optionsPanel.setBorder(optionsBorder); this.add(optionsPanel, optionsPanelConstraints); GridBagConstraints strategyLabelConstraints = new GridBagConstraints(); strategyLabelConstraints.anchor = GridBagConstraints.WEST; strategyLabelConstraints.fill = GridBagConstraints.BOTH; strategyLabelConstraints.gridx = 0; strategyLabelConstraints.gridy = 0; strategyLabelConstraints.weightx = 1.0; strategyLabelConstraints.weighty = 1.0; strategyLabelConstraints.gridheight = 1; strategyLabelConstraints.gridwidth = 1; strategyLabelConstraints.insets = new Insets(5, 5, 0, 5); final JLabel strategyLabel = new JLabel("Strategy", SwingConstants.RIGHT); optionsPanel.add(strategyLabel, strategyLabelConstraints); GridBagConstraints strategyComboBoxConstraints = new GridBagConstraints(); strategyComboBoxConstraints.anchor = GridBagConstraints.WEST; strategyComboBoxConstraints.fill = GridBagConstraints.VERTICAL; strategyComboBoxConstraints.gridx = 1; strategyComboBoxConstraints.gridy = 0; strategyComboBoxConstraints.weightx = 1.0; strategyComboBoxConstraints.weighty = 1.0; strategyComboBoxConstraints.gridheight = 1; strategyComboBoxConstraints.gridwidth = 1; strategyComboBoxConstraints.insets = new Insets(5, 5, 0, 5); String[] strategyLabels = { "Source", "Target", "Both" }; this.strategyComboBox = new JComboBox<String>(strategyLabels); // NOTE: We should have better validation of the data state for these controls. // We could run into problems as the application versions over time. this.strategyComboBox.setSelectedIndex(this.definition.getMergeStrategy().ordinal()); this.strategyComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { validateFormState(); } }); optionsPanel.add(this.strategyComboBox, strategyComboBoxConstraints); GridBagConstraints autoMergeCheckBoxConstraints = new GridBagConstraints(); autoMergeCheckBoxConstraints.gridx = 0; autoMergeCheckBoxConstraints.gridy = 1; autoMergeCheckBoxConstraints.weightx = 1.0; autoMergeCheckBoxConstraints.weighty = 1.0; autoMergeCheckBoxConstraints.gridheight = 1; autoMergeCheckBoxConstraints.gridwidth = 2; autoMergeCheckBoxConstraints.insets = new Insets(2, 5, 5, 5); this.autoMergeCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.autoMergeCheckBox.setSelected(this.definition.getAutoResolveConflicts()); this.autoMergeCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { validateFormState(); } }); optionsPanel.add(this.autoMergeCheckBox, autoMergeCheckBoxConstraints); GridBagConstraints includeNonCreationTimestampsCheckBoxConstraints = new GridBagConstraints(); includeNonCreationTimestampsCheckBoxConstraints.gridx = 0; includeNonCreationTimestampsCheckBoxConstraints.gridy = 2; includeNonCreationTimestampsCheckBoxConstraints.weightx = 1.0; includeNonCreationTimestampsCheckBoxConstraints.weighty = 1.0; includeNonCreationTimestampsCheckBoxConstraints.gridheight = 1; includeNonCreationTimestampsCheckBoxConstraints.gridwidth = 2; includeNonCreationTimestampsCheckBoxConstraints.insets = new Insets(2, 5, 5, 5); this.includeNonCreationTimestampCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.includeNonCreationTimestampCheckBox.setSelected(this.definition.getIncludeNonCreationTimestamps()); this.includeNonCreationTimestampCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { validateFormState(); } }); optionsPanel.add(this.includeNonCreationTimestampCheckBox, includeNonCreationTimestampsCheckBoxConstraints); GridBagConstraints advancedAttributesCheckBoxConstraints = new GridBagConstraints(); advancedAttributesCheckBoxConstraints.gridx = 0; advancedAttributesCheckBoxConstraints.gridy = 3; advancedAttributesCheckBoxConstraints.weightx = 1.0; advancedAttributesCheckBoxConstraints.weighty = 1.0; advancedAttributesCheckBoxConstraints.gridheight = 1; advancedAttributesCheckBoxConstraints.gridwidth = 2; advancedAttributesCheckBoxConstraints.insets = new Insets(2, 5, 5, 5); this.includeAdvancedAttributesCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.includeAdvancedAttributesCheckBox.setSelected(this.definition.getAutoResolveConflicts()); this.includeAdvancedAttributesCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { validateFormState(); } }); optionsPanel.add(this.includeAdvancedAttributesCheckBox, advancedAttributesCheckBoxConstraints); this.scanMappingsList.loadData(); if (this.getMode() == AssuranceDialogMode.EDIT) { this.validateFormState(); } this.initialized = true; } }
From source file:net.minelord.gui.panes.IRCPane.java
public IRCPane() { super();/*from ww w. ja v a 2s. c o m*/ this.setBorder(new EmptyBorder(5, 5, 5, 5)); this.setLayout(null); nickSelectPane = new JPanel(); nickSelectPane.setLayout(null); nickSelectPane.setBounds(325, 70, 200, 200); TitledBorder title = BorderFactory .createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Pick a nick"); title.setTitleJustification(TitledBorder.RIGHT); nickSelectPane.setBorder(title); nickSelect = new JTextField(); final JButton done = new JButton("Done"); nickSelect.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent arg0) { } @Override public void keyReleased(KeyEvent arg0) { String nick = nickSelect.getText(); boolean success = true; if (nick.length() > 0) { if (nick.substring(0, 1).matches("[0-9]") || nick.charAt(0) == '-' || nick.contains(" ")) success = false; } else success = false; if (success) IRCPane.nick = nick; done.setEnabled(success); } @Override public void keyPressed(KeyEvent arg0) { if (arg0.getKeyCode() == 10) done.doClick(); } }); nickSelect.setBounds(50, 65, 100, 30); done.setBounds(50, 125, 100, 30); done.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { remove(nickSelectPane); repaint(); startClient(nickSelect.getText()); } }); done.setEnabled(false); nickSelectPane.add(nickSelect); nickSelectPane.add(done); add(nickSelectPane); addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent paramFocusEvent) { } @Override public void focusGained(FocusEvent paramFocusEvent) { if (nickSelectPane.getParent() != null) nickSelect.requestFocus(); if (input != null && input.getParent() != null) input.requestFocus(); } }); instance = this; }
From source file:com.floreantpos.bo.ui.explorer.MenuItemExplorer.java
private JPanel buildSearchForm() { JPanel panel = new JPanel(); panel.setLayout(new MigLayout("", "[][]15[][]15[][]15[]", "[]5[]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ JLabel lblOrderType = new JLabel(Messages.getString("MenuItemExplorer.4")); //$NON-NLS-1$ cbOrderTypes = new JComboBox(); cbOrderTypes.addItem(Messages.getString("MenuItemExplorer.5")); //$NON-NLS-1$ cbOrderTypes.addItem("<None>"); List<OrderType> orderTypes = Application.getInstance().getOrderTypes(); for (OrderType orderType : orderTypes) { cbOrderTypes.addItem(orderType); }//from w ww . j a v a 2 s.c om JLabel lblName = new JLabel(Messages.getString("MenuItemExplorer.0")); //$NON-NLS-1$ JLabel lblGroup = new JLabel(Messages.getString("MenuItemExplorer.1")); //$NON-NLS-1$ tfName = new JTextField(15); try { List<MenuGroup> menuGroupList = MenuGroupDAO.getInstance().findAll(); cbGroup = new JComboBox(); cbGroup.addItem(Messages.getString("MenuItemExplorer.2")); //$NON-NLS-1$ cbGroup.addItem("<None>"); for (MenuGroup s : menuGroupList) { cbGroup.addItem(s); } JButton searchBttn = new JButton(Messages.getString("MenuItemExplorer.3")); //$NON-NLS-1$ panel.add(lblName, "align label"); //$NON-NLS-1$ panel.add(tfName); panel.add(lblGroup); panel.add(cbGroup); panel.add(lblOrderType); panel.add(cbOrderTypes); panel.add(searchBttn); Border loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); TitledBorder title = BorderFactory.createTitledBorder(loweredetched, "Search"); //$NON-NLS-1$ title.setTitleJustification(TitledBorder.LEFT); panel.setBorder(title); searchBttn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { searchItem(); } }); tfName.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { searchItem(); } }); } catch (Throwable x) { BOMessageDialog.showError(POSConstants.ERROR_MESSAGE, x); } return panel; }
From source file:jboost.visualization.HistogramFrame.java
private void initGUI() { post("Initializing GUI..."); try {/*w w w . jav a 2 s.co m*/ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); jMenuBar1.add(getJMenu1()); jMenuBar1.add(getJMenu2()); } { jSplitPane2 = new JSplitPane(); jSplitPane2.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); jSplitPane2.setDividerLocation(850); jSplitPane2.setFocusCycleRoot(true); jSplitPane2.add(getJSplitPane1(), JSplitPane.LEFT); jSplitPane2.add(getJPanel3(), JSplitPane.RIGHT); } this.add(jSplitPane2); pack(); this.setSize(1000, 500); } catch (Exception e) { e.printStackTrace(); } }