org.jdesktop.swingx.JXTextField Java Examples
The following examples show how to use
org.jdesktop.swingx.JXTextField.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GamedataEditorRenderFactory.java From gameserver with Apache License 2.0 | 6 votes |
@Override public TableCellEditor getCellEditor(int row, int column, String columnName, TableModel tableModel, JTable table) { if ( "value".equals(columnName) || "default".equals(columnName) ) { int modelColIndex = table.convertColumnIndexToModel(column); int modelRowIndex = table.convertRowIndexToModel(row); Object value = this.tableModel.getValueAt(modelRowIndex, modelColIndex); if ( value instanceof BasicDBList ) { MongoDBArrayEditor editor = new MongoDBArrayEditor(); editor.setDBObject((BasicDBList)value); return editor; } else { JXTextField field = new JXTextField(value.toString()); field.setPreferredSize(new Dimension(100, 36)); field.setBorder(null); return new DefaultCellEditor(field); } } return null; }
Example #2
Source File: APIKeysPanel.java From importer-exporter with Apache License 2.0 | 6 votes |
private void initGui() { googleGeocodingLabel = new JLabel(); googleGeocodingText = new JXTextField(); googleElevationLabel = new JLabel(); googleElevationText = new JXTextField(); setLayout(new GridBagLayout()); { google = new JPanel(); add(google, GuiUtil.setConstraints(0,0,1.0,0.0,GridBagConstraints.BOTH,5,0,5,0)); google.setBorder(BorderFactory.createTitledBorder("")); google.setLayout(new GridBagLayout()); { google.add(googleGeocodingLabel, GuiUtil.setConstraints(0,0,0,0,GridBagConstraints.HORIZONTAL,0,5,5,5)); google.add(googleGeocodingText, GuiUtil.setConstraints(1,0,1,0,GridBagConstraints.HORIZONTAL,0,5,5,5)); google.add(googleElevationLabel, GuiUtil.setConstraints(0,1,0,0,GridBagConstraints.HORIZONTAL,0,5,5,5)); google.add(googleElevationText, GuiUtil.setConstraints(1,1,1,0,GridBagConstraints.HORIZONTAL,0,5,5,5)); } } PopupMenuDecorator.getInstance().decorate(googleGeocodingText, googleElevationText); }
Example #3
Source File: DatabasePanel.java From importer-exporter with Apache License 2.0 | 5 votes |
public void doTranslation() { ((TitledBorder)connectionDetails.getBorder()).setTitle(Language.I18N.getString("db.border.connectionDetails")); connLabel.setText(Language.I18N.getString("db.label.connection")); descriptionLabel.setText(Language.I18N.getString("db.label.description")); databaseTypeLabel.setText(Language.I18N.getString("db.label.databaseType")); userLabel.setText(Language.I18N.getString("common.label.username")); passwordLabel.setText(Language.I18N.getString("common.label.password")); serverLabel.setText(Language.I18N.getString("common.label.server")); portLabel.setText(Language.I18N.getString("common.label.port")); databaseLabel.setText(Language.I18N.getString("db.label.sid")); schemaLabel.setText(Language.I18N.getString("common.label.schema")); ((JXTextField)schemaCombo.getEditor().getEditorComponent()).setPrompt(Language.I18N.getString("common.label.schema.prompt")); passwordCheck.setText(Language.I18N.getString("common.label.passwordCheck")); applyButton.setText(Language.I18N.getString("common.button.apply")); newButton.setText(Language.I18N.getString("db.button.new")); copyButton.setText(Language.I18N.getString("db.button.copy")); deleteButton.setText(Language.I18N.getString("db.button.delete")); infoButton.setText(Language.I18N.getString("db.button.info")); schemaButton.setText(Language.I18N.getString("db.button.schema")); ((TitledBorder)operations.getBorder()).setTitle(Language.I18N.getString("db.border.databaseOperations")); operationsPanel.doTranslation(); if (!databaseController.isConnected()) connectButton.setText(Language.I18N.getString("db.button.connect")); else connectButton.setText(Language.I18N.getString("db.button.disconnect")); }
Example #4
Source File: DatabaseOperationsPanel.java From importer-exporter with Apache License 2.0 | 5 votes |
private void init() { setLayout(new GridBagLayout()); workspace = new JXTextField(); workspace.setPromptForeground(Color.LIGHT_GRAY); workspace.setFocusBehavior(FocusBehavior.SHOW_PROMPT); datePicker = new DatePicker(); workspaceLabel = new JLabel(); timestampLabel = new JLabel(); add(workspaceLabel, GuiUtil.setConstraints(0,0,0.0,0.0,GridBagConstraints.BOTH,0,0,5,5)); add(workspace, GuiUtil.setConstraints(1,0,1.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5)); add(timestampLabel, GuiUtil.setConstraints(2,0,0.0,0.0,GridBagConstraints.NONE,0,10,5,5)); add(datePicker, GuiUtil.setConstraints(3,0,0.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,0)); operationsTab = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT); add(operationsTab, GuiUtil.setConstraints(0,2,4,1,1.0,1.0,GridBagConstraints.BOTH,5,0,0,0)); operations = new DatabaseOperationView[]{ new ReportOperation(this), new BoundingBoxOperation(this, config), new IndexOperation(this, config), new SrsOperation(this, config), new ADEInfoOperation(this) }; for (int i = 0; i < operations.length; ++i) operationsTab.insertTab(null, operations[i].getIcon(), null, operations[i].getToolTip(), i); operationsTab.addChangeListener(e -> { int index = operationsTab.getSelectedIndex(); for (int i = 0; i < operationsTab.getTabCount(); i++) operationsTab.setComponentAt(i, index == i ? operations[index].getViewComponent() : null); }); PopupMenuDecorator.getInstance().decorate(workspace, datePicker.getEditor()); }
Example #5
Source File: TypeSelectionView.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
/** * Constructs a new type selection view instance. * * @param wizard * the data import wizard */ public TypeSelectionView(final ImportWizard wizard) { this.wizard = wizard; JPanel dataSourcesPanel = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); // Search field { this.searchTextField = new JXTextField(I18N.getGUILabel("io.dataimport.step.type_selection.search_placeholder")); this.searchTextField.getDocument().addUndoableEditListener(e -> { String searchTerm = searchTextField.getText(); if (searchTerm != null && !searchTerm.trim().isEmpty() && searchTerm.trim().length() > 1) { updateTypeSelectionContentPanel(searchTerm, false); } else { updateTypeSelectionContentPanel(null, false); } }); searchTextField.setMinimumSize(SEARCH_FIELD_SIZE); searchTextField.setPreferredSize(SEARCH_FIELD_SIZE); // Disable search text field until there are more data sources available // (just uncomment code below in case it should be added again) // TextFieldWithAction outerTextField = new TextFieldWithAction(searchTextField, // CLEAR_SEARCH_ACTION, // CLEAR_SEARCH_HOVERED_ICON); // // constraint.weightx = 1; // constraint.weighty = 0; // constraint.gridwidth = GridBagConstraints.REMAINDER; // constraint.fill = GridBagConstraints.VERTICAL; // constraint.insets = new Insets(30, 0, 20, 0); // dataSourcesPanel.add(outerTextField, constraint); } // Center panel { JPanel centerPanel = new JPanel(new GridBagLayout()); GridBagConstraints centerConstraint = new GridBagConstraints(); centerConstraint.fill = GridBagConstraints.BOTH; centerConstraint.weightx = 1; centerConstraint.gridy = 0; JPanel leftFillPanel = new JPanel(); centerPanel.add(leftFillPanel, centerConstraint); centerConstraint.fill = GridBagConstraints.BOTH; centerConstraint.weightx = 0; centerConstraint.insets = new Insets(20, 0, 0, 0); this.mainContentPanel = new JPanel(new GridBagLayout()); centerPanel.add(mainContentPanel, centerConstraint); centerConstraint.fill = GridBagConstraints.BOTH; centerConstraint.weightx = 1; centerConstraint.insets = new Insets(0, 0, 0, 0); JPanel rightFillPanel = new JPanel(); centerPanel.add(rightFillPanel, centerConstraint); centerConstraint.fill = GridBagConstraints.BOTH; centerConstraint.gridy += 1; centerConstraint.weightx = 1; centerConstraint.weighty = 1; centerConstraint.gridwidth = GridBagConstraints.REMAINDER; JPanel bottomFillPanel = new JPanel(); centerPanel.add(bottomFillPanel, centerConstraint); constraint.weighty = 1; constraint.gridwidth = GridBagConstraints.REMAINDER; constraint.fill = GridBagConstraints.BOTH; constraint.insets = new Insets(0, 0, 0, 0); dataSourcesPanel.add(centerPanel, constraint); } add(dataSourcesPanel); updateTypeSelectionContentPanel(null, true); }
Example #6
Source File: AddDBObjectRowDialog.java From gameserver with Apache License 2.0 | 4 votes |
/** * Set the prototype object to copy all hidden fields with. * * @param prototype */ public void setPrototype(DBObject prototype) { this.prototype = prototype; this.okButton.setActionCommand(ActionName.OK.toString()); this.okButton.addActionListener(this); this.cancelButton.setActionCommand(ActionName.CANCEL.toString()); this.cancelButton.addActionListener(this); Set<String> keys = prototype.keySet(); int columnCount = keys.size(); if ( columnCount > 0 ) { labels = new JXLabel[columnCount]; fields = new JXTextField[columnCount]; } panel.setLayout(new MigLayout("wrap 4", "[15%][35%,grow][15%][35%,grow]")); Iterator<String> columnKeyIter = keys.iterator(); TableModel model = table.getModel(); if ( model instanceof MyTableModel ) { hiddenFields.addAll( ((MyTableModel)model).getHiddenFields() ); } for ( int i=0; i<columnCount; i++ ) { String columnName = columnKeyIter.next(); String localName = ColumnNames.translate(columnName); String columnValue = String.valueOf(prototype.get(columnName)); labels[i] = new JXLabel(localName); fields[i] = new JXTextField(columnValue); fields[i].setColumns(20); // fields[i].setColumns(15); fields[i].setText(columnValue); if ( hiddenFields.contains(columnName) ) { fields[i].setEnabled(false); } panel.add(labels[i], "sizegroup label"); panel.add(fields[i], "sizegroup field"); } panel.add(okButton, "newline, span, split 2, align center"); panel.add(cancelButton, ""); this.add(panel); this.setSize(600, (columnCount/4+1)*70+70); Point p = WindowUtils.getPointForCentering(this); this.setLocation(p); this.setModal(true); this.setVisible(true); }
Example #7
Source File: ExportPanel.java From importer-exporter with Apache License 2.0 | 4 votes |
private void initGui(JAXBContext projectContext) { browseText = new JTextField(); browseButton = new JButton(); workspaceText = new JXTextField(); workspaceText.setPromptForeground(Color.LIGHT_GRAY); workspaceText.setFocusBehavior(FocusBehavior.SHOW_PROMPT); datePicker = new DatePicker(); filterPanel = new FilterPanel(viewController, projectContext, config); exportButton = new JButton(); switchFilterModeButton = new JButton(); workspaceText.setEnabled(true); datePicker.setEnabled(true); browseButton.addActionListener(e -> saveFile(Language.I18N.getString("main.tabbedPane.export"))); PopupMenuDecorator.getInstance().decorate(workspaceText, datePicker.getEditor(), browseText); exportButton.addActionListener(e -> new SwingWorker<Void, Void>() { protected Void doInBackground() { doExport(); return null; } }.execute()); setLayout(new GridBagLayout()); JPanel filePanel = new JPanel(); add(filePanel, GuiUtil.setConstraints(0,0,1.0,0.0,GridBagConstraints.BOTH,10,5,5,5)); filePanel.setLayout(new GridBagLayout()); filePanel.add(browseText, GuiUtil.setConstraints(0,0,1.0,1.0,GridBagConstraints.BOTH,5,5,5,5)); filePanel.add(browseButton, GuiUtil.setConstraints(1,0,0.0,0.0,GridBagConstraints.NONE,5,5,5,5)); JPanel view = new JPanel(); view.setLayout(new GridBagLayout()); JScrollPane scrollPane = new JScrollPane(view); scrollPane.setBorder(BorderFactory.createEmptyBorder()); scrollPane.setViewportBorder(BorderFactory.createEmptyBorder()); add(scrollPane, GuiUtil.setConstraints(0,1,1.0,1.0,GridBagConstraints.BOTH,0,0,0,0)); operations = new JPanel(); view.add(operations, GuiUtil.setConstraints(0,0,0.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5)); operations.setBorder(BorderFactory.createTitledBorder("")); operations.setLayout(new GridBagLayout()); workspaceLabel = new JLabel(); timestampLabel = new JLabel(); srsComboBoxLabel = new JLabel(); srsComboBox = SrsComboBoxFactory.getInstance(config).createSrsComboBox(true); srsComboBox.setShowOnlySameDimension(true); srsComboBox.setPreferredSize(new Dimension(50, srsComboBox.getPreferredSize().height)); operations.add(workspaceLabel, GuiUtil.setConstraints(0,0,0.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5)); operations.add(workspaceText, GuiUtil.setConstraints(1,0,1.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5)); operations.add(timestampLabel, GuiUtil.setConstraints(2,0,0.0,0.0,GridBagConstraints.NONE,0,10,5,5)); operations.add(datePicker, GuiUtil.setConstraints(3,0,0.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5)); operations.add(srsComboBoxLabel, GuiUtil.setConstraints(0,1,0.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5)); operations.add(srsComboBox, GuiUtil.setConstraints(1,1,3,1,1.0,0.0,GridBagConstraints.BOTH,0,5,5,5)); view.add(filterPanel, GuiUtil.setConstraints(0,3,1.0,1.0,GridBagConstraints.NORTH,GridBagConstraints.BOTH,0,5,0,5)); JPanel buttons = new JPanel(); buttons.setLayout(new GridBagLayout()); add(buttons, GuiUtil.setConstraints(0,4,1.0,0.0,GridBagConstraints.BOTH,5,5,5,5)); buttons.add(exportButton, GuiUtil.setConstraints(0,0,2,1,1.0,0.0,GridBagConstraints.NONE,5,5,5,5)); buttons.add(switchFilterModeButton, GuiUtil.setConstraints(1,0,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.NONE,5,5,5,5)); DropTarget dropTarget = new DropTarget(browseText, this); browseText.setDropTarget(dropTarget); setDropTarget(dropTarget); switchFilterModeButton.addActionListener(e -> switchFilterMode()); }