Package java.awt

Examples of java.awt.TextArea$AccessibleAWTTextArea


 
  public void test1(TestHarness harness)
  {
    // Test getPreferredSize() method.
   
    TextArea area = new TextArea();
    harness.check(area.getSize(), new Dimension());
    harness.check(area.getPreferredSize(), new Dimension());
   
    // Check that if preferred size has not been set, then a
    // Dimension with current number of rows and columns
    // is returned.
    harness.check(area.isPreferredSizeSet(), false);
    area.setSize(new Dimension(4, 8));
    harness.check(area.getPreferredSize(), new Dimension(4, 8));
       
    // Check that if preferred size has been set,
    // then those values are returned.
    Dimension prefSize = new Dimension(5, 16);
    area.setPreferredSize(prefSize);
    harness.check(area.isPreferredSizeSet());
    harness.check(area.getPreferredSize() != prefSize);
    harness.check(area.getPreferredSize(), prefSize);
  }
View Full Code Here


 
  public void test2(TestHarness harness)
  {
    // Test getPreferredSize(int, int) method.
   
    TextArea area = new TextArea();
   
    // Show that if the values passed are <=, ==, >= or negative,
    // then no exceptions are thrown.
    harness.check(area.getSize(), new Dimension());
    harness.check(area.getPreferredSize(6, 7), new Dimension());
    harness.check(area.getPreferredSize(0, 0), new Dimension());
    harness.check(area.getPreferredSize(-4, -7), new Dimension());
       
    // Check that if preferred size not been set, then a
    // Dimension with size (width, height) is returned.
    harness.check(area.isPreferredSizeSet(), false);
    area.setSize(new Dimension(3, 4));
    harness.check(area.getPreferredSize(3, 2), new Dimension(3, 4));
   
    // Check that if preferred size has been set, then a
    // those values are returned.
    area.setSize(new Dimension(-3, 5));
    harness.check(area.getSize(), new Dimension(-3, 5));
    area.setPreferredSize(new Dimension(1, 9));
    harness.check(area.isPreferredSizeSet());
    harness.check(area.getPreferredSize(-1, 1), new Dimension(1, 9));
  }
View Full Code Here

  {
    // This test will show that if peer == null, then the getWidth()
    // and getHeight() values are used (and not getRows() and getColumns()
    // or 0 and 0).
   
    TextArea area = new TextArea();
    area.setBounds(1, 2, 3, 4);
    harness.check(area.getX(), 1);
    harness.check(area.getY(), 2);
    harness.check(area.getWidth(), 3);
    harness.check(area.getHeight(), 4);
    harness.check(area.getRows(), 0);
    harness.check(area.getColumns(), 0);
   
    harness.check(area.getPeer() == null);
    harness.check(area.getPreferredSize(),
                  new Dimension(area.getWidth(), area.getHeight()));
  }
View Full Code Here

  public void test4(TestHarness harness)
  {
    // This test shows that the text area's font does not
    // affect the value of its preferred size.
   
    TextArea area = new TextArea();
   
    area.setFont(new Font("Dialog-PLAIN-12", Font.ITALIC, 58));
    harness.check(area.getPreferredSize(), new Dimension());
    area.setFont(new Font("TimesRoman", Font.BOLD, 2));
    harness.check(area.getPreferredSize(), new Dimension());
  }
View Full Code Here

  public void test5(TestHarness harness)
  {
    // This test shows that the text area's minimum size
    // does not affect the value of its preferred size.
   
    TextArea area = new TextArea();
   
    area.setMinimumSize(new Dimension(7, 3));
    harness.check(area.isMinimumSizeSet());
    harness.check(area.getMinimumSize(), new Dimension(7, 3));
    area.setMinimumSize(new Dimension());
    harness.check(area.getMinimumSize(), new Dimension());
    area.setMinimumSize(new Dimension(-3, -6));
    harness.check(area.getMinimumSize(), new Dimension(-3, -6));
  }
View Full Code Here

public class testReplaceText implements Testlet
{

  public void test(TestHarness harness)
  {
    TextArea a = new TextArea("Goodbye World");
   
    // Replace at the beginning of text.
    harness.check(a.getPeer(), null);
    a.replaceText("Hello", 0, 7);
    harness.check(a.getText(), "Hello World");
   
    // Replace in the middle of text.
    harness.check(a.getPeer(), null);
    a.replaceText(" There", 5, 5);
    harness.check(a.getText(), "Hello There World");
   
    // Replace in the middle of text.
    harness.check(a.getPeer(), null);
    a.replaceText("", 6, 12);
    harness.check(a.getText(), "Hello World");
   
    // Replace at the end of text.
    harness.check(a.getPeer(), null);
    a.replaceText("!", a.getText().length(), a.getText().length());
    harness.check(a.getText(), "Hello World!");
  }
View Full Code Here

        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");
View Full Code Here

            // get rid of phase tab
            tabs.remove(vTextArea.elementAt(vTextArea.size() - 1));
            vTextArea.removeElementAt(vTextArea.size() - 1);

            // add as many round tabs as necessary to catch us up
            TextArea ta;
            while (round > vTextArea.size()) {
                // HACK: We shouldn't have to rely on our access to the client
                // object...
                ta = new TextArea(client.receiveReport(client.game
                        .getReports(vTextArea.size() + 1)), 40, 25,
                        TextArea.SCROLLBARS_VERTICAL_ONLY);
                ta.setEditable(false);
                tabs.add("Round " + (vTextArea.size() + 1), ta);
                vTextArea.addElement(ta);
            }

            // add the new current phase tab
            ta = new TextArea(phaseText, 40, 25,
                    TextArea.SCROLLBARS_VERTICAL_ONLY);
            ta.setEditable(false);
            tabs.add("Phase", ta);
            vTextArea.addElement(ta);
            tabs.last();
        } else {
            // Update the previous rounds tab and the phase tab.
View Full Code Here

         * HACK: Without this initial empty TextArea, the tabs will be blank (no
         * TextArea at all) during the first initiative phase. I think it has
         * something to do with the layout manager, but I'm not really sure.
         * Maybe a strategically placed validate() would be better?
         */
        TextArea ta = new TextArea("", 40, 25,
                TextArea.SCROLLBARS_VERTICAL_ONLY);
        ta.setEditable(false);
        vTextArea.addElement(ta);
        tabs.add("Phase", ta);
    }
View Full Code Here

            return;
        }
        Entity entity = client.game.getEntity(entityCorrespondance[lisEntities
                .getSelectedIndex()]);
        MechView mechView = new MechView(entity, client.game.getOptions().booleanOption("show_bay_detail"));
        TextArea ta = new TextArea();
        ta.setEditable(false);
        ta.setFont(new Font("Monospaced", Font.PLAIN, 12)); //$NON-NLS-1$
        ta.setText(mechView.getMechReadout());
        final Dialog dialog = new Dialog(clientgui.frame, Messages
                .getString("ChatLounge.quickView"), false); //$NON-NLS-1$
        Button btn = new Button(Messages.getString("Okay")); //$NON-NLS-1$
        dialog.add("South", btn); //$NON-NLS-1$
        btn.addActionListener(new java.awt.event.ActionListener() {
View Full Code Here

TOP

Related Classes of java.awt.TextArea$AccessibleAWTTextArea

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.