Advertisement
MrPolywhirl

DocumentListener

Oct 29th, 2013
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. class MyDocumentListener implements DocumentListener {
  2.     public void insertUpdate(DocumentEvent e) {
  3.         System.out.println(e.getType());
  4.         setEnabled(false);
  5.     }
  6.  
  7.     public void removeUpdate(DocumentEvent e) {
  8.         if (idTF.getText().isEmpty()) {
  9.             setEnabled(true);
  10.         }
  11.     }
  12.  
  13.     public void changedUpdate(DocumentEvent e) { }
  14.  
  15.     private void setEnabled(boolean enabled) {
  16.         searchF.setEditable(enabled);
  17.         rangeTF1.setEditable(enabled);
  18.         rangeTF2.setEditable(enabled);
  19.         ageTF.setEditable(enabled);
  20.         addressTF.setEditable(enabled);
  21.         crimebox.setEnabled(enabled);
  22.         countrybox.setEnabled(enabled);
  23.         genderbox.setEnabled(enabled)
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement