本文整理汇总了Java中java.awt.Button.setActionCommand方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setActionCommand方法的具体用法?Java Button.setActionCommand怎么用?Java Button.setActionCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Button
的用法示例。
在下文中一共展示了Button.setActionCommand方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TestDialog
import java.awt.Button; //导入方法依赖的package包/类
public TestDialog(Frame frame, String name) {
super(frame, name);
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
add("North", instructionsText);
messageText = new TextArea("", 5, maxStringLength, scrollBoth);
add("Center", messageText);
passB = new Button("pass");
passB.setActionCommand("pass");
passB.addActionListener(this);
buttonP.add("East", passB);
failB = new Button("fail");
failB.setActionCommand("fail");
failB.addActionListener(this);
buttonP.add("West", failB);
add("South", buttonP);
pack();
show();
}
示例2: TestDialog
import java.awt.Button; //导入方法依赖的package包/类
public TestDialog( Frame frame, String name )
{
super( frame, name );
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
add( "North", instructionsText );
messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
add("Center", messageText);
passB = new Button( "pass" );
passB.setActionCommand( "pass" );
passB.addActionListener( this );
buttonP.add( "East", passB );
failB = new Button( "fail" );
failB.setActionCommand( "fail" );
failB.addActionListener( this );
buttonP.add( "West", failB );
add( "South", buttonP );
pack();
setVisible(true);
}
示例3: TestDialog
import java.awt.Button; //导入方法依赖的package包/类
public TestDialog(Frame frame, String name) {
super(frame, name);
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
add("North", instructionsText);
messageText = new TextArea("", 5, maxStringLength, scrollBoth);
add("Center", messageText);
buttonP = new Panel();
passB = new Button("pass");
passB.setActionCommand("pass");
passB.addActionListener(this);
buttonP.add("East", passB);
failB = new Button("Fail");
failB.setActionCommand("fail");
failB.addActionListener(this);
buttonP.add("West", failB);
add("South", buttonP);
pack();
setVisible(true);
}
示例4: TestDialog
import java.awt.Button; //导入方法依赖的package包/类
public TestDialog(Frame frame, String name) {
super(frame, name);
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
add("North", instructionsText);
messageText = new TextArea("", 5, maxStringLength, scrollBoth);
add("Center", messageText);
buttonP = new Panel();
failB = new Button("Fail");
failB.setActionCommand("fail");
failB.addActionListener(this);
buttonP.add("Center", failB);
add("South", buttonP);
pack();
setVisible(true);
}
示例5: TestDialog
import java.awt.Button; //导入方法依赖的package包/类
public TestDialog( Frame frame, String name )
{
super( frame, name );
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
add( "North", instructionsText );
messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
add("Center", messageText);
passB = new Button( "pass" );
passB.setActionCommand( "pass" );
passB.addActionListener( this );
buttonP.add( "East", passB );
failB = new Button( "fail" );
failB.setActionCommand( "fail" );
failB.addActionListener( this );
buttonP.add( "West", failB );
add( "South", buttonP );
pack();
show();
}
示例6: frameTest
import java.awt.Button; //导入方法依赖的package包/类
private static void frameTest() {
Panel panel =new Panel();
print = new Button("PageDialog");
print.setActionCommand("PageDialog");
print.addActionListener((e) -> {
PrinterJob job = PrinterJob.getPrinterJob();
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
t.start();
start = true;
PageFormat pf = job.pageDialog(aset);
});
panel.add(print);
frame = new Frame("Test Frame");
frame.setLayout (new BorderLayout ());
frame.add(panel,"South");
frame.pack();
frame.setVisible(true);
t = new Thread (() -> {
if (start) {
try {
Thread.sleep(5000);
} catch (InterruptedException ex) {}
frame.dispose();
}
});
}
示例7: frameTest
import java.awt.Button; //导入方法依赖的package包/类
private static void frameTest() {
Panel panel =new Panel();
print = new Button("PrintDialog");
print.setActionCommand("PrintDialog");
print.addActionListener((e) -> {
PrinterJob job = PrinterJob.getPrinterJob();
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
t.start();
start = true;
job.printDialog(aset);
});
panel.add(print);
frame = new Frame("Test Frame");
frame.setLayout (new BorderLayout ());
frame.add(panel,"South");
frame.pack();
frame.setVisible(true);
t = new Thread (() -> {
if (start) {
try {
Thread.sleep(5000);
} catch (InterruptedException ex) {}
frame.dispose();
}
});
}
示例8: TestDialog
import java.awt.Button; //导入方法依赖的package包/类
public TestDialog(Frame frame, String name) {
super(frame, name);
int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
add("North", instructionsText);
messageText = new TextArea("", 5, maxStringLength, scrollBoth);
add("Center", messageText);
buttonP = new Panel();
failB = new Button("Fail");
failB.setActionCommand("fail");
failB.addActionListener(this);
passB = new Button("Pass");
buttonP.add(passB);
buttonP.add(failB);
passB.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
DisabledUndoTest.pass();
}
});
add("South", buttonP);
pack();
setVisible(true);
}