Package java.awt

Examples of java.awt.TextArea$TextScrollable


  }

  public void testConstructor5(TestHarness harness)
  {
    harness.checkPoint("(String, int, int, int)");
    TextArea ta = new TextArea("ABC", 3, 7, TextArea.SCROLLBARS_VERTICAL_ONLY);
    harness.check(ta.getText(), "ABC");
    harness.check(ta.isEditable());
    harness.check(ta.getRows(), 3);
    harness.check(ta.getColumns(), 7);
    harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_VERTICAL_ONLY);
   
    // try null
    ta = new TextArea(null, 3, 7, TextArea.SCROLLBARS_VERTICAL_ONLY);
    harness.check(ta.getText(), "");
    harness.check(ta.isEditable());
    harness.check(ta.getRows(), 3);
    harness.check(ta.getColumns(), 7);
    harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_VERTICAL_ONLY);
   
    // try negative rows
    ta = new TextArea("ABC", -3, 7, TextArea.SCROLLBARS_VERTICAL_ONLY);
    harness.check(ta.getText(), "ABC");
    harness.check(ta.isEditable());
    harness.check(ta.getRows(), 0);
    harness.check(ta.getColumns(), 7);
    harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_VERTICAL_ONLY);

    // try negative columns
    ta = new TextArea("ABC", 3, -7, TextArea.SCROLLBARS_VERTICAL_ONLY);
    harness.check(ta.getText(), "ABC");
    harness.check(ta.isEditable());
    harness.check(ta.getRows(), 3);
    harness.check(ta.getColumns(), 0);
    harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_VERTICAL_ONLY);

    // try bad scroll bar visibility
    ta = new TextArea("ABC", 3, -7, 999);
    harness.check(ta.getText(), "ABC");
    harness.check(ta.isEditable());
    harness.check(ta.getRows(), 3);
    harness.check(ta.getColumns(), 0);
    harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_BOTH);
  }
View Full Code Here


    implements Testlet
{

  public void test(TestHarness harness)
  {
    TextArea a = new TextArea("Hello");
    // Append to the end of text.
    harness.check(a.getPeer(), null);
    a.appendText(" World!");
    harness.check(a.getText(), "Hello World!");
  }
View Full Code Here

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)
  {
    TextArea a = new TextArea(1, 1);
    harness.check(a.getRows(), 1);
    harness.check(a.getColumns(), 1);

    TextArea b = new TextArea(0, 0);
    harness.check(b.getRows(), 0);
    harness.check(b.getColumns(), 0);

    TextArea c = new TextArea(- 1, - 1);
    harness.check(c.getRows(), 0);
    harness.check(c.getColumns(), 0);

    TextArea d = new TextArea("", 1, 1, - 1);
    harness.check(d.getScrollbarVisibility(), d.SCROLLBARS_BOTH);

    TextArea e = new TextArea("", 1, 1, 0);
    harness.check(e.getScrollbarVisibility(), e.SCROLLBARS_BOTH);
   
    TextArea f = new TextArea("", 1, 1, 1);
    harness.check(f.getScrollbarVisibility(), f.SCROLLBARS_VERTICAL_ONLY);
   
    TextArea g = new TextArea("", 1, 1, 2);
    harness.check(g.getScrollbarVisibility(), g.SCROLLBARS_HORIZONTAL_ONLY);
   
    TextArea h = new TextArea("", 1, 1, 3);
    harness.check(h.getScrollbarVisibility(), h.SCROLLBARS_NONE);
   
    TextArea i = new TextArea("", 1, 1, 10);
    harness.check(i.getScrollbarVisibility(), i.SCROLLBARS_BOTH);

    TextArea j = new TextArea(null);
    harness.check(j.getText(), "");
  }
View Full Code Here

   */
  public void test(TestHarness harness)
  {
    setBackground(Color.red);
    Frame f = new Frame();
    TextArea c = new TextArea("", 2, 20, TextArea.SCROLLBARS_VERTICAL_ONLY);
    add(c);
    f.add(this);
    f.pack();
    f.show();
    Rectangle bounds = c.getBounds();
    Insets i = f.getInsets();
    Point loc = f.getLocationOnScreen();
    loc.x += i.left + bounds.x;
    loc.y += i.top + bounds.y;
   
View Full Code Here

public class testInsertText implements Testlet
{

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

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

 
  public void test2(TestHarness harness)
  {
    // Test getMinimumSize(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.getMinimumSize(6, 7), new Dimension());
    harness.check(area.getMinimumSize(0, 0), new Dimension());
    harness.check(area.getMinimumSize(-4, -7), new Dimension());
       
    // Check that if minimum size not been set, then a
    // Dimension with size (width, height) is returned.
    harness.check(area.isMinimumSizeSet(), false);
    area.setSize(new Dimension(3, 4));
    harness.check(area.getMinimumSize(3, 2), new Dimension(3, 4));
   
    // Check that if minimum 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.setMinimumSize(new Dimension(1, 9));
    harness.check(area.isMinimumSizeSet());
    harness.check(area.getMinimumSize(-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.getMinimumSize(),
                  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 minimum size.
   
    TextArea area = new TextArea();
   
    area.setFont(new Font("Dialog-PLAIN-12", Font.ITALIC, 58));
    harness.check(area.getMinimumSize(), new Dimension());
    area.setFont(new Font("TimesRoman", Font.BOLD, 2));
    harness.check(area.getMinimumSize(), new Dimension());
  }
View Full Code Here

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

TOP

Related Classes of java.awt.TextArea$TextScrollable

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.