当前位置: 首页>>代码示例>>Java>>正文


Java Button.setActionCommand方法代码示例

本文整理汇总了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();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:HighResTest.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:DragEventSource.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:ScrollSelectionTest.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:AltGraphModifierTest.java

示例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();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:Test6991580.java

示例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();
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:TestPageDlgFrameAssociation.java

示例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();
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:TestPrintDlgFrameAssociation.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:DisabledUndoTest.java


注:本文中的java.awt.Button.setActionCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。