Пример #1
0
 public void actionPerformed(ActionEvent ae) {
   String cname = nameF.getText().trim();
   int state = conditions[stateC.getSelectedIndex()];
   try {
     if (isSpecialCase(cname)) {
       handleSpecialCase(cname, state);
     } else {
       JComponent comp = (JComponent) Class.forName(cname).newInstance();
       ComponentUI cui = UIManager.getUI(comp);
       cui.installUI(comp);
       results.setText("Map entries for " + cname + ":\n\n");
       if (inputB.isSelected()) {
         loadInputMap(comp.getInputMap(state), "");
         results.append("\n");
       }
       if (actionB.isSelected()) {
         loadActionMap(comp.getActionMap(), "");
         results.append("\n");
       }
       if (bindingB.isSelected()) {
         loadBindingMap(comp, state);
       }
     }
   } catch (ClassCastException cce) {
     results.setText(cname + " is not a subclass of JComponent.");
   } catch (ClassNotFoundException cnfe) {
     results.setText(cname + " was not found.");
   } catch (InstantiationException ie) {
     results.setText(cname + " could not be instantiated.");
   } catch (Exception e) {
     results.setText("Exception found:\n" + e);
     e.printStackTrace();
   }
 }
Пример #2
0
 /**
  * Resets the UI property to a value from the current look and feel.
  *
  * @see JComponent#updateUI
  */
 public void updateUI() {
   setUI((SliderUI) UIManager.getUI(this));
   // The labels preferred size may be derived from the font
   // of the slider, so we must update the UI of the slider first, then
   // that of labels.  This way when setSize is called the right
   // font is used.
   updateLabelUIs();
 }
Пример #3
0
 /**
  * Resets the UI property to a value from the current look and feel.
  *
  * @see JComponent#updateUI
  */
 public void updateUI() {
   setUI((ButtonUI) UIManager.getUI(this));
 }
Пример #4
0
 /**
  * Overrides <code>JComponent.updateUI</code>.
  *
  * @see JComponent#updateUI
  */
 public void updateUI() {
   setUI((ScrollBarUI) UIManager.getUI(this));
 }