Package javax.swing

Examples of javax.swing.JSpinner$SpinnerListFormatter$ListFilter


{
  public void test(TestHarness harness)
  {
    harness.checkPoint("(JSpinner)");
    SpinnerListModel m = new SpinnerListModel(new String[] {"A", "B", "C"});
    JSpinner s = new JSpinner(m);
    JSpinner.DefaultEditor e = new JSpinner.DefaultEditor(s);
    harness.check(e.getLayout(), e);
    harness.check(e.getTextField().getValue(), "A");
   
    // the editor should be a listener on the spinner
    EventListener[] sl = s.getListeners(ChangeListener.class);
    harness.check(Arrays.asList(sl).contains(e));
   
    // the editor should be listening to PropertyChangeEvents in the
    // text field
    EventListener[] tfl = e.getTextField().getListeners(
View Full Code Here


{
  public void test(TestHarness harness)
  {
    harness.checkPoint("()");
    SpinnerListModel m = new SpinnerListModel(new String[] {"A", "B", "C"});
    JSpinner s = new JSpinner(m);
    JSpinner.ListEditor editor = (JSpinner.ListEditor) s.getEditor();
    harness.check(editor.getModel(), m);
  }
View Full Code Here

{

  public void test(TestHarness harness)
  {
    harness.checkPoint("(ChangeEvent)");
    JSpinner s = new JSpinner();
    MyDefaultEditor e = new MyDefaultEditor(s);
    s.setEditor(e);
    s.getModel().setValue(new Integer(99));
    harness.check(e.stateChangeEvents.size(), 1);
    ChangeEvent event = (ChangeEvent) e.stateChangeEvents.get(0);
    harness.check(event.getSource(), s);
    harness.check(e.getTextField().getText(), "99");
  }
View Full Code Here

public class constructor implements Testlet
{
  public void test(TestHarness harness)
  {
    harness.checkPoint("(JSpinner)");
    JSpinner s = new JSpinner();
    JSpinner.DefaultEditor e = new JSpinner.DefaultEditor(s);
    harness.check(e.getLayout(), e);
    harness.check(e.getTextField().getValue(), new Integer(0));
   
    // the editor should be a listener on the spinner
    EventListener[] sl = s.getListeners(ChangeListener.class);
    harness.check(Arrays.asList(sl).contains(e));
   
    // the editor should be listening to PropertyChangeEvents in the
    // text field
    EventListener[] tfl = e.getTextField().getListeners(
View Full Code Here

{

  public void test(TestHarness harness)
  {
    harness.checkPoint("(Container)");
    JSpinner s = new JSpinner();
    JSpinner.NumberEditor editor = (JSpinner.NumberEditor) s.getEditor();
    Dimension tfSize = editor.getTextField().getPreferredSize();
    Insets insets = editor.getInsets();
    Dimension result = editor.preferredLayoutSize(editor);
    harness.check(result.width, tfSize.width + insets.left + insets.right);
    harness.check(result.height, tfSize.height + insets.top + insets.bottom);
View Full Code Here

{

  public void test(TestHarness harness)
  {
    harness.checkPoint("(Container)");
    JSpinner s = new JSpinner();
    JSpinner.NumberEditor editor = (JSpinner.NumberEditor) s.getEditor();
    Dimension tfSize = editor.getTextField().getMinimumSize();
    Insets insets = editor.getInsets();
    Dimension result = editor.minimumLayoutSize(editor);
    harness.check(result.width, tfSize.width + insets.left + insets.right);
    harness.check(result.height, tfSize.height + insets.top + insets.bottom);
View Full Code Here

{

  public void test(TestHarness harness)
  {
    harness.checkPoint("(PropertyChangeEvent)");
    JSpinner s = new JSpinner();
    MyDefaultEditor e = new MyDefaultEditor(s);
    s.setEditor(e);
    e.propertyChangeEvents.clear();
    e.getTextField().setValue(new Integer(88));
    harness.check(e.propertyChangeEvents.size(), 1);
    PropertyChangeEvent event = (PropertyChangeEvent)
        e.propertyChangeEvents.get(0);
View Full Code Here

  }
 
  public void test(TestHarness harness)
  {
    harness.checkPoint("()");
    JSpinner s = new JSpinner();
    ChangeListener[] cl = s.getChangeListeners();
    harness.check(cl.length, 1);
    harness.check(cl[0], s.getEditor());
   
    s.addChangeListener(this);
    cl = s.getChangeListeners();
    harness.check(cl.length, 2);
    harness.check(Arrays.asList(cl).contains(this));
   
    s.removeChangeListener(this);   
    cl = s.getChangeListeners();
    harness.check(cl.length, 1);
    harness.check(!Arrays.asList(cl).contains(this));
  }
View Full Code Here

      {
        harness.fail(e.toString())
      }
   
    SpinnerNumberModel m = new SpinnerNumberModel();
    JSpinner spinner = new JSpinner(m);
    harness.check(spinner.getValue(), new Integer(0));
    harness.check(spinner.getEditor() instanceof JSpinner.NumberEditor);
   
    // the model has a listener, but it isn't the spinner, editor or UI
    // some private class is listening and passing on events
    EventListener[] mListeners = m.getListeners(ChangeListener.class);
    harness.check(mListeners.length, 1);
    harness.check(!Arrays.asList(mListeners).contains(spinner));
    harness.check(!Arrays.asList(mListeners).contains(spinner.getUI()));
    harness.check(!Arrays.asList(mListeners).contains(spinner.getEditor()));
  }
View Full Code Here

  public void constructor2(TestHarness harness)
  {
    harness.checkPoint("(SpinnerModel)");
    SpinnerNumberModel m = new SpinnerNumberModel(5, 0, 10, 1);
    JSpinner spinner = new JSpinner(m);
    harness.check(spinner.getValue(), new Integer(5));
    harness.check(spinner.getEditor() instanceof JSpinner.NumberEditor);
   
    // try null model
    boolean pass = false;
    try
    {
      /*JSpinner s =*/ new JSpinner(null);
    }
    catch (NullPointerException e)
    {
      pass = true;
    }
View Full Code Here

TOP

Related Classes of javax.swing.JSpinner$SpinnerListFormatter$ListFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.