java.awt.TextArea Java Examples

The following examples show how to use java.awt.TextArea. 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: LWTextAreaPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void setScrollBarVisibility(final int visibility) {
    final ScrollableJTextArea pane = getDelegate();
    final JTextArea view = pane.getView();
    view.setLineWrap(false);

    switch (visibility) {
        case TextArea.SCROLLBARS_NONE:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            view.setLineWrap(true);
            break;
        case TextArea.SCROLLBARS_VERTICAL_ONLY:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            view.setLineWrap(true);
            break;
        case TextArea.SCROLLBARS_HORIZONTAL_ONLY:
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            break;
        default:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            break;
    }
}
 
Example #2
Source File: SelectionVisible.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void init() {
    ta = new TextArea(4, 20);
    ta.setText("01234\n56789");
    ta.select(3, 9);

    final TextArea instruction = new TextArea("INSTRUCTIONS:\n"
                                             + "The text 34567 should be selected in the TextArea.\n"
                                             + "If this is what you observe, then the test passes.\n"
                                             + "Otherwise, the test fails.", 40, 5,
                                     TextArea.SCROLLBARS_NONE);
    instruction.setEditable(false);
    instruction.setPreferredSize(new Dimension(300, 70));
    final Panel panel = new Panel();
    panel.setLayout(new FlowLayout());
    panel.add(ta);
    setLayout(new BorderLayout());
    add(instruction, BorderLayout.CENTER);
    add(panel, BorderLayout.PAGE_END);
}
 
Example #3
Source File: SelectionVisible.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void init() {
    ta = new TextArea(4, 20);
    ta.setText("01234\n56789");
    ta.select(3, 9);

    final TextArea instruction = new TextArea("INSTRUCTIONS:\n"
                                             + "The text 34567 should be selected in the TextArea.\n"
                                             + "If this is what you observe, then the test passes.\n"
                                             + "Otherwise, the test fails.", 40, 5,
                                     TextArea.SCROLLBARS_NONE);
    instruction.setEditable(false);
    instruction.setPreferredSize(new Dimension(300, 70));
    final Panel panel = new Panel();
    panel.setLayout(new FlowLayout());
    panel.add(ta);
    setLayout(new BorderLayout());
    add(instruction, BorderLayout.CENTER);
    add(panel, BorderLayout.PAGE_END);
}
 
Example #4
Source File: SelectionVisible.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void init() {
    ta = new TextArea(4, 20);
    ta.setText("01234\n56789");
    ta.select(3, 9);

    final TextArea instruction = new TextArea("INSTRUCTIONS:\n"
                                             + "The text 34567 should be selected in the TextArea.\n"
                                             + "If this is what you observe, then the test passes.\n"
                                             + "Otherwise, the test fails.", 40, 5,
                                     TextArea.SCROLLBARS_NONE);
    instruction.setEditable(false);
    instruction.setPreferredSize(new Dimension(300, 70));
    final Panel panel = new Panel();
    panel.setLayout(new FlowLayout());
    panel.add(ta);
    setLayout(new BorderLayout());
    add(instruction, BorderLayout.CENTER);
    add(panel, BorderLayout.PAGE_END);
}
 
Example #5
Source File: TextAreaTwicePack.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Frame frame = new Frame();
    final TextArea ta = new TextArea();
    frame.add(ta);
    frame.pack();
    frame.setVisible(true);
    sleep();
    final Dimension before = frame.getSize();
    frame.pack();
    final Dimension after = frame.getSize();
    if (!after.equals(before)) {
        throw new RuntimeException(
                "Expected size: " + before + ", actual size: " + after);
    }
    frame.dispose();
}
 
Example #6
Source File: SelectionAutoscrollTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
void createObjects() {
    textArea = new TextArea( bigString() );
    robot = Util.createRobot();

    Panel panel = new Panel();
    panel.setLayout( new GridLayout(3,3) );

    for( int y=0; y<3; ++y ) {
        for( int x=0; x<3; ++x ) {
            if( x==1 && y==1 ) {
                panel.add( textArea );
            } else {
                panel.add( new Panel() );
            }
        }
    }

    Frame frame = new Frame( "TextArea cursor icon test" );
    frame.setSize( 300, 300 );
    frame.add( panel );
    frame.setVisible( true );
}
 
