import java.awt.BorderLayout;
import java.awt.Container;
import java.util.Date;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
public class FormattedTest {
public static void main(String args[]) {
JFrame frame = new JFrame("Formatted");
Container contentPane = frame.getContentPane();
JFormattedTextField ftf1 = new JFormattedTextField(new Integer(0));
contentPane.add(ftf1, BorderLayout.NORTH);
JFormattedTextField ftf2 = new JFormattedTextField(new Date());
contentPane.add(ftf2, BorderLayout.SOUTH);
frame.setSize(200, 100);
frame.show();
}
}
|