Java Code Examples for java.awt.TextArea#setEnabled()

The following examples show how to use java.awt.TextArea#setEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UpdatePopupMenu.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void createInstructionUI() {
    mainFrame = new Frame("Updating TrayIcon Popup Menu Item Test");
    layout = new GridBagLayout();
    mainControlPanel = new Panel(layout);
    resultButtonPanel = new Panel(layout);

    GridBagConstraints gbc = new GridBagConstraints();
    String instructions
            = "INSTRUCTIONS:"
            + "\n   1. Click on the System Tray Icon"
            + "\n   2. Click on any of the displayed Menu items"
            + "\n   3. Repeat step 1 and count the number of items in the "
            + "Menu"
            + "\n   4. The number of items in the Menu should increase by 1"
            + "\n   5. Repeating steps 1, 2 and 3 should not break 4th step"
            + "\n   6. Click Fail if the 4th step is broken, Otherwise "
            + "click Pass ";

    instructionTextArea = new TextArea();
    instructionTextArea.setText(instructions);
    instructionTextArea.setEnabled(false);
    instructionTextArea.setBackground(Color.white);

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainControlPanel.add(instructionTextArea, gbc);

    passButton = new Button("Pass");
    passButton.setName("Pass");
    passButton.addActionListener(this);

    failButton = new Button("Fail");
    failButton.setName("Fail");
    failButton.addActionListener(this);

    gbc.gridx = 0;
    gbc.gridy = 0;
    resultButtonPanel.add(passButton, gbc);
    gbc.gridx = 1;
    gbc.gridy = 0;
    resultButtonPanel.add(failButton, gbc);
    gbc.gridx = 0;
    gbc.gridy = 1;
    mainControlPanel.add(resultButtonPanel, gbc);

    mainFrame.add(mainControlPanel);
    mainFrame.pack();
    mainFrame.setVisible(true);
}
 
Example 2
Source File: RestoreActiveWindowTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void createInstructionUI() {
    instructionFrame = new Frame("Native Print Dialog and Page Dialog");
    layout = new GridBagLayout();
    mainControlPanel = new Panel(layout);
    resultButtonPanel = new Panel(layout);

    GridBagConstraints gbc = new GridBagConstraints();
    String instructions
            = "\nINSTRUCTIONS:\n"
            + "\n   1. Click on the 'show a native print dialog' button. A "
            + "native print dialog will come up."
            + "\n   2. Click on the 'Cancel' button on Mac OS X or "
            + "'close'(X) on other paltforms. Dialog will be closed."
            + "\n   3. After the dialog is closed another window should "
            + "become the active window."
            + "\n   4. If there no any active window then the test has "
            + "failed. Click on 'Fail' Button."
            + "\n   5. Click on the 'show a native page dialog' button. A "
            + "native page dialog will come up."
            + "\n   6. Click on the 'Cancel' button on Mac OS X or "
            + "'close'(X) on other paltforms. Dialog will be closed."
            + "\n   7. After the dialog is closed another window should "
            + "become the active window."
            + "\n   8. If there no any active window then the test has "
            + "failed. Click on 'Fail' Button."
            + "\n   9. Test Passed. Click on 'Pass' Button.";

    instructionTextArea = new TextArea(13, 80);
    instructionTextArea.setText(instructions);
    instructionTextArea.setEnabled(false);
    instructionTextArea.setBackground(Color.white);

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 0.5;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainControlPanel.add(instructionTextArea, gbc);

    passButton = new Button("Pass");
    passButton.setName("Pass");
    passButton.addActionListener((ActionListener) this);

    failButton = new Button("Fail");
    failButton.setName("Fail");
    failButton.addActionListener((ActionListener) this);

    setButtonEnable(false);

    gbc.gridx = 0;
    gbc.gridy = 0;
    resultButtonPanel.add(passButton, gbc);
    gbc.gridx = 1;
    gbc.gridy = 0;
    resultButtonPanel.add(failButton, gbc);
    gbc.gridx = 0;
    gbc.gridy = 1;
    mainControlPanel.add(resultButtonPanel, gbc);

    instructionFrame.add(mainControlPanel);
    instructionFrame.pack();
    instructionFrame.setVisible(true);
}
 
Example 3
Source File: DragLinkFromBrowser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void createInstructionUI() {
    mainFrame = new Frame("Drag and drop link from web browser");
    layout = new GridBagLayout();
    mainControlPanel = new Panel(layout);
    resultButtonPanel = new Panel(layout);

    GridBagConstraints gbc = new GridBagConstraints();
    String instructions
            = "INSTRUCTIONS:"
            + "\n   1. Open any browser."
            + "\n   2. Select and drag URL from the browser page and "
            + "drop it on the panel"
            + "\n   3. If test fails, then a popup message will be displayed,"
            + " click Ok and \n       click Fail button."
            + "\n   5. Otherwise test passed. Click Pass button.";

    instructionTextArea = new TextArea();
    instructionTextArea.setText(instructions);
    instructionTextArea.setEnabled(false);
    instructionTextArea.setBackground(Color.white);

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainControlPanel.add(instructionTextArea, gbc);

    passButton = new Button("Pass");
    passButton.setName("Pass");
    passButton.addActionListener(this);

    failButton = new Button("Fail");
    failButton.setName("Fail");
    failButton.addActionListener(this);

    gbc.gridx = 0;
    gbc.gridy = 0;
    resultButtonPanel.add(passButton, gbc);
    gbc.gridx = 1;
    gbc.gridy = 0;
    resultButtonPanel.add(failButton, gbc);
    gbc.gridx = 0;
    gbc.gridy = 1;
    mainControlPanel.add(resultButtonPanel, gbc);

    mainFrame.add(mainControlPanel);
    mainFrame.pack();
    mainFrame.setVisible(true);
}