Example #7
Source File: LWTextAreaPeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void setScrollBarVisibility(final int visibility) {
    final ScrollableJTextArea pane = getDelegate();
    final JTextArea view = pane.getView();
    view.setLineWrap(false);

    switch (visibility) {
        case TextArea.SCROLLBARS_NONE:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            view.setLineWrap(true);
            break;
        case TextArea.SCROLLBARS_VERTICAL_ONLY:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            view.setLineWrap(true);
            break;
        case TextArea.SCROLLBARS_HORIZONTAL_ONLY:
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            break;
        default:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            break;
    }
}
 
Example #8
Source File: TextAreaTwicePack.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Frame frame = new Frame();
    final TextArea ta = new TextArea();
    frame.add(ta);
    frame.pack();
    frame.setVisible(true);
    sleep();
    final Dimension before = frame.getSize();
    frame.pack();
    final Dimension after = frame.getSize();
    if (!after.equals(before)) {
        throw new RuntimeException(
                "Expected size: " + before + ", actual size: " + after);
    }
    frame.dispose();
}
 
Example #9
Source File: SelectionVisible.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void init() {
    ta = new TextArea(4, 20);
    ta.setText("01234\n56789");
    ta.select(3, 9);

    final TextArea instruction = new TextArea("INSTRUCTIONS:\n"
                                             + "The text 34567 should be selected in the TextArea.\n"
                                             + "If this is what you observe, then the test passes.\n"
                                             + "Otherwise, the test fails.", 40, 5,
                                     TextArea.SCROLLBARS_NONE);
    instruction.setEditable(false);
    instruction.setPreferredSize(new Dimension(300, 70));
    final Panel panel = new Panel();
    panel.setLayout(new FlowLayout());
    panel.add(ta);
    setLayout(new BorderLayout());
    add(instruction, BorderLayout.CENTER);
    add(panel, BorderLayout.PAGE_END);
}
 
Example #10
Source File: TextAreaTwicePack.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Frame frame = new Frame();
    final TextArea ta = new TextArea();
    frame.add(ta);
    frame.pack();
    frame.setVisible(true);
    sleep();
    final Dimension before = frame.getSize();
    frame.pack();
    final Dimension after = frame.getSize();
    if (!after.equals(before)) {
        throw new RuntimeException(
                "Expected size: " + before + ", actual size: " + after);
    }
    frame.dispose();
}
 
Example #11
Source File: Test6991580.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example #12
Source File: SelectionVisible.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void init() {
    tf = new TextField(20);
    tf.setText("0123456789");
    tf.select(0, 6);

    final TextArea ta = new TextArea("INSTRUCTIONS:\n"
                                     + "The text 012345 should be selected in the TextField.\n"
                                     + "If this is what you observe, then the test passes.\n"
                                     + "Otherwise, the test fails.", 40, 5,
                                     TextArea.SCROLLBARS_NONE);
    ta.setEditable(false);
    ta.setPreferredSize(new Dimension(300, 70));
    final Panel panel = new Panel();
    panel.setLayout(new FlowLayout());
    panel.add(tf);
    setLayout(new BorderLayout());
    add(ta, BorderLayout.CENTER);
    add(panel, BorderLayout.PAGE_END);
}
 
Example #13
Source File: SelectionVisible.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void init() {
    tf = new TextField(20);
    tf.setText("0123456789");
    tf.select(0, 6);

    final TextArea ta = new TextArea("INSTRUCTIONS:\n"
                                     + "The text 012345 should be selected in the TextField.\n"
                                     + "If this is what you observe, then the test passes.\n"
                                     + "Otherwise, the test fails.", 40, 5,
                                     TextArea.SCROLLBARS_NONE);
    ta.setEditable(false);
    ta.setPreferredSize(new Dimension(300, 70));
    final Panel panel = new Panel();
    panel.setLayout(new FlowLayout());
    panel.add(tf);
    setLayout(new BorderLayout());
    add(ta, BorderLayout.CENTER);
    add(panel, BorderLayout.PAGE_END);
}
 
