本文整理汇总了Java中org.jdesktop.swingx.JXTextField类的典型用法代码示例。如果您正苦于以下问题:Java JXTextField类的具体用法?Java JXTextField怎么用?Java JXTextField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JXTextField类属于org.jdesktop.swingx包,在下文中一共展示了JXTextField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pegarValuesDoArray
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
/**
* Metodo usado para pegar os valores do arrayPreenchidoo apos adicionar ou
* remover variavel
*/
private void pegarValuesDoArray() {
cadaLinha = new ArrayList<>();
matriz = new ArrayList<>();
mapaDeResultados = new HashMap();
int cont = 0;
for (int i = 0; i < this.numeroDeVar; i++) {
for (int j = 0; j <= this.numeroDeVar; j++) {
JXTextField t = (JXTextField) componentes.get(cont);
cadaLinha.add(Double.parseDouble(t.getText()));
cont++;
}
cadaLinha.add(0.0);
cadaLinha.add(0.0);
cadaLinha.add(0.0);
this.matriz.add(cadaLinha);
cadaLinha = new ArrayList<>();
}
this.mapaDeResultados = this.controle.receberMatriz(matriz, tfNrDeCasas.getText());
lbResultado.setText(this.mapaDeResultados.toString());
this.controle.imprimirNaTA(jTextArea1);
}
示例2: main
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JXFrame jxFrame = new JXFrame("Test JXFrame", true);
jxFrame.setPreferredSize(new Dimension(300, 200));
jxFrame.setStartPosition(JXFrame.StartPosition.CenterInScreen);
JXBusyLabel label = new JXBusyLabel();
label.setBusy(true);
JXTextField textField = new JXTextField("<html><h1>test prompt</html>");
textField.addBuddy(new JXButton("buddy"), BuddySupport.Position.LEFT);
final JXPanel jPanel = new JXPanel(new BorderLayout());
jPanel.add(label, BorderLayout.NORTH);
jPanel.add(textField, BorderLayout.CENTER);
jxFrame.getRootPaneExt().setContentPane(jPanel);
jxFrame.pack();
jxFrame.setVisible(true);
});
}
示例3: getNewColumnNames
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
private List<String> getNewColumnNames() {
final List<String> newColumnNames = new LinkedList<>();
final List<JXTextField> values = new ArrayList<>(_columnNamesTextFields.values());
for (int i = 0; i < values.size(); i++) {
final JXTextField jxTextField = values.get(i);
final String text;
final String valueTextBox = jxTextField.getText().trim();
if (StringUtils.isNullOrEmpty(valueTextBox)) {
text = jxTextField.getPrompt();
} else {
text = valueTextBox;
}
newColumnNames.add(text);
}
return newColumnNames;
}
示例4: addJobLevelVariables
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
private void addJobLevelVariables() {
final JLabel tableLabel = DCLabel.bright("<html><b>Job-level variables</b></html>");
tableLabel.setIcon(imageManager.getImageIcon(IconUtils.MODEL_JOB, IconUtils.ICON_SIZE_SMALL));
WidgetUtils.addToGridBag(tableLabel, _panel, 0, _row, 2, 1, GridBagConstraints.WEST);
for (final Entry<String, JXTextField> entry : _variableTextFields.entrySet()) {
_row++;
final String variableId = entry.getKey();
final JXTextField textField = entry.getValue();
WidgetUtils.addToGridBag(
new JLabel(imageManager.getImageIcon("images/model/variable.png", IconUtils.ICON_SIZE_SMALL)),
_panel, 0, _row);
WidgetUtils.addToGridBag(DCLabel.bright(variableId), _panel, 1, _row, GridBagConstraints.WEST);
WidgetUtils.addToGridBag(textField, _panel, 2, _row, GridBagConstraints.WEST);
}
_row++;
}
示例5: addField
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
private void addField(String name, ColumnType columnType) {
if (name == null) {
name = "";
}
final JXTextField nameTextField = WidgetFactory.createTextField();
nameTextField.setText(name);
if (columnType == null) {
columnType = ColumnType.VARCHAR;
}
final DCComboBox<ColumnType> typeComboBox = new DCComboBox<>(getAvailableColumnTypes());
typeComboBox.setRenderer(new EnumComboBoxListRenderer());
typeComboBox.setSelectedItem(columnType);
_tableModel.addRow(new Object[] { nameTextField, typeComboBox });
updateUI();
}
示例6: createTextField
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
private JXTextField createTextField(final InputColumn<?> inputColumn, String mappedString) {
final JXTextField textField = WidgetFactory.createTextField();
_mappedTextFields.put(inputColumn, textField);
if (mappedString == null) {
mappedString = getDefaultMappedString(inputColumn);
}
if (mappedString != null) {
textField.setText(mappedString);
}
textField.getDocument().addDocumentListener(new DCDocumentListener() {
@Override
protected void onChange(final DocumentEvent event) {
if (isBatchUpdating()) {
return;
}
fireValueChanged();
_mappedStringsPropertyWidget.fireValueChanged();
}
});
return textField;
}
示例7: setMappedStrings
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
public void setMappedStrings(final String[] value) {
final List<InputColumn<?>> inputColumns = MultipleMappedStringsPropertyWidget.this.getSelectedInputColumns();
for (int i = 0; i < inputColumns.size(); i++) {
final InputColumn<?> inputColumn = inputColumns.get(i);
final String mappedString;
if (value == null) {
mappedString = getDefaultMappedString(inputColumn);
} else if (i < value.length) {
mappedString = value[i];
} else {
mappedString = getDefaultMappedString(inputColumn);
}
final JXTextField textField = _mappedTextFields.get(inputColumn);
textField.setVisible(true);
final String previousText = textField.getText();
if (!mappedString.equals(previousText)) {
textField.setText(mappedString);
}
}
}
示例8: addTextField
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
private void addTextField(final String value, final boolean updateUI) {
final JXTextField textField = WidgetFactory.createTextField();
if (value != null) {
textField.setText(value);
}
textField.getDocument().addDocumentListener(new DCDocumentListener() {
@Override
protected void onChange(final DocumentEvent e) {
fireValueChanged();
}
});
final int index = _textFieldPanel.getComponentCount();
final JComponent decoration = decorateTextField(textField, index);
_textFieldDecorations.put(decoration, textField);
_textFieldPanel.add(decoration);
if (updateUI) {
_textFieldPanel.updateUI();
}
}
示例9: addTextField
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
private void addTextField(final Object value, final boolean updateUI) {
final JXTextField textField = WidgetFactory.createTextField();
if (value != null) {
textField.setText(_numberFormat.format(value));
}
textField.getDocument().addDocumentListener(new DCDocumentListener() {
@Override
protected void onChange(final DocumentEvent e) {
fireValueChanged();
}
});
_textFieldPanel.add(textField);
if (updateUI) {
_textFieldPanel.updateUI();
}
}
示例10: getCellEditor
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
@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;
}
示例11: gerarCamposNoInicio
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
private void gerarCamposNoInicio() {
/**
* Removendo todos componentes do painel da matriz
*/
pnMatriz.removeAll();
componentes = new ArrayList();
for (int i = 0; i < 2; i++) {
for (int j = 0; j <= 2 + 1; j++) {
if (j == 2) {
JLabel lb = new JLabel("=");
lb.setHorizontalAlignment(JLabel.CENTER);
pnMatriz.add(lb);
} else {
JXTextField tf = new JXTextField();
tf.setHorizontalAlignment(JXTextField.CENTER);
tf.setSize(50, 50);
if (j == 3) {
tf.setPrompt("b" + (i + 1));
} else {
tf.setPrompt("X" + (i + 1) + (j + 1));
}
componentes.add(tf);
pnMatriz.add(tf);
}
}
}
}
示例12: limparCampos
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
/**
* Metodo usado para limpar os campos
*/
private void limparCampos() {
if(!mexido){
this.limparOsPrimeirosCampos();
return;
}
for(Object ob : componentes){
JXTextField tf = (JXTextField) ob;
tf.setText(null);
}
}
示例13: createTextField
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
public static JXTextField createTextField(final String promptText, final int columns) {
final JXTextField tf = new JXTextField(promptText);
tf.setColumns(columns);
if (promptText != null) {
tf.setFocusBehavior(FocusBehavior.SHOW_PROMPT);
tf.setToolTipText(promptText);
}
return tf;
}
示例14: createVariableTextFields
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
private Map<String, JXTextField> createVariableTextFields() {
final Map<String, JXTextField> variableTextFields = new HashMap<>();
for (final Entry<String, String> variableEntry : _metadata.getVariables().entrySet()) {
final String id = variableEntry.getKey();
final String value = variableEntry.getValue();
final JXTextField textField = WidgetFactory.createTextField("Original: " + value);
textField.setText(value);
variableTextFields.put(id, textField);
}
return variableTextFields;
}
示例15: createOpenButton
import org.jdesktop.swingx.JXTextField; //导入依赖的package包/类
private JButton createOpenButton() {
final JButton openButton = WidgetFactory.createPrimaryButton("Open job", IconUtils.MODEL_JOB);
openButton.addActionListener(event -> {
final JaxbJobReader reader = new JaxbJobReader(_configuration);
try {
final SourceColumnMapping sourceColumnMapping = getSourceColumnMapping();
final Map<String, String> variableOverrides = new HashMap<>();
for (final Entry<String, JXTextField> entry : _variableTextFields.entrySet()) {
variableOverrides.put(entry.getKey(), entry.getValue().getText());
}
final InputStream inputStream = _file.getContent().getInputStream();
final AnalysisJobBuilder analysisJobBuilder;
try {
analysisJobBuilder = reader.create(inputStream, sourceColumnMapping, variableOverrides);
} finally {
FileHelper.safeClose(inputStream);
}
final OpenAnalysisJobActionListener openAnalysisJobActionListener =
_openAnalysisJobActionListenerProvider.get();
final Injector injector = openAnalysisJobActionListener.openAnalysisJob(_file, analysisJobBuilder);
OpenAnalysisJobAsTemplateDialog.this.dispose();
final AnalysisJobBuilderWindow window = injector.getInstance(AnalysisJobBuilderWindow.class);
window.open();
} catch (final Exception e) {
throw new IllegalStateException(e);
}
});
return openButton;
}