项目: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);
}
}
public void testJRadioButtonMenuItemStringIconBoolean() {
Icon icon = createNewIcon();
String text = "texttext";
menuItem = new JRadioButtonMenuItem(text,icon,true);
assertTrue("default buttonModel ",button.getModel() instanceof ToggleButtonModel);
assertEquals("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,false);
assertFalse(menuItem.isSelected());
}
/**
* 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,editModel);
}
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);
}
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;
}
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.getVerticalTextPosition());
}
public void testJCheckBoxMenuItem() {
assertFalse(menuItem.isSelected());
assertTrue("default buttonModel ",button.getVerticalTextPosition());
}
项目:freeVM
文件:FormViewComponentFactory.java
public void testJRadioButtonMenuItem() {
assertFalse(menuItem.isSelected());
assertTrue("default buttonModel ",button.getVerticalTextPosition());
}
public void testJCheckBoxMenuItem() {
assertFalse(menuItem.isSelected());
assertTrue("default buttonModel ",button.getVerticalTextPosition());
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。