UpcaseFilterpublic class UpcaseFilter extends DocumentFilter
Methods Summary |
---|
public void | insertString(javax.swing.text.DocumentFilter$FilterBypass fb, int offset, java.lang.String text, javax.swing.text.AttributeSet attr)
fb.insertString(offset, text.toUpperCase(), attr);
| public static void | main(java.lang.String[] args)
DocumentFilter dfilter = new UpcaseFilter();
JTextArea jta = new JTextArea();
JTextField jtf = new JTextField();
((AbstractDocument)jta.getDocument()).setDocumentFilter(dfilter);
((AbstractDocument)jtf.getDocument()).setDocumentFilter(dfilter);
JFrame frame = new JFrame("UpcaseFilter");
frame.getContentPane().add(jta, java.awt.BorderLayout.CENTER);
frame.getContentPane().add(jtf, java.awt.BorderLayout.SOUTH);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(200, 120);
frame.setVisible(true);
| public void | replace(javax.swing.text.DocumentFilter$FilterBypass fb, int offset, int length, java.lang.String text, javax.swing.text.AttributeSet attr)
fb.replace(offset, length, text.toUpperCase(), attr);
|
|