當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。