List of usage examples for javax.swing JTextField JTextField
public JTextField(Document doc, String text, int columns)
JTextField
that uses the given text storage model and the given number of columns. From source file:MaxLengthDocument.java
public static void main(String[] args) { Document doc = new MaxLengthDocument(5); JTextField field = new JTextField(doc, "", 8); JPanel flowPanel = new JPanel(); flowPanel.add(field);/*from www. j av a 2s . com*/ JFrame frame = new JFrame("MaxLengthDocument demo"); frame.setContentPane(flowPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(160, 80); frame.setVisible(true); }
From source file:MaxLengthDocument.java
public static void main(String[] a) { Document doc = new MaxLengthDocument(5); // set maximum length to 5 JTextField field = new JTextField(doc, "", 8); JPanel flowPanel = new JPanel(); flowPanel.add(field);/* w w w . j av a2 s . c om*/ JFrame frame = new JFrame("MaxLengthDocument demo"); frame.setContentPane(flowPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(160, 80); frame.setVisible(true); }