本文整理了Java中javax.swing.JTextField.setDocument()
方法的一些代码示例,展示了JTextField.setDocument()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.setDocument()
方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:setDocument
暂无
代码示例来源:origin: stackoverflow.com
import java.awt.*;
import javax.swing.*;
public class DemoJTextFieldWithLimit extends JApplet{
JTextField textfield1;
JLabel label1;
public void init() {
getContentPane().setLayout(new FlowLayout());
//
label1 = new JLabel("max 10 chars");
textfield1 = new JTextField(15);
getContentPane().add(label1);
getContentPane().add(textfield1);
textfield1.setDocument
(new JTextFieldLimit(10));
}
}
代码示例来源:origin: stackoverflow.com
add(label1);
add(textfield1);
textfield1.setDocument(new JTextFieldLimit(10));
代码示例来源:origin: dboissier/mongo4idea
@NotNull
private JPanel createRowLimitPanel() {
rowLimitField.setText(Integer.toString(configuration.getDefaultRowLimit()));
rowLimitField.setColumns(5);
rowLimitField.setDocument(new NumberDocument());
rowLimitField.setText(Integer.toString(configuration.getDefaultRowLimit()));
JPanel rowLimitPanel = new NonOpaquePanel();
rowLimitPanel.add(new JLabel("Row limit:"), BorderLayout.WEST);
rowLimitPanel.add(rowLimitField, BorderLayout.CENTER);
rowLimitPanel.add(Box.createHorizontalStrut(5), BorderLayout.EAST);
return rowLimitPanel;
}
代码示例来源:origin: stackoverflow.com
this.setDocument(new MyDocument());
代码示例来源:origin: dboissier/mongo4idea
defaultRowLimitTextField.setDocument(new NumberDocument());
代码示例来源:origin: dcaoyuan/nbscala
/** Creates new form CustomizerApplication */
public CustomizerApplication(J2SEProjectProperties props) {
initComponents();
titleTextField.setDocument(props.APPLICATION_TITLE_DOC);
vendorTextField.setDocument(props.APPLICATION_VENDOR_DOC);
descTextArea.setDocument(props.APPLICATION_DESC_DOC);
homepageTextField.setDocument(props.APPLICATION_HOMEPAGE_DOC);
splashTextField.setDocument(props.APPLICATION_SPLASH_DOC);
}
代码示例来源:origin: net.anwiba.commons/anwiba-commons-swing-core
@Override
public void setDocument(final Document doc) {
if (this.isInititalized) {
throw new UnsupportedOperationException();
}
if (doc instanceof PlainDocument) {
super.setDocument(doc);
return;
}
throw new UnsupportedOperationException();
}
代码示例来源:origin: org.japura/japura-gui
public JTextField getTextField() {
if (textField == null) {
textField = new JTextField(8);
textField.setDocument(getDateDocument());
}
return textField;
}
代码示例来源:origin: org.japura/japura-gui
/**
* @see JTextField#setDocument(Document)
*/
public void setDocument(Document doc) {
getField().setDocument(doc);
}
代码示例来源:origin: com.jalalkiswani/jk-desktop
/**
* Instantiates a new JK number text editor.
*
* @param textField
* the text field
* @param maxLength
* the max length
*/
public JKNumberTextEditor(final JTextField textField, final int maxLength) {
super(textField);
textField.setDocument(new NumberDocument(maxLength));
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-clientproject
public CustomizerJar( AppClientProjectProperties uiProperties ) {
initComponents();
jTextFieldDistDir.setDocument( uiProperties.DIST_JAR_MODEL );
jTextFieldExcludes.setDocument( uiProperties.BUILD_CLASSES_EXCLUDES_MODEL );
uiProperties.JAR_COMPRESS_MODEL.setMnemonic( jCheckBoxCommpress.getMnemonic() );
jCheckBoxCommpress.setModel( uiProperties.JAR_COMPRESS_MODEL );
}
代码示例来源:origin: org.gephi/datalab-plugin
/** Creates new form SetNodesSizeUI */
public SetNodesSizeUI() {
initComponents();
sizeText.setDocument(new FloatJTextFieldFilter());
}
代码示例来源:origin: org.apache.xmlgraphics/batik-awt-util
protected void addToPanelAtRow(String label,
Document model,
String suffix,
JGridBagPanel p,
int row){
JTextField tf = new JTextField(Resources.getInteger(CONFIG_TEXT_FIELD_WIDTH));
tf.setDocument(model);
p.add(new JLabel(label), 0, row, 1, 1, WEST, HORIZONTAL, 0, 0);
p.add(tf, 1, row, 1, 1, CENTER, HORIZONTAL, 1, 0);
p.add(new JLabel(suffix), 2, row, 1, 1, WEST, HORIZONTAL, 0, 0);
}
代码示例来源:origin: net.java.abeille/abeille
public DimensionView(Dimension dim) {
setLayout(new BorderLayout());
m_view = new FormPanel("com/jeta/swingbuilder/gui/dimension/dimension.jfrm");
add(m_view, BorderLayout.CENTER);
m_view.getTextField(DimensionNames.ID_WIDTH_FIELD).setDocument(new IntegerDocument(false));
m_view.getTextField(DimensionNames.ID_HEIGHT_FIELD).setDocument(new IntegerDocument(false));
if (dim != null) {
m_view.setText(DimensionNames.ID_WIDTH_FIELD, String.valueOf(dim.width));
m_view.setText(DimensionNames.ID_HEIGHT_FIELD, String.valueOf(dim.height));
}
}
代码示例来源:origin: org.japura/japura-gui
public void setDateDocument(DateDocument dateDocument) {
if (dateDocument != null) {
this.dateDocument = dateDocument;
getTextField().setDocument(dateDocument);
setLocale(dateDocument.getLocale());
}
}
代码示例来源:origin: dcaoyuan/nbscala
public CustomizerJar( J2SEProjectProperties uiProperties ) {
initComponents();
distDirField.setDocument(uiProperties.DIST_JAR_MODEL);
excludeField.setDocument(uiProperties.BUILD_CLASSES_EXCLUDES_MODEL);
uiProperties.JAR_COMPRESS_MODEL.setMnemonic(compressCheckBox.getMnemonic());
compressCheckBox.setModel(uiProperties.JAR_COMPRESS_MODEL);
uiProperties.DO_JAR_MODEL.setMnemonic(doJarCheckBox.getMnemonic());
doJarCheckBox.setModel(uiProperties.DO_JAR_MODEL);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-ejbjarproject
public CustomizerJar( EjbJarProjectProperties uiProperties ) {
initComponents();
jTextFieldDistDir.setDocument( uiProperties.DIST_JAR_MODEL );
jTextFieldExcludes.setDocument( uiProperties.BUILD_CLASSES_EXCLUDES_MODEL );
uiProperties.JAR_COMPRESS_MODEL.setMnemonic( jCheckBoxCommpress.getMnemonic() );
jCheckBoxCommpress.setModel( uiProperties.JAR_COMPRESS_MODEL );
uiProperties.INCLUDE_JARS_MODEL.setMnemonic( includeJarsCheckBox.getMnemonic() );
includeJarsCheckBox.setModel(uiProperties.INCLUDE_JARS_MODEL);
}
代码示例来源:origin: BranislavLazic/SwingTutorials
public JNumberTextField(int maxLen, int format) {
setAllowNegative(true);
setMaxLength(maxLen);
setFormat(format);
numberFieldFilter = new JNumberFieldFilter();
super.setDocument(numberFieldFilter);
}
代码示例来源:origin: SonarSource/sonarlint-intellij
private void createUIComponents() {
sonarcloudIcon = new JLabel(SonarLintIcons.icon("SonarCloud"));
sonarqubeIcon = new JLabel(SonarLintIcons.icon("SonarQube"));
sonarcloudText = SwingHelper.createHtmlViewer(false, null, null, null);
sonarqubeText = SwingHelper.createHtmlViewer(false, null, null, null);
JBTextField text = new JBTextField();
text.getEmptyText().setText("Example: http://localhost:9000");
urlText = text;
nameField = new JBTextField();
nameField.setDocument(new LengthRestrictedDocument(NAME_MAX_LENGTH));
}
}
代码示例来源:origin: dcaoyuan/nbscala
public CustomizerCompile( J2SEProjectProperties uiProperties ) {
initComponents();
uiProperties.SCALAC_DEPRECATION_MODEL.setMnemonic( deprecationCheckBox.getMnemonic() );
deprecationCheckBox.setModel( uiProperties.SCALAC_DEPRECATION_MODEL );
uiProperties.SCALAC_UNCHECKED_MODEL.setMnemonic( uncheckedCheckBox.getMnemonic() );
uncheckedCheckBox.setModel( uiProperties.SCALAC_UNCHECKED_MODEL );
uiProperties.JAVAC_DEBUG_MODEL.setMnemonic( debugInfoCheckBox.getMnemonic() );
debugInfoCheckBox.setModel( uiProperties.JAVAC_DEBUG_MODEL );
uiProperties.DO_DEPEND_MODEL.setMnemonic(doDependCheckBox.getMnemonic());
doDependCheckBox.setModel(uiProperties.DO_DEPEND_MODEL);
additionalJavacParamsField.setDocument( uiProperties.SCALAC_COMPILER_ARG_MODEL );
}
内容来源于网络,如有侵权,请联系作者删除!