ToggleButton.java :  » Testing » UISpec4J » org » uispec4j » Java Open Source

Java Open Source » Testing » UISpec4J 
UISpec4J » org » uispec4j » ToggleButton.java
package org.uispec4j;

import junit.framework.Assert;
import org.uispec4j.assertion.Assertion;

import javax.swing.*;
import java.awt.*;

/**
 * Wrapper for JToggleButton components.
 */
public class ToggleButton extends AbstractButton {
  public static final String TYPE_NAME = "toggleButton";
  public static final Class[] SWING_CLASSES = {JToggleButton.class};

  private JToggleButton jToggleButton;

  public ToggleButton(JToggleButton jToggleButton) {
    super(jToggleButton);
    this.jToggleButton = jToggleButton;
  }

  public Component getAwtComponent() {
    return jToggleButton;
  }

  public String getDescriptionTypeName() {
    return TYPE_NAME;
  }

  public Assertion isSelected() {
    return new Assertion() {
      public void check() {
        Assert.assertTrue(jToggleButton.isSelected());
      }
    };
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.