Mega Code Archive

 
Categories / Java / Swing JFC
 

TextField Elements

/* Core SWING Advanced Programming  By Kim Topley ISBN: 0 13 083292 8        Publisher: Prentice Hall   */ import javax.swing.*; import javax.swing.text.*; public class TextFieldElements {   public static void main(String[] args) {     try {         UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");     } catch (Exception evt) {}        JFrame f = new JFrame("Text Field Elements");     JTextField tf = new JTextField(32);     tf.setText("That's one small step for man...");     f.getContentPane().add(tf);     f.pack();     f.setVisible(true);     ((AbstractDocument)tf.getDocument()).dump(System.out);   } }