當前位置: 首頁>>代碼示例>>Java>>正文


Java TextArea.addKeyListener方法代碼示例

本文整理匯總了Java中java.awt.TextArea.addKeyListener方法的典型用法代碼示例。如果您正苦於以下問題:Java TextArea.addKeyListener方法的具體用法?Java TextArea.addKeyListener怎麽用?Java TextArea.addKeyListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.TextArea的用法示例。


在下文中一共展示了TextArea.addKeyListener方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initGUI

import java.awt.TextArea; //導入方法依賴的package包/類
private void initGUI() {

        Panel pQuery   = new Panel();
        Panel pCommand = new Panel();

        pResult = new Panel();

        pQuery.setLayout(new BorderLayout());
        pCommand.setLayout(new BorderLayout());
        pResult.setLayout(new BorderLayout());

        Font fFont = new Font("Dialog", Font.PLAIN, 12);

        txtCommand = new TextArea(5, 40);

        txtCommand.addKeyListener(this);

        txtResult = new TextArea(20, 40);

        txtCommand.setFont(fFont);
        txtResult.setFont(new Font("Courier", Font.PLAIN, 12));

        butExecute = new Button("Execute");
        butClear   = new Button("Clear");

        butExecute.addActionListener(this);
        butClear.addActionListener(this);
        pCommand.add("East", butExecute);
        pCommand.add("West", butClear);
        pCommand.add("Center", txtCommand);

        gResult = new Grid();

        setLayout(new BorderLayout());
        pResult.add("Center", gResult);
        pQuery.add("North", pCommand);
        pQuery.add("Center", pResult);
        fMain.add("Center", pQuery);

        tTree = new Tree();

        // (ulrivo): screen with less than 640 width
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

        if (d.width >= 640) {
            tTree.setMinimumSize(new Dimension(200, 100));
        } else {
            tTree.setMinimumSize(new Dimension(80, 100));
        }

        gResult.setMinimumSize(new Dimension(200, 300));
        fMain.add("West", tTree);
        doLayout();
        fMain.pack();
    }
 
開發者ID:tiweGH,項目名稱:OpenDiabetes,代碼行數:56,代碼來源:DatabaseManager.java

示例2: initGUI

import java.awt.TextArea; //導入方法依賴的package包/類
/**
 * Method declaration
 *
 */
private void initGUI() {

    Panel pQuery   = new Panel();
    Panel pCommand = new Panel();

    // define a Panel pCard which takes four different cards/views:
    // tree of tables, command SQL text area, result window and an editor/input form
    pCard      = new Panel();
    layoutCard = new CardLayout(2, 2);

    pCard.setLayout(layoutCard);

    // four buttons at the top to quickly switch between the four views
    butTree    = new Button("Tree");
    butCommand = new Button("Command");
    butResult  = new Button("Result");
    butEditor  = new Button("Editor");

    butTree.addActionListener(this);
    butCommand.addActionListener(this);
    butResult.addActionListener(this);
    butEditor.addActionListener(this);

    Panel pButtons = new Panel();

    pButtons.setLayout(new GridLayout(1, 4, 8, 8));
    pButtons.add(butTree);
    pButtons.add(butCommand);
    pButtons.add(butResult);
    pButtons.add(butEditor);

    pResult = new Panel();

    pQuery.setLayout(new BorderLayout());
    pCommand.setLayout(new BorderLayout());
    pResult.setLayout(new BorderLayout());

    Font fFont = new Font("Dialog", Font.PLAIN, 12);

    txtCommand = new TextArea(5, 40);

    txtCommand.addKeyListener(this);

    txtResult = new TextArea(20, 40);

    txtCommand.setFont(fFont);
    txtResult.setFont(new Font("Courier", Font.PLAIN, 12));

    butExecute = new Button("Execute");

    butExecute.addActionListener(this);
    pCommand.add("South", butExecute);
    pCommand.add("Center", txtCommand);

    gResult = new Grid();

    setLayout(new BorderLayout());
    pResult.add("Center", gResult);

    tTree = new Tree();

    tTree.setMinimumSize(new Dimension(200, 100));
    gResult.setMinimumSize(new Dimension(200, 300));

    eEditor = new ZaurusEditor();

    pCard.add("tree", tTree);
    pCard.add("command", pCommand);
    pCard.add("result", pResult);
    pCard.add("editor", eEditor);
    fMain.add("Center", pCard);
    fMain.add("North", pButtons);
    doLayout();
    fMain.pack();
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:80,代碼來源:ZaurusDatabaseManager.java

示例3: initGUI

import java.awt.TextArea; //導入方法依賴的package包/類
/**
 * Method declaration
 *
 */
private void initGUI() {

    Panel pQuery   = new Panel();
    Panel pCommand = new Panel();

    pResult = new Panel();

    pQuery.setLayout(new BorderLayout());
    pCommand.setLayout(new BorderLayout());
    pResult.setLayout(new BorderLayout());

    Font fFont = new Font("Dialog", Font.PLAIN, 12);

    txtCommand = new TextArea(5, 40);

    txtCommand.addKeyListener(this);

    txtResult = new TextArea(20, 40);

    txtCommand.setFont(fFont);
    txtResult.setFont(new Font("Courier", Font.PLAIN, 12));

    butExecute = new Button("Execute");
    butClear   = new Button("Clear");

    butExecute.addActionListener(this);
    butClear.addActionListener(this);
    pCommand.add("East", butExecute);
    pCommand.add("West", butClear);
    pCommand.add("Center", txtCommand);

    gResult = new Grid();

    setLayout(new BorderLayout());
    pResult.add("Center", gResult);
    pQuery.add("North", pCommand);
    pQuery.add("Center", pResult);
    fMain.add("Center", pQuery);

    tTree = new Tree();

    // (ulrivo): screen with less than 640 width
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

    if (d.width >= 640) {
        tTree.setMinimumSize(new Dimension(200, 100));
    } else {
        tTree.setMinimumSize(new Dimension(80, 100));
    }

    gResult.setMinimumSize(new Dimension(200, 300));
    fMain.add("West", tTree);
    doLayout();
    fMain.pack();
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:60,代碼來源:DatabaseManager.java

示例4: createGUI

import java.awt.TextArea; //導入方法依賴的package包/類
public void createGUI() {

        frame = new Frame();
        frame.setTitle("ExtendedModifiersTest");
        frame.setLayout(new GridLayout(1, 6));

        button = new Button();
        button.addKeyListener(this);
        frame.add(button);

        buttonLW = new LWButton();
        buttonLW.addKeyListener(this);
        frame.add(buttonLW);

        textField = new TextField(5);
        textField.addKeyListener(this);
        frame.add(textField);

        textArea = new TextArea(5, 5);
        textArea.addKeyListener(this);
        frame.add(textArea);

        list = new List();
        for (int i = 1; i <= 5; ++i) {
            list.add("item " + i);
        }
        list.addKeyListener(this);
        frame.add(list);

        listLW = new LWList();
        for (int i = 1; i <= 5; ++i) {
            listLW.add("item " + i);
        }
        listLW.addKeyListener(this);
        frame.add(listLW);

        frame.setBackground(Color.gray);
        frame.setSize(500, 100);
        frame.setVisible(true);
        frame.toFront();
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:42,代碼來源:ExtendedModifiersTest.java


注:本文中的java.awt.TextArea.addKeyListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。