private void button1_addActionPerformed(ActionEvent e) { // TODO add your code here String message = null; User user = null; try { user = new User( textField1_name.getText(), textField2_emeil.getText(), Integer.valueOf(textField3_telefon.getText())); message = "Успешно создан"; textField1_name.setText(""); textField2_emeil.setText(""); textField3_telefon.setText(""); } catch (NumberFormatException ex) { message = "Разберитесь с телефоном"; } finally { JOptionPane.showMessageDialog(this, message); } DefaultComboBoxModel<User> qwe = (DefaultComboBoxModel<User>) list1.getModel(); qwe.addElement(user); // list1.setListData(); // System.out.println(User.getSprUser()); }
private DefaultComboBoxModel createModel() { final DefaultComboBoxModel model = new DefaultComboBoxModel(); createPredefinedScopeDescriptors(model); model.addElement(new ScopeSeparator("VCS Scopes")); final List<NamedScope> changeLists = ChangeListsScopesProvider.getInstance(myProject).getCustomScopes(); for (NamedScope changeListScope : changeLists) { final GlobalSearchScope scope = GlobalSearchScopes.filterScope(myProject, changeListScope); model.addElement(new ScopeDescriptor(scope)); } final List<ScopeDescriptor> customScopes = new ArrayList<ScopeDescriptor>(); final NamedScopesHolder[] holders = NamedScopesHolder.getAllNamedScopeHolders(myProject); for (NamedScopesHolder holder : holders) { final NamedScope[] scopes = holder.getEditableScopes(); // predefined scopes already included for (NamedScope scope : scopes) { final GlobalSearchScope searchScope = GlobalSearchScopes.filterScope(myProject, scope); customScopes.add(new ScopeDescriptor(searchScope)); } } if (!customScopes.isEmpty()) { model.addElement(new ScopeSeparator("Custom Scopes")); for (ScopeDescriptor scope : customScopes) { model.addElement(scope); } } return model; }
private void updateJdks() { _jdksModel.removeAllElements(); for (Sdk sdk : _sdkModel.getSdks()) { if (GosuSdkUtils.isApplicableJdk(sdk)) { _jdksModel.addElement(sdk); } } }
private void _setUpResources() { DefaultComboBoxModel dlm = new DefaultComboBoxModel(); Set<String> keys = HEADING_LIST.keySet(); for (String key : keys) { dlm.addElement(key); } mHeadingComboBox.setModel(dlm); }
/** populates the comptype combo box with the COMPONENT_TYPES */ private void populateCompType() { DefaultComboBoxModel model = (DefaultComboBoxModel) comptype.getModel(); for (int count = 0; count < COMPONENT_TYPES.length; count++) { model.addElement(COMPONENT_TYPES[count]); } comptype.addItemListener(this); }
/** * Sets the log level combo box to the specified log level. * * @param logLevel the log level in question. */ private void setLogLevelComboBoxSetting(LogLevel logLevel) { DefaultComboBoxModel model = (DefaultComboBoxModel) logLevelComboBox.getModel(); for (int index = 0; index < model.getSize(); index++) { LogLevelWrapper wrapper = (LogLevelWrapper) model.getElementAt(index); if (wrapper.logLevel == logLevel) { logLevelComboBox.setSelectedIndex(index); return; } } }
public void internalJdkUpdate(@NotNull final Sdk sdk) { GosuSdkAdditionalData data = (GosuSdkAdditionalData) sdk.getSdkAdditionalData(); if (data == null) return; final Sdk javaSdk = data.getJavaSdk(); if (_jdksModel.getIndexOf(javaSdk) == -1) { _jdksModel.addElement(javaSdk); } else { _jdksModel.setSelectedItem(javaSdk); } }
@Override public void configurationChanged() { configurationOverrideModel.removeAllElements(); configurationOverrideModel.addElement(DEFAULT_OVERRIDE); for (ConfigurationLocation configurationLocation : checkStylePlugin.getConfiguration().getConfigurationLocations()) { configurationOverrideModel.addElement(configurationLocation); } configurationOverrideModel.setSelectedItem(DEFAULT_OVERRIDE); }
private void selectScope(String preselect) { if (preselect != null) { final JComboBox combo = getComboBox(); DefaultComboBoxModel model = (DefaultComboBoxModel) combo.getModel(); for (int i = 0; i < model.getSize(); i++) { ScopeDescriptor descriptor = (ScopeDescriptor) model.getElementAt(i); if (preselect.equals(descriptor.getDisplay())) { combo.setSelectedIndex(i); break; } } } }
/** * Sets up the state label dropdown menu * * @param selectedLabel */ private static void populateStateLabelDropdown() { DefaultComboBoxModel model = new DefaultComboBoxModel(); if (StateLabelManager.currentStateLabel == null) model.addElement("-- Select --"); ArrayList<String> stateLabels = QueryManager.getData().getStateLabelNames(); Iterator<String> i = stateLabels.iterator(); while (i.hasNext()) { String stateLabelName = i.next(); model.addElement(stateLabelName); } if (StateLabelManager.currentStateLabel == null) model.setSelectedItem("-- Select --"); else model.setSelectedItem(StateLabelManager.currentStateLabel); StateLabelManager.stateLabelDropdown.setModel(model); }
@Override public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { MyTableModel tableModel = (MyTableModel) table.getModel(); DefaultComboBoxModel comboModel = new DefaultComboBoxModel(); for (ValidationResult.Option each : tableModel.getOptions(row)) { comboModel.addElement(each); } ((JComboBox) editorComponent).setModel(comboModel); return super.getTableCellEditorComponent(table, value, isSelected, row, column); }
private void configChanged(String activeConfig) { DefaultComboBoxModel model = new DefaultComboBoxModel(); model.addElement(""); SortedSet<String> alphaConfigs = new TreeSet<String>( new Comparator<String>() { Collator coll = Collator.getInstance(); public int compare(String s1, String s2) { return coll.compare(label(s1), label(s2)); } private String label(String c) { Map<String, String> m = configs.get(c); String label = m.get("$label"); // NOI18N return label != null ? label : c; } }); for (Map.Entry<String, Map<String, String>> entry : configs.entrySet()) { String config = entry.getKey(); if (config != null && entry.getValue() != null) { alphaConfigs.add(config); } } for (String c : alphaConfigs) { model.addElement(c); } configCombo.setModel(model); configCombo.setSelectedItem(activeConfig != null ? activeConfig : ""); Map<String, String> m = configs.get(activeConfig); Map<String, String> def = configs.get(null); if (m != null) { // BEGIN Deprecated if (compProviderDeprecated != null) { compProviderDeprecated.configUpdated(m); } // END Deprecated for (J2SECategoryExtensionProvider compProvider : compProviders) { compProvider.configUpdated(m); } for (int i = 0; i < data.length; i++) { String v = m.get(keys[i]); if (v == null) { // display default value v = def.get(keys[i]); } data[i].setText(v); } } // else ?? configDel.setEnabled(activeConfig != null); }
private void createPredefinedScopeDescriptors(DefaultComboBoxModel model) { @SuppressWarnings("deprecation") final DataContext context = DataManager.getInstance().getDataContext(); for (SearchScope scope : getPredefinedScopes( myProject, context, mySuggestSearchInLibs, myPrevSearchFiles, true, true)) { model.addElement(new ScopeDescriptor(scope)); } for (ScopeDescriptorProvider provider : Extensions.getExtensions(ScopeDescriptorProvider.EP_NAME)) { for (ScopeDescriptor scopeDescriptor : provider.getScopeDescriptors(myProject)) { model.addElement(scopeDescriptor); } } }
public ConfigurationLocation getSelectedOverride() { final Object selectedItem = configurationOverrideModel.getSelectedItem(); if (DEFAULT_OVERRIDE.equals(selectedItem)) { return null; } return (ConfigurationLocation) selectedItem; }
/** * Constructs a ClutoTree diaplay which is initialized with tableModel as the data model, and the * given selection model. * * @param clutoSolution The clustering solution * @param tableContext The context which manages views and selections. * @param tableModel the data model for the parallel coordinate display */ public ClutoTree(ClutoSolution clutoSolution, TableContext tableContext, TableModel tableModel) { ctx = tableContext; tm = tableModel; lsm = ctx.getRowSelectionModel(tm); // labelModel int ncol = tm.getColumnCount(); for (int i = 0; i < ncol; i++) { labelModel.addElement(tm.getColumnName(i)); } setLayout(new BorderLayout()); btnP = new JToolBar(); add(btnP, BorderLayout.NORTH); labelChoice.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { labelColumn = 0; String ln = (String) e.getItem(); if (ln != null) { for (int c = 0; c < tm.getColumnCount(); c++) { if (ln.equals(tm.getColumnName(c))) { labelColumn = c; break; } } } graph.invalidate(); validate(); repaint(); } } }); btnP.add(labelChoice); graph = new SimpleGraph(); graph.getGraphDisplay().setOpaque(true); graph.getGraphDisplay().setBackground(Color.white); graph.getGraphDisplay().setGridColor(new Color(220, 220, 220)); graph.showGrid(false); graph.showAxis(BorderLayout.WEST, false); graph.showAxis(BorderLayout.EAST, true); graph.getAxisDisplay(BorderLayout.EAST).setZoomable(true); graph.getAxisDisplay(BorderLayout.EAST).setAxisLabeler(labeler); ((LinearAxis) graph.getYAxis()).setTickIncrement(-1.); graph.getAxisDisplay(BorderLayout.SOUTH).setZoomable(true); gs = new GraphSegments(); gs.setColor(Color.blue); idxSelColor = new IndexSelectColor(Color.cyan, null, new DefaultListSelectionModel()); gs.setIndexedColor(idxSelColor); graph.addGraphItem(gs); graph.getGraphDisplay().addMouseListener(ma); add(graph); if (lsm != null) { lsm.addListSelectionListener(selListener); } display(makeTree(clutoSolution)); }
@Override public void setSelectedItem(Object anObject) { if (!(anObject instanceof Delimiter)) { super.setSelectedItem(anObject); } else { int index = getIndexOf(anObject); if (index < getSize()) { setSelectedItem(getElementAt(index + 1)); } } }
private static ComboBoxModel<String> makeModel() { DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(); model.addElement("aaaa"); model.addElement("aaaabbb"); model.addElement("aaaabbbcc"); model.addElement("asdfasdfas"); model.addElement("bbb1"); model.addElement("bbb12"); return model; }
private void resetSettings() { downloadDirectoryTextField.setText(Groovesquid.getConfig().getDownloadDirectory()); maxParallelDownloadsSpinner.setValue(Groovesquid.getConfig().getMaxParallelDownloads()); fileNameSchemeTextField.setText(Groovesquid.getConfig().getFileNameScheme()); String[] downloadCompleteActions = Config.DownloadComplete.names(); DefaultComboBoxModel downloadCompleteComboBoxModel = new DefaultComboBoxModel(); downloadCompletedComboBox.setModel(downloadCompleteComboBoxModel); for (String downloadCompleteAction : downloadCompleteActions) { downloadCompleteComboBoxModel.addElement(I18n.getLocaleString(downloadCompleteAction)); } downloadCompletedComboBox.setSelectedIndex(Groovesquid.getConfig().getDownloadComplete()); String[] startTabs = Config.StartTab.names(); DefaultComboBoxModel startTabComboBoxModel = new DefaultComboBoxModel(); startTabComboBox.setModel(startTabComboBoxModel); for (String startTab : startTabs) { startTabComboBoxModel.addElement(I18n.getLocaleString(startTab)); } startTabComboBox.setSelectedIndex(Groovesquid.getConfig().getStartTab()); String[] fileExistsActions = Config.FileExists.names(); DefaultComboBoxModel fileExistsComboBoxModel = new DefaultComboBoxModel(); fileExistsComboBox.setModel(fileExistsComboBoxModel); for (String fileExistsAction : fileExistsActions) { fileExistsComboBoxModel.addElement(I18n.getLocaleString(fileExistsAction)); } fileExistsComboBox.setSelectedIndex(Groovesquid.getConfig().getFileExists()); if (Groovesquid.getConfig().getProxyHost() != null && Groovesquid.getConfig().getProxyPort() != null) { proxyHostTextField.setText(Groovesquid.getConfig().getProxyHost()); proxyPortTextField.setText(Groovesquid.getConfig().getProxyPort().toString()); } }
/** * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR * call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new GridLayoutManager(4, 1, new Insets(10, 10, 10, 10), -1, -1)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add( panel1, new GridConstraints( 3, 0, 1, 1, GridConstraints.ANCHOR_SOUTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); panel1.add( panel2, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); btImport = new JButton(); btImport.setText("Import"); panel2.add( btImport, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); btCancel = new JButton(); btCancel.setEnabled(false); btCancel.setText("Cancel"); panel2.add( btCancel, new GridConstraints( 0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); btClose = new JButton(); btClose.setText("Close"); panel2.add( btClose, new GridConstraints( 0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JSeparator separator1 = new JSeparator(); panel1.add( separator1, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(4, 4, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add( panel3, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label1 = new JLabel(); label1.setText("File path:"); panel3.add( label1, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); tfFilePath = new JTextField(); panel3.add( tfFilePath, new GridConstraints( 1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); btBrowse = new JButton(); btBrowse.setText("Browse"); panel3.add( btBrowse, new GridConstraints( 1, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label2 = new JLabel(); label2.setText("Delimiter:"); panel3.add( label2, new GridConstraints( 2, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); cmbDelimiter = new JComboBox(); cmbDelimiter.setEditable(true); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement(","); defaultComboBoxModel1.addElement("|"); defaultComboBoxModel1.addElement("-"); defaultComboBoxModel1.addElement(":"); cmbDelimiter.setModel(defaultComboBoxModel1); panel3.add( cmbDelimiter, new GridConstraints( 2, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label3 = new JLabel(); label3.setText("Table name:"); panel3.add( label3, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); tfTableName = new JTextField(); panel3.add( tfTableName, new GridConstraints( 0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final JPanel panel4 = new JPanel(); panel4.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); panel3.add( panel4, new GridConstraints( 3, 0, 1, 4, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel5 = new JPanel(); panel5.setLayout(new GridLayoutManager(2, 4, new Insets(0, 0, 0, 0), -1, -1)); panel4.add( panel5, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label4 = new JLabel(); label4.setText("Select types for columns:"); panel5.add( label4, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel5.add( spacer1, new GridConstraints( 1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); btRemoveColumn = new JButton(); btRemoveColumn.setEnabled(false); btRemoveColumn.setText("Remove"); panel5.add( btRemoveColumn, new GridConstraints( 1, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); btAddColumn = new JButton(); btAddColumn.setText("Add..."); panel5.add( btAddColumn, new GridConstraints( 1, 2, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JSeparator separator2 = new JSeparator(); panel5.add( separator2, new GridConstraints( 0, 0, 1, 4, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final JScrollPane scrollPane1 = new JScrollPane(); panel4.add( scrollPane1, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(400, 200), null, 0, false)); rowsTable = new JTable(); scrollPane1.setViewportView(rowsTable); final JLabel label5 = new JLabel(); label5.setFont(new Font(label5.getFont().getName(), Font.BOLD, label5.getFont().getSize())); label5.setText("* Note: data for not listed columns will be treated as of String type."); panel4.add( label5, new GridConstraints( 2, 0, 1, 1, GridConstraints.ANCHOR_SOUTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JSeparator separator3 = new JSeparator(); contentPane.add( separator3, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final JPanel panel6 = new JPanel(); panel6.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add( panel6, new GridConstraints( 2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label6 = new JLabel(); label6.setText("Written rows:"); panel6.add( label6, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer2 = new Spacer(); panel6.add( spacer2, new GridConstraints( 1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); writtenRowsCount = new JLabel(); writtenRowsCount.setText("?"); panel6.add( writtenRowsCount, new GridConstraints( 1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label7 = new JLabel(); label7.setText("Read rows:"); panel6.add( label7, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); readRowsCount = new JLabel(); readRowsCount.setText("?"); panel6.add( readRowsCount, new GridConstraints( 0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); }
@Override protected JComponent createCenterPanel() { myTitledSeparator.setText(myAnalysisNoon); // include test option myInspectTestSource.setSelected(myAnalysisOptions.ANALYZE_TEST_SOURCES); // module scope if applicable myModuleButton.setText( AnalysisScopeBundle.message("scope.option.module.with.mnemonic", myModuleName)); boolean useModuleScope = false; if (myModuleName != null) { useModuleScope = myAnalysisOptions.SCOPE_TYPE == AnalysisScope.MODULE; myModuleButton.setSelected(myRememberScope && useModuleScope); } myModuleButton.setVisible( myModuleName != null && ModuleManager.getInstance(myProject).getModules().length > 1); boolean useUncommitedFiles = false; final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject); final boolean hasVCS = !changeListManager.getAffectedFiles().isEmpty(); if (hasVCS) { useUncommitedFiles = myAnalysisOptions.SCOPE_TYPE == AnalysisScope.UNCOMMITTED_FILES; myUncommitedFilesButton.setSelected(myRememberScope && useUncommitedFiles); } myUncommitedFilesButton.setVisible(hasVCS); DefaultComboBoxModel model = new DefaultComboBoxModel(); model.addElement(ALL); final List<? extends ChangeList> changeLists = changeListManager.getChangeListsCopy(); for (ChangeList changeList : changeLists) { model.addElement(changeList.getName()); } myChangeLists.setModel(model); myChangeLists.setEnabled(myUncommitedFilesButton.isSelected()); myChangeLists.setVisible(hasVCS); // file/package/directory/module scope if (myFileName != null) { myFileButton.setText(myFileName); myFileButton.setMnemonic(myFileName.charAt(getSelectedScopeMnemonic())); } else { myFileButton.setVisible(false); } VirtualFile file = PsiUtilBase.getVirtualFile(myContext); ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex(); boolean searchInLib = file != null && (fileIndex.isInLibraryClasses(file) || fileIndex.isInLibrarySource(file)); String preselect = StringUtil.isEmptyOrSpaces(myAnalysisOptions.CUSTOM_SCOPE_NAME) ? FindSettings.getInstance().getDefaultScopeName() : myAnalysisOptions.CUSTOM_SCOPE_NAME; if (searchInLib && GlobalSearchScope.projectScope(myProject).getDisplayName().equals(preselect)) { preselect = GlobalSearchScope.allScope(myProject).getDisplayName(); } if (GlobalSearchScope.allScope(myProject).getDisplayName().equals(preselect) && myAnalysisOptions.SCOPE_TYPE == AnalysisScope.CUSTOM) { myAnalysisOptions.CUSTOM_SCOPE_NAME = preselect; searchInLib = true; } // custom scope myCustomScopeButton.setSelected( myRememberScope && myAnalysisOptions.SCOPE_TYPE == AnalysisScope.CUSTOM); myScopeCombo.init(myProject, searchInLib, true, preselect); // correct selection myProjectButton.setSelected( myRememberScope && myAnalysisOptions.SCOPE_TYPE == AnalysisScope.PROJECT || myFileName == null); myFileButton.setSelected( myFileName != null && (!myRememberScope || myAnalysisOptions.SCOPE_TYPE != AnalysisScope.PROJECT && !useModuleScope && myAnalysisOptions.SCOPE_TYPE != AnalysisScope.CUSTOM && !useUncommitedFiles)); myScopeCombo.setEnabled(myCustomScopeButton.isSelected()); final ActionListener radioButtonPressed = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onScopeRadioButtonPressed(); } }; final Enumeration<AbstractButton> enumeration = myGroup.getElements(); while (enumeration.hasMoreElements()) { enumeration.nextElement().addActionListener(radioButtonPressed); } // additional panel - inspection profile chooser JPanel wholePanel = new JPanel(new BorderLayout()); wholePanel.add(myPanel, BorderLayout.NORTH); final JComponent additionalPanel = getAdditionalActionSettings(myProject); if (additionalPanel != null) { wholePanel.add(additionalPanel, BorderLayout.CENTER); } new RadioUpDownListener( myProjectButton, myModuleButton, myUncommitedFilesButton, myFileButton, myCustomScopeButton); return wholePanel; }
/** * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR * call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { panel1 = new JPanel(); panel1.setLayout(new BorderLayout(0, 0)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); panel1.add(panel2, BorderLayout.NORTH); comboBox1 = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("pollux_xdvmed"); comboBox1.setModel(defaultComboBoxModel1); panel2.add( comboBox1, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label1 = new JLabel(); label1.setText("OFFLINE"); panel2.add( label1, new GridConstraints( 0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); panel1.add(panel3, BorderLayout.CENTER); button1 = new JButton(); button1.setIcon(new ImageIcon(getClass().getResource("/icons/autocommitOn.png"))); button1.setMargin(new Insets(2, 2, 2, 4)); button1.setRolloverEnabled(true); button1.setText(""); panel3.add( button1, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, 1, 1, null, null, null, 0, false)); button2 = new JButton(); button2.setText("Button"); panel3.add( button2, new GridConstraints( 0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); button3 = new JButton(); button3.setText("Button"); panel3.add( button3, new GridConstraints( 0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel4 = new JPanel(); panel4.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); panel1.add(panel4, BorderLayout.SOUTH); tabbedPane1 = new JTabbedPane(); panel4.add( tabbedPane1, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, 200), null, 0, false)); final JPanel panel5 = new JPanel(); panel5.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); tabbedPane1.addTab("Table", panel5); final JPanel panel6 = new JPanel(); panel6.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); tabbedPane1.addTab("View", panel6); final JSeparator separator1 = new JSeparator(); panel4.add( separator1, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); }
public void removeJavaSdk(Sdk sdk) { _jdksModel.removeElement(sdk); }
public void addJavaSdk(Sdk sdk) { _jdksModel.addElement(sdk); }
private void setupUI() { JPanel batchInputPanel = new JPanel(); batchInputPanel.setLayout(new GridLayoutManager(7, 2, new Insets(0, 0, 0, 0), -1, -1)); batchInputPanel.setEnabled(true); this.add( batchInputPanel, new GridConstraints( 2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); batchInputPanel.setBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null)); final Spacer spacer3 = new Spacer(); batchInputPanel.add( spacer3, new GridConstraints( 6, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(195, 14), null, 0, false)); dpiXLabel = new JLabel("DPI X: "); batchInputPanel.add( dpiXLabel, new GridConstraints( 2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(195, 16), null, 0, false)); dpiYLabel = new JLabel("DPI Y: "); batchInputPanel.add( dpiYLabel, new GridConstraints( 3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(195, 16), null, 0, false)); startDepthLabel = new JLabel("Start Depth (meter): "); batchInputPanel.add( startDepthLabel, new GridConstraints( 4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(195, 16), null, 0, false)); depthIncLabel = new JLabel("Depth Increment (meter): "); batchInputPanel.add( depthIncLabel, new GridConstraints( 5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(195, 16), null, 0, false)); dpiXField = new JTextField(); dpiXField.setEnabled(false); dpiXField.setHorizontalAlignment(11); dpiYField = new JTextField(); dpiYField.setEnabled(false); dpiYField.setHorizontalAlignment(11); batchInputPanel.add( dpiXField, new GridConstraints( 2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(100, -1), null, 0, false)); batchInputPanel.add( dpiYField, new GridConstraints( 3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(100, -1), null, 0, false)); startDepthField = new JTextField(); startDepthField.setEnabled(false); startDepthField.setHorizontalAlignment(11); batchInputPanel.add( startDepthField, new GridConstraints( 4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(100, -1), null, 0, false)); depthIncField = new JTextField(); depthIncField.setEnabled(false); depthIncField.setHorizontalAlignment(11); batchInputPanel.add( depthIncField, new GridConstraints( 5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(100, -1), null, 0, false)); final JPanel applyPanel = new JPanel(); applyPanel.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); batchInputPanel.add( applyPanel, new GridConstraints( 6, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); applyToAllButton = new JButton("Apply to All Rows"); applyToAllButton.setEnabled(false); applyPanel.add( applyToAllButton, new GridConstraints( 0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); applyToSelectedButton = new JButton("Apply to Selected Rows"); applyToSelectedButton.setEnabled(false); applyPanel.add( applyToSelectedButton, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); // final Spacer spacer4 = new Spacer(); // applyPanel.add(spacer4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, // GridConstraints.FILL_HORIZONTAL, // GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); orientationComboBox = new JComboBox(); orientationComboBox.setEnabled(false); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("Horizontal"); defaultComboBoxModel1.addElement("Vertical"); defaultComboBoxModel1.addElement("[Blank]"); orientationComboBox.setModel(defaultComboBoxModel1); orientationComboBox.setSelectedIndex(2); // [Blank] batchInputPanel.add( orientationComboBox, new GridConstraints( 0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lengthLabel = new JLabel("Length (meter): "); batchInputPanel.add( lengthLabel, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lengthField = new JTextField(); lengthField.setEnabled(false); lengthField.setHorizontalAlignment(11); batchInputPanel.add( lengthField, new GridConstraints( 1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); orientationLabel = new JLabel("Orientation: "); batchInputPanel.add( orientationLabel, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(195, 16), null, 0, false)); useBatchInputCheckbox = new JCheckBox(); useBatchInputCheckbox.setText("Batch input: blank fields will not be applied"); this.add( useBatchInputCheckbox, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); onBatch(); }
/** * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR * call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout( new com.intellij.uiDesigner.core.GridLayoutManager( 2, 1, new Insets(10, 10, 10, 10), -1, -1)); final JPanel panel1 = new JPanel(); panel1.setLayout( new com.intellij.uiDesigner.core.GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add( panel1, new com.intellij.uiDesigner.core.GridConstraints( 1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); final com.intellij.uiDesigner.core.Spacer spacer1 = new com.intellij.uiDesigner.core.Spacer(); panel1.add( spacer1, new com.intellij.uiDesigner.core.GridConstraints( 0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout( new com.intellij.uiDesigner.core.GridLayoutManager( 1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); panel1.add( panel2, new com.intellij.uiDesigner.core.GridConstraints( 0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); buttonOK = new JButton(); buttonOK.setText("OK"); panel2.add( buttonOK, new com.intellij.uiDesigner.core.GridConstraints( 0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); buttonCancel = new JButton(); buttonCancel.setText("Cancel"); panel2.add( buttonCancel, new com.intellij.uiDesigner.core.GridConstraints( 0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel3 = new JPanel(); panel3.setLayout( new com.intellij.uiDesigner.core.GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add( panel3, new com.intellij.uiDesigner.core.GridConstraints( 0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); spinnerTamanyHidato = new JSpinner(); panel3.add( spinnerTamanyHidato, new com.intellij.uiDesigner.core.GridConstraints( 0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); spinnerForats = new JSpinner(); panel3.add( spinnerForats, new com.intellij.uiDesigner.core.GridConstraints( 1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); spinnerNumerosPrecolocats = new JSpinner(); panel3.add( spinnerNumerosPrecolocats, new com.intellij.uiDesigner.core.GridConstraints( 2, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label1 = new JLabel(); label1.setText("Tamany de l'Hidato"); panel3.add( label1, new com.intellij.uiDesigner.core.GridConstraints( 0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label2 = new JLabel(); label2.setText("\"Forats\" o caselles no usables"); panel3.add( label2, new com.intellij.uiDesigner.core.GridConstraints( 1, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label3 = new JLabel(); label3.setText("Numeros pre-colocats"); panel3.add( label3, new com.intellij.uiDesigner.core.GridConstraints( 2, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); comboBoxDificultat = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("Fàcil"); defaultComboBoxModel1.addElement("Normal"); defaultComboBoxModel1.addElement("Difícil"); comboBoxDificultat.setModel(defaultComboBoxModel1); panel3.add( comboBoxDificultat, new com.intellij.uiDesigner.core.GridConstraints( 3, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label4 = new JLabel(); label4.setText("Dificultat"); panel3.add( label4, new com.intellij.uiDesigner.core.GridConstraints( 3, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); }
private void initComponents() { setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setTitle(I18n.getLocaleString("SETTINGS")); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent evt) { formWindowClosing(evt); } }); maxParallelDownloadsLabel = new JLabel(I18n.getLocaleString("MAX_PARALLEL_DOWNLOADS")); maxParallelDownloadsLabel.setFont( new Font(maxParallelDownloadsLabel.getFont().getName(), Font.BOLD, 11)); downloadDirectoryLabel = new JLabel(I18n.getLocaleString("DOWNLOAD_DIRECTORY")); downloadDirectoryLabel.setFont( new Font(downloadDirectoryLabel.getFont().getName(), Font.BOLD, 11)); downloadDirectoryTextField = new JTextField(); downloadDirectoryTextField.setRequestFocusEnabled(false); maxParallelDownloadsSpinner = new JSpinner(); maxParallelDownloadsSpinner.setModel(new SpinnerNumberModel(10, 1, null, 1)); maxParallelDownloadsSpinner.setValue(10); saveSettingsButton = new JButton(I18n.getLocaleString("SAVE_AND_CLOSE")); saveSettingsButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { saveSettingsButtonActionPerformed(evt); } }); downloadDirectoryButton = new JButton("..."); downloadDirectoryButton.setFocusable(false); downloadDirectoryButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { downloadDirectoryButtonActionPerformed(evt); } }); fileNameSchemeTextField = new JTextField(); fileNameSchemeTextField.setFont(new Font(Font.MONOSPACED, 0, 12)); filenameSchemeLabel = new JLabel(I18n.getLocaleString("FILENAME_SCHEME")); filenameSchemeLabel.setFont(new Font(filenameSchemeLabel.getFont().getName(), Font.BOLD, 11)); filenameSchemeDescriptionLabel = new JLabel(); filenameSchemeDescriptionLabel.setFont( new Font(filenameSchemeDescriptionLabel.getFont().getName(), Font.PLAIN, 11)); filenameSchemeDescriptionLabel.setLabelFor(fileNameSchemeTextField); String tagStyle = "font-family: Monospaced; font-weight: bold;"; filenameSchemeDescriptionLabel.setText( "<html><body>" + I18n.getLocaleString("FILENAME_SCHEME_DESCRIPTION") .replace("<", "<span style=\"" + tagStyle + "\"><") .replace(">", "></span>") .replaceFirst("/", "<span style=\"" + tagStyle + "\">/</span>") + "</body></html>"); /*searchAutocompleteLabel = new JLabel(I18n.getLocaleString("SEARCH_AUTOCOMPLETE")); searchAutocompleteLabel.setFont(new Font(searchAutocompleteLabel.getFont().getName(), Font.BOLD, 11)); searchAutocompleteCheckBox = new JCheckBox(I18n.getLocaleString("ENABLED")); searchAutocompleteCheckBox.setFont(new Font(searchAutocompleteCheckBox.getFont().getName(), Font.BOLD, 11));*/ startTabLabel = new JLabel(I18n.getLocaleString("START_TAB")); startTabLabel.setFont(new Font(startTabLabel.getFont().getName(), Font.BOLD, 11)); startTabComboBox = new JComboBox(); downloadCompletedLabel = new JLabel(I18n.getLocaleString("DOWNLOAD_COMPLETED")); downloadCompletedLabel.setFont( new Font(downloadCompletedLabel.getFont().getName(), Font.BOLD, 11)); downloadCompletedComboBox = new JComboBox(); languageLabel = new JLabel(I18n.getLocaleString("LANGUAGE")); languageLabel.setFont(new Font(languageLabel.getFont().getName(), Font.BOLD, 11)); languageComboBox = new JComboBox(); DefaultComboBoxModel languageComboBoxModel = new DefaultComboBoxModel(); languageComboBox.setModel(languageComboBoxModel); for (Locale locale : I18n.getLocales()) { languageComboBoxModel.addElement(locale); if (locale.equals(I18n.getCurrentLocale())) { languageComboBox.setSelectedItem(locale); } } languageComboBox.setRenderer( new DefaultListCellRenderer() { public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); JLabel label = new JLabel(); label.setOpaque(false); if (isSelected) { label.setOpaque(true); label.setForeground(comp.getForeground()); label.setBackground(comp.getBackground()); } else { label.setBackground(comp.getBackground()); } label.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 6)); list.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); list.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); Locale locale = (Locale) value; String languageNameForeign = WordUtils.capitalize(locale.getDisplayName(locale)); String languageNameOwn = WordUtils.capitalize(locale.getDisplayName(I18n.getCurrentLocale())); String languageCode = locale.toString().replace("_", "-"); // fix not existent language names if (locale.toString().equals("en_PT")) { languageNameForeign = "Pirate English"; languageNameOwn = languageNameForeign; } if (locale.toString().equals("lol")) { languageNameForeign = "LOLCAT"; languageNameOwn = languageNameForeign; } // fix ISO3 codes if (locale.toString().equals("iw")) { languageCode = "he"; } URL url = getClass().getResource("/gui/flags/" + languageCode + ".png"); if (url != null) { ImageIcon icon = new ImageIcon(url); icon = GuiUtils.stretchImage(icon, 18, 18, this); label.setIcon(icon); } label.setText( "<html>" + "\u202A" + languageNameForeign + (!isSelected ? "<font color=gray>" : "") + " — " + languageNameOwn + (!isSelected ? "</font>" : "") + "</html>"); return label; } }); resetOriginalSettingsButton = new JButton(I18n.getLocaleString("RESET_ORIGINAL_SETTINGS")); resetOriginalSettingsButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { resetOriginalSettingsButtonActionPerformed(evt); } }); fileExistsLabel = new JLabel(); fileExistsLabel.setFont(new Font(fileExistsLabel.getFont().getName(), Font.BOLD, 11)); fileExistsLabel.setText(I18n.getLocaleString("FILE_EXISTS")); fileExistsComboBox = new JComboBox(); proxyHostLabel = new JLabel(I18n.getLocaleString("PROXY_HOST")); proxyHostLabel.setFont(new Font(proxyHostLabel.getFont().getName(), Font.BOLD, 11)); proxyHostTextField = new JTextField(); proxyPortLabel = new JLabel(I18n.getLocaleString("PROXY_PORT")); proxyPortLabel.setFont(new Font(proxyPortLabel.getFont().getName(), Font.BOLD, 11)); proxyPortTextField = new JTextField(); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(GroupLayout.LEADING) .add( layout .createSequentialGroup() .addContainerGap() .add( layout .createParallelGroup(GroupLayout.LEADING) .add( layout .createSequentialGroup() .add( resetOriginalSettingsButton, GroupLayout.PREFERRED_SIZE, 227, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.RELATED) .add( saveSettingsButton, GroupLayout.PREFERRED_SIZE, 250, GroupLayout.PREFERRED_SIZE)) .add( layout .createSequentialGroup() .add( layout .createParallelGroup(GroupLayout.TRAILING, false) .add( languageLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add( fileExistsLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add( maxParallelDownloadsLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add( filenameSchemeLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add( downloadDirectoryLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add( startTabLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add( downloadCompletedLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add( proxyHostLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add( proxyPortLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.RELATED) .add( layout .createParallelGroup(GroupLayout.LEADING) .add( layout .createSequentialGroup() .add(downloadDirectoryTextField) .addPreferredGap(LayoutStyle.RELATED) .add( downloadDirectoryButton, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)) .add( GroupLayout.TRAILING, filenameSchemeDescriptionLabel, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .add(GroupLayout.TRAILING, fileNameSchemeTextField) .add( layout .createSequentialGroup() .add( layout .createParallelGroup( GroupLayout.LEADING, false) .add( downloadCompletedComboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(startTabComboBox) .add( maxParallelDownloadsSpinner, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .add( fileExistsComboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add( languageComboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(proxyHostTextField) .add(proxyPortTextField)) .add(0, 0, Short.MAX_VALUE))))) .addContainerGap())); layout.setVerticalGroup( layout .createParallelGroup(GroupLayout.LEADING) .add( layout .createSequentialGroup() .addContainerGap() .add( layout .createParallelGroup(GroupLayout.BASELINE) .add( downloadDirectoryTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .add(downloadDirectoryButton) .add( downloadDirectoryLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.UNRELATED) .add( layout .createParallelGroup(GroupLayout.LEADING, false) .add(maxParallelDownloadsSpinner) .add( maxParallelDownloadsLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) .add(18, 18, 18) .add( layout .createParallelGroup(GroupLayout.BASELINE) .add( filenameSchemeLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add( fileNameSchemeTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.RELATED) .add( filenameSchemeDescriptionLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.UNRELATED) .add( layout .createParallelGroup(GroupLayout.BASELINE) .add( startTabLabel, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE) .add(startTabComboBox)) .add(18, 18, 18) .add( layout .createParallelGroup(GroupLayout.BASELINE) .add(downloadCompletedLabel) .add( downloadCompletedComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .add(15, 15, 15) .add( layout .createParallelGroup(GroupLayout.BASELINE) .add(fileExistsLabel) .add( fileExistsComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .add(18, 18, 18) .add( layout .createParallelGroup(GroupLayout.BASELINE) .add(languageLabel) .add( languageComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .add(18, 18, 18) .add( layout .createParallelGroup(GroupLayout.BASELINE) .add(proxyHostLabel) .add( proxyHostTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .add(18, 18, 18) .add( layout .createParallelGroup(GroupLayout.BASELINE) .add(proxyPortLabel) .add( proxyPortTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .add(50, 50, 50) .add( layout .createParallelGroup(GroupLayout.BASELINE) .add(saveSettingsButton) .add(resetOriginalSettingsButton)) .addContainerGap())); setMinimumSize(new Dimension(700, 620)); pack(); }
/** * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR * call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); contentPane.setMinimumSize(new Dimension(350, 280)); contentPane.setPreferredSize(new Dimension(350, 280)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add( panel1, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel1.add( spacer1, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); panel1.add( panel2, new GridConstraints( 0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); buttonOK = new JButton(); buttonOK.setText("OK"); panel2.add( buttonOK, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); buttonCancel = new JButton(); buttonCancel.setText("Cancelar"); panel2.add( buttonCancel, new GridConstraints( 0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(7, 2, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add( panel3, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label1 = new JLabel(); label1.setText("Nome"); panel3.add( label1, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer2 = new Spacer(); panel3.add( spacer2, new GridConstraints( 6, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); txtNome = new JTextField(); panel3.add( txtNome, new GridConstraints( 0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final JLabel label2 = new JLabel(); label2.setText("CPF"); panel3.add( label2, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); txtCpf = new JTextField(); panel3.add( txtCpf, new GridConstraints( 1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final JLabel label3 = new JLabel(); label3.setText("Endereco"); panel3.add( label3, new GridConstraints( 2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); txtEndereco = new JTextField(); panel3.add( txtEndereco, new GridConstraints( 2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final JLabel label4 = new JLabel(); label4.setText("Telefone"); panel3.add( label4, new GridConstraints( 3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label5 = new JLabel(); label5.setText("Status"); panel3.add( label5, new GridConstraints( 5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); cboxStatusCliente = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("Inativo"); defaultComboBoxModel1.addElement("Ativo"); cboxStatusCliente.setModel(defaultComboBoxModel1); panel3.add( cboxStatusCliente, new GridConstraints( 5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label6 = new JLabel(); label6.setText("E-mail"); panel3.add( label6, new GridConstraints( 4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); txtEmail = new JTextField(); panel3.add( txtEmail, new GridConstraints( 4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); txtTelefone = new JTextField(); panel3.add( txtTelefone, new GridConstraints( 3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); }
public ResourceEditor( @Nullable ResourceType[] types, Set<AttributeFormat> formats, @Nullable String[] values) { myTypes = types; myIsDimension = formats.contains(AttributeFormat.Dimension); if (formats.contains(AttributeFormat.Boolean)) { myCheckBox = new JCheckBox(); myEditor = new ComponentWithBrowseButton<JCheckBox>(myCheckBox, null) { @Override public Dimension getPreferredSize() { return getComponentPreferredSize(); } }; myCheckBox.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (!myIgnoreCheckBoxValue) { myBooleanResourceValue = null; fireValueCommitted(false, true); } } }); } else if (formats.contains(AttributeFormat.Enum)) { ComboboxWithBrowseButton editor = new ComboboxWithBrowseButton(SystemInfo.isWindows ? new MyComboBox() : new JComboBox()) { @Override public Dimension getPreferredSize() { return getComponentPreferredSize(); } }; final JComboBox comboBox = editor.getComboBox(); DefaultComboBoxModel model = new DefaultComboBoxModel(values); model.insertElementAt(StringsComboEditor.UNSET, 0); comboBox.setModel(model); comboBox.setEditable(true); ComboEditor.installListeners( comboBox, new ComboEditor.ComboEditorListener(this) { @Override protected void onValueChosen() { if (comboBox.getSelectedItem() == StringsComboEditor.UNSET) { comboBox.setSelectedItem(null); } super.onValueChosen(); } }); myEditor = editor; comboBox.setSelectedIndex(0); } else { myEditor = new TextFieldWithBrowseButton() { @Override protected void installPathCompletion( FileChooserDescriptor fileChooserDescriptor, @Nullable Disposable parent) {} @Override public Dimension getPreferredSize() { return getComponentPreferredSize(); } }; myEditor.registerKeyboardAction( new ActionListener() { @Override public void actionPerformed(ActionEvent e) {} }, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); JTextField textField = getComboText(); textField.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fireValueCommitted(false, true); } }); textField .getDocument() .addDocumentListener( new DocumentAdapter() { @Override protected void textChanged(final DocumentEvent e) { preferredSizeChanged(); } }); selectTextOnFocusGain(textField); } if (myCheckBox == null) { myEditor.registerKeyboardAction( new ActionListener() { @Override public void actionPerformed(ActionEvent e) {} }, KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); } myEditor.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showDialog(); } }); myEditor.addFocusListener( new FocusAdapter() { @Override public void focusGained(FocusEvent e) { myEditor.getChildComponent().requestFocus(); } }); }