Example #14
Source File: SelectionVisible.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void init() {
    tf = new TextField(20);
    tf.setText("0123456789");
    tf.select(0, 6);

    final TextArea ta = new TextArea("INSTRUCTIONS:\n"
                                     + "The text 012345 should be selected in the TextField.\n"
                                     + "If this is what you observe, then the test passes.\n"
                                     + "Otherwise, the test fails.", 40, 5,
                                     TextArea.SCROLLBARS_NONE);
    ta.setEditable(false);
    ta.setPreferredSize(new Dimension(300, 70));
    final Panel panel = new Panel();
    panel.setLayout(new FlowLayout());
    panel.add(tf);
    setLayout(new BorderLayout());
    add(ta, BorderLayout.CENTER);
    add(panel, BorderLayout.PAGE_END);
}
 
Example #15
Source File: Test4997635.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example #16
Source File: SelectionAutoscrollTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
void createObjects() {
    textArea = new TextArea( bigString() );
    robot = Util.createRobot();

    Panel panel = new Panel();
    panel.setLayout( new GridLayout(3,3) );

    for( int y=0; y<3; ++y ) {
        for( int x=0; x<3; ++x ) {
            if( x==1 && y==1 ) {
                panel.add( textArea );
            } else {
                panel.add( new Panel() );
            }
        }
    }

    Frame frame = new Frame( "TextArea cursor icon test" );
    frame.setSize( 300, 300 );
    frame.add( panel );
    frame.setVisible( true );
}
 
Example #17
Source File: SelectionVisible.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void init() {
    tf = new TextField(20);
    tf.setText("0123456789");
    tf.select(0, 6);

    final TextArea ta = new TextArea("INSTRUCTIONS:\n"
                                     + "The text 012345 should be selected in the TextField.\n"
                                     + "If this is what you observe, then the test passes.\n"
                                     + "Otherwise, the test fails.", 40, 5,
                                     TextArea.SCROLLBARS_NONE);
    ta.setEditable(false);
    ta.setPreferredSize(new Dimension(300, 70));
    final Panel panel = new Panel();
    panel.setLayout(new FlowLayout());
    panel.add(tf);
    setLayout(new BorderLayout());
    add(ta, BorderLayout.CENTER);
    add(panel, BorderLayout.PAGE_END);
}
 
Example #18
Source File: TextAreaTwicePack.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Frame frame = new Frame();
    final TextArea ta = new TextArea();
    frame.add(ta);
    frame.pack();
    frame.setVisible(true);
    sleep();
    final Dimension before = frame.getSize();
    frame.pack();
    final Dimension after = frame.getSize();
    if (!after.equals(before)) {
        throw new RuntimeException(
                "Expected size: " + before + ", actual size: " + after);
    }
    frame.dispose();
}
 
Example #19
Source File: LWTextAreaPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void setScrollBarVisibility(final int visibility) {
    final ScrollableJTextArea pane = getDelegate();
    final JTextArea view = pane.getView();
    view.setLineWrap(false);

    switch (visibility) {
        case TextArea.SCROLLBARS_NONE:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            view.setLineWrap(true);
            break;
        case TextArea.SCROLLBARS_VERTICAL_ONLY:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            view.setLineWrap(true);
            break;
        case TextArea.SCROLLBARS_HORIZONTAL_ONLY:
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            break;
        default:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            break;
    }
}
 
Example #20
Source File: SelectionAutoscrollTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void createObjects() {
    textArea = new TextArea( bigString() );
    robot = Util.createRobot();

    Panel panel = new Panel();
    panel.setLayout( new GridLayout(3,3) );

    for( int y=0; y<3; ++y ) {
        for( int x=0; x<3; ++x ) {
            if( x==1 && y==1 ) {
                panel.add( textArea );
            } else {
                panel.add( new Panel() );
            }
        }
    }

    Frame frame = new Frame( "TextArea cursor icon test" );
    frame.setSize( 300, 300 );
    frame.add( panel );
    frame.setVisible( true );
}
 
