8030953: SelectionVisible test should test multiline selection in case of TextArea

Reviewed-by: pchelko, azvegint
This commit is contained in:
Sergey Bylokhov 2013-12-23 18:54:50 +04:00
parent e4bef18896
commit 7842ee3945

View File

@ -31,32 +31,32 @@ import java.awt.TextArea;
public final class SelectionVisible extends Applet { public final class SelectionVisible extends Applet {
TextArea tf; private TextArea ta;
@Override @Override
public void init() { public void init() {
tf = new TextArea(3, 20); ta = new TextArea(4, 20);
tf.setText("0123456789"); ta.setText("01234\n56789");
tf.select(0, 6); ta.select(3, 9);
final TextArea ta = new TextArea("INSTRUCTIONS:\n" final TextArea instruction = new TextArea("INSTRUCTIONS:\n"
+ "The text 012345 should be selected in the TextArea.\n" + "The text 34567 should be selected in the TextArea.\n"
+ "If this is what you observe, then the test passes.\n" + "If this is what you observe, then the test passes.\n"
+ "Otherwise, the test fails.", 40, 5, + "Otherwise, the test fails.", 40, 5,
TextArea.SCROLLBARS_NONE); TextArea.SCROLLBARS_NONE);
ta.setEditable(false); instruction.setEditable(false);
ta.setPreferredSize(new Dimension(300, 70)); instruction.setPreferredSize(new Dimension(300, 70));
final Panel panel = new Panel(); final Panel panel = new Panel();
panel.setLayout(new FlowLayout()); panel.setLayout(new FlowLayout());
panel.add(tf); panel.add(ta);
setLayout(new BorderLayout()); setLayout(new BorderLayout());
add(ta, BorderLayout.CENTER); add(instruction, BorderLayout.CENTER);
add(panel, BorderLayout.PAGE_END); add(panel, BorderLayout.PAGE_END);
} }
@Override @Override
public void start() { public void start() {
setVisible(true); setVisible(true);
tf.requestFocus(); ta.requestFocus();
} }
} }