Package javax.swing

Examples of javax.swing.DefaultButtonModel


  }

  @Override
  public IAdapter getParent() {
    JCheckBoxMenuItem jb = (JCheckBoxMenuItem) getWidget();   
    DefaultButtonModel dbm = (DefaultButtonModel) jb.getModel();
    ButtonGroup bg = dbm.getGroup();
    if (bg != null) {
      for (InvisibleAdapter invisible : getRootAdapter().getInvisibles()) {
        if (invisible instanceof ButtonGroupAdapter) {
          if (bg == ((ButtonGroupAdapter) invisible).getButtonGroup())
            return invisible;
View Full Code Here


  }

  @Override
  public IAdapter getParent() {
    JMenuItem jb = (JMenuItem) getWidget();
    DefaultButtonModel dbm = (DefaultButtonModel) jb.getModel();
    ButtonGroup bg = dbm.getGroup();
    if (bg != null) {
      for (InvisibleAdapter invisible : getRootAdapter().getInvisibles()) {
        if (invisible instanceof ButtonGroupAdapter) {
          if (bg == ((ButtonGroupAdapter) invisible).getButtonGroup())
            return invisible;
View Full Code Here

  }

  @Override
  public void deleteNotify() {
    JMenuItem jb = (JMenuItem) getWidget();
    DefaultButtonModel dbm = (DefaultButtonModel) jb.getModel();
    ButtonGroup bg = dbm.getGroup();
    if (bg != null) {
      bg.remove(jb);
    }
  }
View Full Code Here

          .getWidget();
      Container parent = jmenu.getParent();
      if (parent instanceof JPopupMenu) {
        jmenu.setSelected(true);
        adapter.setDirty(true);
        DefaultButtonModel bm=(DefaultButtonModel) jmenu.getModel();
        ButtonGroup bg=bm.getGroup();
        if(bg!=null){
          int count =bg.getButtonCount();
          if(count>0){
            Enumeration<AbstractButton> elements = bg.getElements();
            while(elements.hasMoreElements()){
View Full Code Here

    lastActionEvent = e;
  }

  public void test(TestHarness harness)
  {
    DefaultButtonModel m = new DefaultButtonModel();
    m.addActionListener(this);
    m.addChangeListener(this);
    m.setRollover(true);
    harness.check(m.isRollover(), true);
    harness.check(lastChangeEvent.getSource(), m);
    harness.check(lastActionEvent, null);
   
    // setting the same again causes no event
    lastChangeEvent = null;
    m.setRollover(true);
    harness.check(lastChangeEvent, null);
   
    // are the states independent?  Seems so.
    m.setPressed(true);
    harness.check(m.isRollover(), true);
    m.setEnabled(false);
    harness.check(m.isRollover(), true);
    m.setEnabled(true);
    harness.check(m.isRollover(), true);
  }
View Full Code Here

    // do nothing      
  }

  public void test(TestHarness harness)
  {
    DefaultButtonModel m = new DefaultButtonModel();
    m.addActionListener(this);
    harness.check(m.getActionListeners()[0], this);
    m.addActionListener(null);
    harness.check(m.getActionListeners().length, 1);
  }
View Full Code Here

public class setActionCommand implements Testlet
{
  public void test(TestHarness harness)
  {
    DefaultButtonModel m = new DefaultButtonModel();
    m.setActionCommand("XYZ");
    harness.check(m.getActionCommand(), "XYZ");
    m.setActionCommand(null);
    harness.check(m.getActionCommand(), null);
  }
View Full Code Here

    lastItemEvent = e;
  }
 
  public void test(TestHarness harness)
  {
    DefaultButtonModel m = new DefaultButtonModel();
    m.addActionListener(this);
    m.addChangeListener(this);
    m.addItemListener(this);
    m.setSelected(true);
    harness.check(m.isSelected(), true);
    harness.check(lastChangeEvent.getSource(), m);
    harness.check(lastActionEvent, null);
    harness.check(lastItemEvent.getSource(), m);
    harness.check(lastItemEvent.getItem(), m);
   
    // setting the same again causes no event
    lastChangeEvent = null;
    lastItemEvent = null;
    m.setSelected(true);
    harness.check(lastChangeEvent, null);
    harness.check(lastItemEvent, null);
   
    // are the states independent?  Seems so.
    m.setPressed(true);
    harness.check(m.isSelected(), true);
    m.setEnabled(false);
    harness.check(m.isSelected(), true);
    m.setEnabled(true);
    harness.check(m.isSelected(), true);
  }
View Full Code Here

  }
 
  public void testEvent(TestHarness harness)
  {
    harness.checkPoint("testEvent");
    DefaultButtonModel m = new DefaultButtonModel();
    m.addActionListener(this);
    m.addChangeListener(this);
    lastActionEvent = null;
    m.setActionCommand("ABC");
    m.setArmed(true);
    harness.check(lastActionEvent, null);
    m.setPressed(true);
    lastChangeEvent = null;
    harness.check(lastActionEvent, null);
    m.setPressed(false);
    harness.check(lastActionEvent.getSource(), m);
    harness.check(lastActionEvent.getActionCommand(), "ABC");
    harness.check(lastChangeEvent.getSource(), m);
  }
View Full Code Here

    lastActionEvent = e;
  }

  public void test(TestHarness harness)
  {
    DefaultButtonModel m = new DefaultButtonModel();
    m.addActionListener(this);
    m.addChangeListener(this);
    m.setMnemonic(99);
    harness.check(m.getMnemonic(), 99);
    harness.check(lastChangeEvent.getSource(), m);
    harness.check(lastActionEvent, null);
   
    // setting the same again causes no event - actually, the reference
    // implementation fails this test, I filed it as a bug report to Sun and
    // will await their assessment...
    lastChangeEvent = null;
    m.setMnemonic(99);
    harness.check(lastChangeEvent, null);
   
    // try a wild argument
    m.setMnemonic(Integer.MIN_VALUE);
    harness.check(m.getMnemonic(), Integer.MIN_VALUE);
  }
View Full Code Here

TOP

Related Classes of javax.swing.DefaultButtonModel

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.