Example #21
Source File: LWTextAreaPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void setScrollBarVisibility(final int visibility) {
    final ScrollableJTextArea pane = getDelegate();
    final JTextArea view = pane.getView();
    view.setLineWrap(false);

    switch (visibility) {
        case TextArea.SCROLLBARS_NONE:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            view.setLineWrap(true);
            break;
        case TextArea.SCROLLBARS_VERTICAL_ONLY:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            view.setLineWrap(true);
            break;
        case TextArea.SCROLLBARS_HORIZONTAL_ONLY:
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            break;
        default:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            break;
    }
}
 
Example #22
Source File: LWTextAreaPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void setScrollBarVisibility(final int visibility) {
    final ScrollableJTextArea pane = getDelegate();
    final JTextArea view = pane.getView();
    view.setLineWrap(false);

    switch (visibility) {
        case TextArea.SCROLLBARS_NONE:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            view.setLineWrap(true);
            break;
        case TextArea.SCROLLBARS_VERTICAL_ONLY:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            view.setLineWrap(true);
            break;
        case TextArea.SCROLLBARS_HORIZONTAL_ONLY:
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            break;
        default:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            break;
    }
}
 
Example #23
Source File: LWTextAreaPeer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void setScrollBarVisibility(final int visibility) {
    final ScrollableJTextArea pane = getDelegate();
    final JTextArea view = pane.getView();
    view.setLineWrap(false);

    switch (visibility) {
        case TextArea.SCROLLBARS_NONE:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            view.setLineWrap(true);
            break;
        case TextArea.SCROLLBARS_VERTICAL_ONLY:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            view.setLineWrap(true);
            break;
        case TextArea.SCROLLBARS_HORIZONTAL_ONLY:
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            break;
        default:
            pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            break;
    }
}
 
Example #24
Source File: ScrollSelectionTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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("South", messageText);

  pack();

  show();
}
 
Example #25
Source File: HoveringAndDraggingTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void start() {
    String[] instructions = new String[] {
        "1. Notice components in test window: main-panel, box-for-text,"
            +" 2 scroll-sliders, and 4 scroll-buttons.",
        "2. Hover mouse over box-for-text."
            +" Make sure, that mouse cursor is TextCursor (a.k.a. \"beam\").",
        "3. Hover mouse over each of components (see item 1), except for box-for-text."
            +" Make sure, that cursor is DefaultCursor (arrow).",
        "4. Drag mouse (using any mouse button) from box-for-text to every"
            +" component in item 1, and also outside application window."
            +" Make sure, that cursor remains TextCursor while mouse button is pressed.",
        "5. Repeat item 4 for each other component in item 1, except for box-for-text,"
            +" _but_ now make sure that cursor is DefaultCursor.",
        "6. If cursor behaves as described in items 2-3-4-5, then test passed; otherwise it failed."
    };
    Sysout.createDialogWithInstructions( instructions );

    Panel panel = new Panel();
    panel.setLayout( new GridLayout(3,3) );

    for( int y=0; y<3; ++y ) {
        for( int x=0; x<3; ++x ) {
            if( x==1 && y==1 ) {
                panel.add( new TextArea( bigString() ) );
            } else {
                panel.add( new Panel() );
            }
        }
    }

    Frame frame = new Frame( "TextArea cursor icon test" );
    frame.setSize( 300, 300 );
    frame.add( panel );
    frame.setVisible( true );
}
 
Example #26
Source File: InputVerifierTest3.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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);

    pack();

    setVisible(true);
}
 
Example #27
Source File: EmbeddedFrameTest1.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);

    pack();

    setVisible(true);
}
 
Example #28
Source File: ScrollSelectionTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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("South", messageText);

  pack();

  show();
}
 
Example #29
Source File: HoveringAndDraggingTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);

    pack();

    setVisible(true);
}
 
Example #30
Source File: TextAreaEditing.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private TextAreaEditing() {
    testFailMessage = new StringBuilder();
    mainFrame = new Frame();
    mainFrame.setSize(200, 200);

    textArea = new TextArea();
    mainFrame.add(textArea);
    mainFrame.setVisible(true);
}