Package java.beans

Examples of java.beans.PropertyChangeEvent


  {
    AbstractButton b = new JButton("ABC");
    b.addPropertyChangeListener(this);
    b.setVerticalTextPosition(SwingConstants.TOP);
    harness.check(b.getVerticalTextPosition(), SwingConstants.TOP);
    PropertyChangeEvent e = (PropertyChangeEvent) events.get(0);
    harness.check(e.getSource(), b);
    harness.check(e.getPropertyName(), "verticalTextPosition");
    harness.check(e.getOldValue(), new Integer(SwingConstants.CENTER));
    harness.check(e.getNewValue(), new Integer(SwingConstants.TOP));
   
    // setting the same value should generate no event
    events.clear();
    b.setVerticalTextPosition(SwingConstants.TOP);
    harness.check(events.size(), 0);
View Full Code Here


      label.addPropertyChangeListener(this);
      label.setText("CAB");
      harness.check(label.getText(), "CAB");
      harness.check(label.getDisplayedMnemonicIndex(), 0);
      harness.check(events.size(), 2);
      PropertyChangeEvent e0 = (PropertyChangeEvent) events.get(0);
      harness.check(e0.getSource(), label);
      harness.check(e0.getPropertyName(), "text");
      harness.check(e0.getOldValue(), "ABC");
      harness.check(e0.getNewValue(), "CAB");

      PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(1);
      if (e1.getPropertyName().equals("html"))
          e1 = (PropertyChangeEvent) events.get(2);
      harness.check(e1.getSource(), label);
      harness.check(e1.getPropertyName(), "displayedMnemonicIndex");
      harness.check(e1.getOldValue(), new Integer(2));
      harness.check(e1.getNewValue(), new Integer(0));
     
      // setting the same again should generate no event
      events.clear();
      label.setText("CAB");
      harness.check(events.size(), 0);
     
      // check null
      events.clear();
      label.setText(null);
      harness.check(label.getText(), null);
      harness.check(label.getDisplayedMnemonicIndex(), -1);
      harness.check(events.size(), 2);
      e0 = (PropertyChangeEvent) events.get(0);
      harness.check(e0.getSource(), label);
      harness.check(e0.getPropertyName(), "text");
      harness.check(e0.getOldValue(), "CAB");
      harness.check(e0.getNewValue(), null);

      e1 = (PropertyChangeEvent) events.get(1);
      if (e1.getPropertyName().equals("html"))
          e1 = (PropertyChangeEvent) events.get(2);
      harness.check(e1.getSource(), label);
      harness.check(e1.getPropertyName(), "displayedMnemonicIndex");
      harness.check(e1.getOldValue(), new Integer(0));
      harness.check(e1.getNewValue(), new Integer(-1));

  }
View Full Code Here

  {
    AbstractButton b = new JButton("ABC");
    b.addPropertyChangeListener(this);
    b.setVerticalAlignment(SwingConstants.BOTTOM);
    harness.check(b.getVerticalAlignment(), SwingConstants.BOTTOM);
    PropertyChangeEvent e = (PropertyChangeEvent) events.get(0);
    harness.check(e.getSource(), b);
    harness.check(e.getPropertyName(), "verticalAlignment");
    harness.check(e.getOldValue(), new Integer(SwingConstants.CENTER));
    harness.check(e.getNewValue(), new Integer(SwingConstants.BOTTOM));
   
    // setting the same value should generate no event
    events.clear();
    b.setVerticalAlignment(SwingConstants.BOTTOM);
    harness.check(events.size(), 0);
View Full Code Here

    JTable t = new JTable();
    harness.check(t.getRowSelectionAllowed(), true);
    t.addPropertyChangeListener(this);
    t.setRowSelectionAllowed(false);
    harness.check(events.size(), 1);
    PropertyChangeEvent event = (PropertyChangeEvent) events.get(0);
    harness.check(event.getSource(), t);
    harness.check(event.getPropertyName(), "rowSelectionAllowed");
    harness.check(event.getOldValue(), Boolean.TRUE);
    harness.check(event.getNewValue(), Boolean.FALSE);
   
    // setting the same again generates no event
    events.clear();
    t.setRowSelectionAllowed(false);
    harness.check(events.size(), 0);
View Full Code Here

    ac.addPropertyChangeListener(this);
    boolean b = av.setCurrentAccessibleValue(new Integer(55));
    harness.check(scrollBar.getValue(), 55);
    harness.check(b);
    harness.check(events.size(), 1);
    PropertyChangeEvent e0 = (PropertyChangeEvent) events.get(0);
    harness.check(e0.getPropertyName(),
        AccessibleContext.ACCESSIBLE_VALUE_PROPERTY);
    harness.check(e0.getSource(), ac);
    harness.check(e0.getOldValue(), new Integer(50));
    harness.check(e0.getNewValue(), new Integer(55));
   
    // set the value below the minimum
    events.clear();
    b = av.setCurrentAccessibleValue(new Integer(5));
    harness.check(av.getCurrentAccessibleValue(), new Integer(10));
    harness.check(b);
    harness.check(events.size(), 1);
    e0 = (PropertyChangeEvent) events.get(0);
    harness.check(e0.getPropertyName(),
        AccessibleContext.ACCESSIBLE_VALUE_PROPERTY);
    harness.check(e0.getSource(), ac);
    harness.check(e0.getOldValue(), new Integer(55));
    harness.check(e0.getNewValue(), new Integer(10));
   
    // set the value above the maximum
    events.clear();
    b = av.setCurrentAccessibleValue(new Integer(105));
    harness.check(av.getCurrentAccessibleValue(), new Integer(85));
    harness.check(b);
    harness.check(events.size(), 1);
    e0 = (PropertyChangeEvent) events.get(0);
    harness.check(e0.getPropertyName(),
        AccessibleContext.ACCESSIBLE_VALUE_PROPERTY);
    harness.check(e0.getSource(), ac);
    harness.check(e0.getOldValue(), new Integer(10));
    harness.check(e0.getNewValue(), new Integer(85));
   
    // set the value to null
    events.clear();
    b = av.setCurrentAccessibleValue(null);
    harness.check(av.getCurrentAccessibleValue(), new Integer(85));
View Full Code Here

  {
    AbstractButton b = new JButton("ABC");
    b.addPropertyChangeListener(this);
    b.setHorizontalAlignment(SwingConstants.RIGHT);
    harness.check(b.getHorizontalAlignment(), SwingConstants.RIGHT);
    PropertyChangeEvent e = (PropertyChangeEvent) events.get(0);
    harness.check(e.getSource(), b);
    harness.check(e.getPropertyName(), "horizontalAlignment");
    harness.check(e.getOldValue(), new Integer(SwingConstants.CENTER));
    harness.check(e.getNewValue(), new Integer(SwingConstants.RIGHT));
   
    // setting the same value should generate no event
    events.clear();
    b.setHorizontalAlignment(SwingConstants.RIGHT);
    harness.check(events.size(), 0);
View Full Code Here

    harness.check(ac0ac.getAccessibleName(), "AA");
    ac0ac.addPropertyChangeListener(this);
    ac0ac.setAccessibleName("AAx");
    harness.check(ac0ac.getAccessibleName(), "AAx");
    harness.check(events.size(), 1);
    PropertyChangeEvent pce = (PropertyChangeEvent) events.get(0);
    harness.check(pce.getPropertyName(), AccessibleContext.ACCESSIBLE_NAME_PROPERTY);
    harness.check(pce.getOldValue(), null);
    harness.check(pce.getNewValue(), "AAx");
  }
View Full Code Here

    b.setRolloverEnabled(false);
    b.addPropertyChangeListener(this);
    b.setRolloverIcon(icon1);
    harness.check(b.getRolloverIcon(), icon1);
    harness.check(events.size(), 2);
    PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
    harness.check(e1.getSource(), b);
    harness.check(e1.getPropertyName(), "rolloverIcon");
    harness.check(e1.getOldValue(), null);
    harness.check(e1.getNewValue(), icon1);
    PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
    harness.check(e2.getSource(), b);
    harness.check(e2.getPropertyName(), "rolloverEnabled");
    harness.check(e2.getOldValue(), Boolean.FALSE);
    harness.check(e2.getNewValue(), Boolean.TRUE);
   
    // change the icon
    events.clear();
    b.setRolloverIcon(icon2);
    harness.check(b.getRolloverIcon(), icon2);
View Full Code Here

    b.setRolloverEnabled(false);
    b.addPropertyChangeListener(this);
    b.setRolloverSelectedIcon(icon1);
    harness.check(b.getRolloverSelectedIcon(), icon1);
    harness.check(events.size(), 2);
    PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
    harness.check(e1.getSource(), b);
    harness.check(e1.getPropertyName(), "rolloverSelectedIcon");
    harness.check(e1.getOldValue(), null);
    harness.check(e1.getNewValue(), icon1);
    PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
    harness.check(e2.getSource(), b);
    harness.check(e2.getPropertyName(), "rolloverEnabled");
    harness.check(e2.getOldValue(), Boolean.FALSE);
    harness.check(e2.getNewValue(), Boolean.TRUE);
   
    // change the icon
    events.clear();
    b.setRolloverSelectedIcon(icon2);
    harness.check(b.getRolloverSelectedIcon(), icon2);
View Full Code Here

  {
    AbstractButton b = new JButton("ABC");
    b.addPropertyChangeListener(this);
    b.setHorizontalTextPosition(SwingConstants.LEFT);
    harness.check(b.getHorizontalTextPosition(), SwingConstants.LEFT);
    PropertyChangeEvent e = (PropertyChangeEvent) events.get(0);
    harness.check(e.getSource(), b);
    harness.check(e.getPropertyName(), "horizontalTextPosition");
    harness.check(e.getOldValue(), new Integer(SwingConstants.TRAILING));
    harness.check(e.getNewValue(), new Integer(SwingConstants.LEFT));
   
    // setting the same value should generate no event
    events.clear();
    b.setHorizontalTextPosition(SwingConstants.LEFT);
    harness.check(events.size(), 0);
View Full Code Here

TOP

Related Classes of java.beans.PropertyChangeEvent

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.