Wednesday, December 31, 2008
Disable Keyboard Editing in JSpinner
import javax.swing.*;
import java.awt.*;
public class Disablekeyboard{
public static void main(String[] args){
JFrame frm = new JFrame("Disable Keyboard Editing Example");
JSpinner spinner = new JSpinner();
JFormattedTextField tf = ((JSpinner.DefaultEditor)spinner.getEditor())
.getTextField();
tf.setEditable(false);
spinner.setValue(new Integer(100));
JPanel panel = new JPanel();
panel.add(spinner);
frm.add(panel, BorderLayout.NORTH);
frm.setSize(350, 350);
frm.setVisible(true);
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment