Java 类javax.swing.JToggleButton.ToggleButtonModel 实例源码

项目:incubator-netbeans    文件:JWSProjectProperties.java   
private void initRadioButtons() {

    applicationDescButtonModel = new ToggleButtonModel();
    appletDescButtonModel = new ToggleButtonModel();
    compDescButtonModel = new ToggleButtonModel();
    bg = new ButtonGroup();
    applicationDescButtonModel.setGroup(bg);
    appletDescButtonModel.setGroup(bg);
    compDescButtonModel.setGroup(bg);

    String desc = evaluator.getProperty(JNLP_DESCRIPTOR);
    if (desc != null) {
        if (desc.equals(DescType.application.toString())) {
            applicationDescButtonModel.setSelected(true);
        } else if (desc.equals(DescType.applet.toString())) {
            appletDescButtonModel.setSelected(true);
        } else if (desc.equals(DescType.component.toString())) {
            compDescButtonModel.setSelected(true);
        }
    } else {
        applicationDescButtonModel.setSelected(true);
    }

}
项目:cn1    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItemStringIconBoolean() {
    Icon icon = createNewIcon();
    String text = "texttext";
    menuItem = new JRadioButtonMenuItem(text, icon, true);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertTrue(menuItem.isSelected());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
    menuItem = new JRadioButtonMenuItem(text, icon, false);
    assertFalse(menuItem.isSelected());
}
项目:cn1    文件:JCheckBoxMenuItemTest.java   
public void testJCheckBoxMenuItemStringIconBoolean() {
    Icon icon = createNewIcon();
    String text = "texttext";
    menuItem = new JCheckBoxMenuItem(text, icon, true);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertTrue(menuItem.isSelected());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
    menuItem = new JCheckBoxMenuItem(text, icon, false);
    assertFalse(menuItem.isSelected());
}
项目:freeVM    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItemStringIconBoolean() {
    Icon icon = createNewIcon();
    String text = "texttext";
    menuItem = new JRadioButtonMenuItem(text, icon, true);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertTrue(menuItem.isSelected());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
    menuItem = new JRadioButtonMenuItem(text, icon, false);
    assertFalse(menuItem.isSelected());
}
项目:freeVM    文件:JCheckBoxMenuItemTest.java   
public void testJCheckBoxMenuItemStringIconBoolean() {
    Icon icon = createNewIcon();
    String text = "texttext";
    menuItem = new JCheckBoxMenuItem(text, icon, true);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertTrue(menuItem.isSelected());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
    menuItem = new JCheckBoxMenuItem(text, icon, false);
    assertFalse(menuItem.isSelected());
}
项目:freeVM    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItemStringIconBoolean() {
    Icon icon = createNewIcon();
    String text = "texttext";
    menuItem = new JRadioButtonMenuItem(text, icon, true);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertTrue(menuItem.isSelected());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
    menuItem = new JRadioButtonMenuItem(text, icon, false);
    assertFalse(menuItem.isSelected());
}
项目:freeVM    文件:JCheckBoxMenuItemTest.java   
public void testJCheckBoxMenuItemStringIconBoolean() {
    Icon icon = createNewIcon();
    String text = "texttext";
    menuItem = new JCheckBoxMenuItem(text, icon, true);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertTrue(menuItem.isSelected());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
    menuItem = new JCheckBoxMenuItem(text, icon, false);
    assertFalse(menuItem.isSelected());
}
项目:openxal    文件:MachineSimulatorDocument.java   
/** 
   * Primary constructor 
   * @param url The URL of the file to load into the new document.
   */
  public MachineSimulatorDocument( final java.net.URL url ) {
    setSource( url );
    //initialize the buttons
USE_DESIGN = new ToggleButtonModel();
USE_RF_DESIGN = new ToggleButtonModel();
USE_CHANNEL= new ToggleButtonModel();
USE_PVLOGGER = new ToggleButtonModel();
USE_LOGGEDBEND = new ToggleButtonModel();
USE_READ_BACK= new ToggleButtonModel();
USE_SET= new ToggleButtonModel();

WINDOW_REFERENCE = getDefaultWindowReference( "MainWindow", this );

PV_LOG_CHOOSER = new PVLogSnapshotChooser( mainWindow, true );

    // initialize the model here
    MODEL = new MachineModel();
MACHINE_SIMULATOR_CONTROLLER = new MachineSimulatorController( this,WINDOW_REFERENCE );

if ( url != null ) {
          System.out.println( "Opening document: " + url.toString() );
          final DataAdaptor documentAdaptor = XmlDataAdaptor.adaptorForUrl( url, false );
          update( documentAdaptor.childAdaptor( dataLabel() ) );
      }

setHasChanges( false );
  }
项目:openxal    文件:PrefWindow.java   
/**
 * Register actions specific to this window instance. This code demonstrates
 * how to define custom actions for menus and the toolbar for a particular
 * window instance. This method is optional. You may similarly define
 * actions in the document class if those actions are document specific and
 * also for the entire application if the actions are application wide.
 * 
 * @param commander
 *            The commander with which to register the custom commands.
 */
protected void customizeCommands(final Commander commander) {
    // define a toggle "edit" action
    final ToggleButtonModel editModel = new ToggleButtonModel();
    editModel.setSelected(true);
    editModel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            textView.setEditable(editModel.isSelected());
            Logger.getLogger("global").log(Level.INFO,
                    "Toggle whether text is editable.");
            System.out.println("toggled editable...");
        }
    });
    commander.registerModel("toggle-editable", editModel);
}
项目:openxal    文件:EAWindow.java   
/**
 * Register actions specific to this window instance. This code demonstrates
 * how to define custom actions for menus and the toolbar for a particular
 * window instance. This method is optional. You may similarly define
 * actions in the document class if those actions are document specific and
 * also for the entire application if the actions are application wide.
 * 
 * @param commander
 *            The commander with which to register the custom commands.
 */
public void customizeCommands(final Commander commander) {
    // define a toggle "edit" action
    final ToggleButtonModel editModel = new ToggleButtonModel();
    editModel.setSelected(true);
    editModel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            textView.setEditable(editModel.isSelected());
            Logger.getLogger("global").log(Level.INFO,
                    "Toggle whether text is editable.");
            System.out.println("toggled editable...");
        }
    });
    commander.registerModel("toggle-editable", editModel);
}
项目:openxal    文件:MachineSimulatorDocument.java   
/** 
   * Primary constructor 
   * @param url The URL of the file to load into the new document.
   */
  public MachineSimulatorDocument( final java.net.URL url ) {
    setSource( url );
    //initialize the buttons
USE_DESIGN = new ToggleButtonModel();
USE_RF_DESIGN = new ToggleButtonModel();
USE_CHANNEL= new ToggleButtonModel();
USE_PVLOGGER = new ToggleButtonModel();
USE_LOGGEDBEND = new ToggleButtonModel();
USE_READ_BACK= new ToggleButtonModel();
USE_SET= new ToggleButtonModel();

WINDOW_REFERENCE = getDefaultWindowReference( "MainWindow", this );

PV_LOG_CHOOSER = new PVLogSnapshotChooser( mainWindow, true );

    // initialize the model here
    MODEL = new MachineModel();
MACHINE_SIMULATOR_CONTROLLER = new MachineSimulatorController( this,WINDOW_REFERENCE );

if ( url != null ) {
          System.out.println( "Opening document: " + url.toString() );
          final DataAdaptor documentAdaptor = XmlDataAdaptor.adaptorForUrl( url, false );
          update( documentAdaptor.childAdaptor( dataLabel() ) );
      }

setHasChanges( false );
  }
项目:openxal    文件:PrefWindow.java   
/**
 * Register actions specific to this window instance. This code demonstrates
 * how to define custom actions for menus and the toolbar for a particular
 * window instance. This method is optional. You may similarly define
 * actions in the document class if those actions are document specific and
 * also for the entire application if the actions are application wide.
 * 
 * @param commander
 *            The commander with which to register the custom commands.
 */
protected void customizeCommands(final Commander commander) {
    // define a toggle "edit" action
    final ToggleButtonModel editModel = new ToggleButtonModel();
    editModel.setSelected(true);
    editModel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            textView.setEditable(editModel.isSelected());
            Logger.getLogger("global").log(Level.INFO,
                    "Toggle whether text is editable.");
            System.out.println("toggled editable...");
        }
    });
    commander.registerModel("toggle-editable", editModel);
}
项目:openxal    文件:EAWindow.java   
/**
 * Register actions specific to this window instance. This code demonstrates
 * how to define custom actions for menus and the toolbar for a particular
 * window instance. This method is optional. You may similarly define
 * actions in the document class if those actions are document specific and
 * also for the entire application if the actions are application wide.
 * 
 * @param commander
 *            The commander with which to register the custom commands.
 */
public void customizeCommands(final Commander commander) {
    // define a toggle "edit" action
    final ToggleButtonModel editModel = new ToggleButtonModel();
    editModel.setSelected(true);
    editModel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            textView.setEditable(editModel.isSelected());
            Logger.getLogger("global").log(Level.INFO,
                    "Toggle whether text is editable.");
            System.out.println("toggled editable...");
        }
    });
    commander.registerModel("toggle-editable", editModel);
}
项目:jsyn    文件:AudioScopeProbe.java   
public AudioScopeProbe(AudioScopeModel audioScopeModel, UnitOutputPort source, int partIndex) {
    this.audioScopeModel = audioScopeModel;
    this.source = source;
    this.partIndex = partIndex;

    verticalScaleModel = new ExponentialRangeModel("VScale", 1000, MIN_RANGE, MAX_RANGE,
            MIN_RANGE);
    autoScaleButtonModel = new ToggleButtonModel();
    autoScaleButtonModel.setSelected(true);
}
项目:jsyn    文件:ScopeProbePanel.java   
public ScopeProbePanel(AudioScopeProbeView probeView) {
    this.audioScopeProbeView = probeView;
    setLayout(new BorderLayout());

    setBorder(BorderFactory.createLineBorder(Color.GRAY, 3));

    // Add a colored box to match the waveform color.
    JPanel colorPanel = new JPanel();
    colorPanel.setMinimumSize(new Dimension(40, 40));
    audioScopeProbe = probeView.getModel();
    colorPanel.setBackground(audioScopeProbe.getColor());
    add(colorPanel, BorderLayout.NORTH);

    // Knob for tweaking vertical range.
    verticalScaleKnob = new RotaryTextController(audioScopeProbeView.getWaveTraceView()
            .getVerticalRangeModel(), 5);
    add(verticalScaleKnob, BorderLayout.CENTER);
    verticalScaleKnob.setTitle("YScale");

    // Auto ranging checkbox.
    autoBox = new JCheckBox("Auto");
    autoScaleModel = audioScopeProbeView.getWaveTraceView().getAutoButtonModel();
    autoScaleModel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ToggleButtonModel model = (ToggleButtonModel) e.getSource();
            boolean enabled = !model.isSelected();
            System.out.println("Knob enabled = " + enabled);
            verticalScaleKnob.setEnabled(!model.isSelected());
        }
    });
    autoBox.setModel(autoScaleModel);
    add(autoBox, BorderLayout.SOUTH);

    verticalScaleKnob.setEnabled(!autoScaleModel.isSelected());

    setMinimumSize(new Dimension(80, 100));
    setPreferredSize(new Dimension(80, 150));
    setMaximumSize(new Dimension(120, 200));
}
项目:cn1    文件:FormViewComponentFactory.java   
public static Component createInputCheckBoxComponent(final Object model,
                                             final AttributeSet attrs) {
    ToggleButtonModel checkBoxModel = (ToggleButtonModel) model;
    final JCheckBox checkBox = new JCheckBox();

    // Model
    if (checkBoxModel == null) {
        checkBoxModel = new FormToggleButtonModel(new Form(SimpleAttributeSet.EMPTY),
                                                  SimpleAttributeSet.EMPTY);
    }
    checkBox.setModel(checkBoxModel);

    // SIZE
    setButtonSize(checkBox, attrs);

    // TITLE
    setTitle(checkBox, attrs);

    // CHECKED
    setChecked(checkBox, attrs);

    // ACCESSKEY
    setButtonAccessKey(checkBox, attrs);

    // ALIGN
    setButtonAlign(checkBox);

    // DISABLED
    setDisabled(checkBox, attrs);

    return checkBox;
}
项目:cn1    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItem() {
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertNull("icon ", button.getIcon());
    assertEquals("text ", "", button.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:cn1    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItemIcon() {
    Icon icon = createNewIcon();
    menuItem = new JRadioButtonMenuItem(icon);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", "", menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:cn1    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItemString() {
    String text = "texttext";
    menuItem = new JRadioButtonMenuItem(text);
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertNull("icon ", menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:cn1    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItemStringIcon() {
    Icon icon = createNewIcon();
    String text = "texttext";
    menuItem = new JRadioButtonMenuItem(text, icon);
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:cn1    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItemIconBoolean() {
    Icon icon = createNewIcon();
    menuItem = new JRadioButtonMenuItem(icon, true);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", "", menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertTrue(menuItem.isSelected());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
    menuItem = new JRadioButtonMenuItem(icon, false);
    assertFalse(menuItem.isSelected());
}
项目:cn1    文件:JCheckBoxMenuItemTest.java   
public void testJCheckBoxMenuItem() {
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertNull("icon ", button.getIcon());
    assertEquals("text ", "", button.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:cn1    文件:JCheckBoxMenuItemTest.java   
public void testJCheckBoxMenuItemIcon() {
    Icon icon = createNewIcon();
    menuItem = new JCheckBoxMenuItem(icon);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", "", menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:cn1    文件:JCheckBoxMenuItemTest.java   
public void testJCheckBoxMenuItemString() {
    String text = "texttext";
    menuItem = new JCheckBoxMenuItem(text);
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertNull("icon ", menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:cn1    文件:JCheckBoxMenuItemTest.java   
public void testJCheckBoxMenuItemStringIcon() {
    Icon icon = createNewIcon();
    String text = "texttext";
    menuItem = new JCheckBoxMenuItem(text, icon);
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:jsyn    文件:AudioScopeProbe.java   
public AudioScopeProbe(AudioScopeModel audioScopeModel, UnitOutputPort source, int partIndex) {
    this.audioScopeModel = audioScopeModel;
    this.source = source;
    this.partIndex = partIndex;

    verticalScaleModel = new ExponentialRangeModel("VScale", 1000, MIN_RANGE, MAX_RANGE,
            MIN_RANGE);
    autoScaleButtonModel = new ToggleButtonModel();
    autoScaleButtonModel.setSelected(true);
}
项目:jsyn    文件:ScopeProbePanel.java   
public ScopeProbePanel(AudioScopeProbeView probeView) {
    this.audioScopeProbeView = probeView;
    setLayout(new BorderLayout());

    setBorder(BorderFactory.createLineBorder(Color.GRAY, 3));

    // Add a colored box to match the waveform color.
    JPanel colorPanel = new JPanel();
    colorPanel.setMinimumSize(new Dimension(40, 40));
    audioScopeProbe = probeView.getModel();
    colorPanel.setBackground(audioScopeProbe.getColor());
    add(colorPanel, BorderLayout.NORTH);

    // Knob for tweaking vertical range.
    verticalScaleKnob = new RotaryTextController(audioScopeProbeView.getWaveTraceView()
            .getVerticalRangeModel(), 5);
    add(verticalScaleKnob, BorderLayout.CENTER);
    verticalScaleKnob.setTitle("YScale");

    // Auto ranging checkbox.
    autoBox = new JCheckBox("Auto");
    autoScaleModel = audioScopeProbeView.getWaveTraceView().getAutoButtonModel();
    autoScaleModel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ToggleButtonModel model = (ToggleButtonModel) e.getSource();
            boolean enabled = !model.isSelected();
            System.out.println("Knob enabled = " + enabled);
            verticalScaleKnob.setEnabled(!model.isSelected());
        }
    });
    autoBox.setModel(autoScaleModel);
    add(autoBox, BorderLayout.SOUTH);

    verticalScaleKnob.setEnabled(!autoScaleModel.isSelected());

    setMinimumSize(new Dimension(80, 100));
    setPreferredSize(new Dimension(80, 150));
    setMaximumSize(new Dimension(120, 200));
}
项目:freeVM    文件:FormViewComponentFactory.java   
public static Component createInputCheckBoxComponent(final Object model,
                                             final AttributeSet attrs) {
    ToggleButtonModel checkBoxModel = (ToggleButtonModel) model;
    final JCheckBox checkBox = new JCheckBox();

    // Model
    if (checkBoxModel == null) {
        checkBoxModel = new FormToggleButtonModel(new Form(SimpleAttributeSet.EMPTY),
                                                  SimpleAttributeSet.EMPTY);
    }
    checkBox.setModel(checkBoxModel);

    // SIZE
    setButtonSize(checkBox, attrs);

    // TITLE
    setTitle(checkBox, attrs);

    // CHECKED
    setChecked(checkBox, attrs);

    // ACCESSKEY
    setButtonAccessKey(checkBox, attrs);

    // ALIGN
    setButtonAlign(checkBox);

    // DISABLED
    setDisabled(checkBox, attrs);

    return checkBox;
}
项目:freeVM    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItem() {
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertNull("icon ", button.getIcon());
    assertEquals("text ", "", button.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:freeVM    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItemIcon() {
    Icon icon = createNewIcon();
    menuItem = new JRadioButtonMenuItem(icon);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", "", menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:freeVM    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItemString() {
    String text = "texttext";
    menuItem = new JRadioButtonMenuItem(text);
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertNull("icon ", menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:freeVM    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItemStringIcon() {
    Icon icon = createNewIcon();
    String text = "texttext";
    menuItem = new JRadioButtonMenuItem(text, icon);
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:freeVM    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItemIconBoolean() {
    Icon icon = createNewIcon();
    menuItem = new JRadioButtonMenuItem(icon, true);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", "", menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertTrue(menuItem.isSelected());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
    menuItem = new JRadioButtonMenuItem(icon, false);
    assertFalse(menuItem.isSelected());
}
项目:freeVM    文件:JCheckBoxMenuItemTest.java   
public void testJCheckBoxMenuItem() {
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertNull("icon ", button.getIcon());
    assertEquals("text ", "", button.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:freeVM    文件:JCheckBoxMenuItemTest.java   
public void testJCheckBoxMenuItemIcon() {
    Icon icon = createNewIcon();
    menuItem = new JCheckBoxMenuItem(icon);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", "", menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:freeVM    文件:JCheckBoxMenuItemTest.java   
public void testJCheckBoxMenuItemString() {
    String text = "texttext";
    menuItem = new JCheckBoxMenuItem(text);
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertNull("icon ", menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:freeVM    文件:JCheckBoxMenuItemTest.java   
public void testJCheckBoxMenuItemStringIcon() {
    Icon icon = createNewIcon();
    String text = "texttext";
    menuItem = new JCheckBoxMenuItem(text, icon);
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", text, menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:freeVM    文件:FormViewComponentFactory.java   
public static Component createInputCheckBoxComponent(final Object model,
                                             final AttributeSet attrs) {
    ToggleButtonModel checkBoxModel = (ToggleButtonModel) model;
    final JCheckBox checkBox = new JCheckBox();

    // Model
    if (checkBoxModel == null) {
        checkBoxModel = new FormToggleButtonModel(new Form(SimpleAttributeSet.EMPTY),
                                                  SimpleAttributeSet.EMPTY);
    }
    checkBox.setModel(checkBoxModel);

    // SIZE
    setButtonSize(checkBox, attrs);

    // TITLE
    setTitle(checkBox, attrs);

    // CHECKED
    setChecked(checkBox, attrs);

    // ACCESSKEY
    setButtonAccessKey(checkBox, attrs);

    // ALIGN
    setButtonAlign(checkBox);

    // DISABLED
    setDisabled(checkBox, attrs);

    return checkBox;
}
项目:freeVM    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItem() {
    assertFalse(menuItem.isSelected());
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertNull("icon ", button.getIcon());
    assertEquals("text ", "", button.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}
项目:freeVM    文件:JRadioButtonMenuItemTest.java   
public void testJRadioButtonMenuItemIcon() {
    Icon icon = createNewIcon();
    menuItem = new JRadioButtonMenuItem(icon);
    assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
    assertEquals("icon ", icon, menuItem.getIcon());
    assertEquals("text ", "", menuItem.getText());
    assertFalse("default FocusPainted", menuItem.isFocusPainted());
    assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
    assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
    assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
    assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
}