11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 package javafx.scene.control.test.textinput;
26
27 import javafx.event.Event;
28 import javafx.event.EventHandler;
29 import javafx.scene.Scene;
30 import javafx.scene.control.Button;
31 import javafx.scene.control.ButtonBuilder;
32 import javafx.scene.control.TextArea;
33 import javafx.scene.control.TextField;
34 import javafx.scene.layout.Pane;
35 import test.javaclient.shared.Utils;
36
37 /**
38 * @author Alexander Kirov
39 */
40 public class TextAreaPropertiesApp extends TextControlApp {
41 public static void main(String[] args) {
42 Utils.launch(TextAreaPropertiesApp.class, args);
43 }
44
45 @Override
46 protected Scene getScene() {
47 setTitle();
48 return new TextAreaScene();
49 }
50
51 public class TextAreaScene extends TextInputScene {
52
53 @Override
55 testedTextInput = new TextArea();
56 }
57
58 @Override
59 public void resetControl() {
60 TextArea fresh = new TextArea();
61 TextArea tested = (TextArea) testedTextInput;
62 tested.setPrefWidth(fresh.getPrefWidth());
63 tested.setPrefHeight(fresh.getPrefHeight());
64 tested.setDisable(fresh.isDisable());
65 tested.setEditable(fresh.isEditable());
66 tested.setPrefColumnCount(fresh.getPrefColumnCount());
67 tested.setPrefRowCount(fresh.getPrefRowCount());
68 tested.setText(fresh.getText());
69 tested.setFocusTraversable(fresh.isFocusTraversable());
70 tested.setWrapText(fresh.isWrapText());
71 }
72
73 @Override
74 public void addControlSpecificButtons(Pane pane) {
75 Button button = ButtonBuilder.create().id(ADD_TEXT_BUTTON_ID).text("Add much text").build();
76 button.setOnAction(new EventHandler() {
77
78 public void handle(Event t) {
79 for (int i = 0; i < 1000; i++) {
80 TextArea ta = (TextArea) testedTextInput;
81 ta.setText(ta.getText() + " some text");
82 if (i % 10 == 0) {
83 ta.setText(ta.getText() + "\n");
84 }
85 }
86 }
87 });
88 pane.getChildren().add(button);
89 }
90
91 @Override
92 protected void addControlDependentProperties() {
93 TextArea textArea = (TextArea) testedTextInput;
94 tb.addSimpleListener(textArea.focusedProperty(), textArea);
95 }
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 package javafx.scene.control.test.textinput;
26
27 import javafx.event.Event;
28 import javafx.event.EventHandler;
29 import javafx.scene.Scene;
30 import javafx.scene.control.Button;
31 import javafx.scene.control.TextArea;
32 import javafx.scene.layout.Pane;
33 import test.javaclient.shared.Utils;
34
35 /**
36 * @author Alexander Kirov
37 */
38 public class TextAreaPropertiesApp extends TextControlApp {
39 public static void main(String[] args) {
40 Utils.launch(TextAreaPropertiesApp.class, args);
41 }
42
43 @Override
44 protected Scene getScene() {
45 setTitle();
46 return new TextAreaScene();
47 }
48
49 public class TextAreaScene extends TextInputScene {
50
51 @Override
53 testedTextInput = new TextArea();
54 }
55
56 @Override
57 public void resetControl() {
58 TextArea fresh = new TextArea();
59 TextArea tested = (TextArea) testedTextInput;
60 tested.setPrefWidth(fresh.getPrefWidth());
61 tested.setPrefHeight(fresh.getPrefHeight());
62 tested.setDisable(fresh.isDisable());
63 tested.setEditable(fresh.isEditable());
64 tested.setPrefColumnCount(fresh.getPrefColumnCount());
65 tested.setPrefRowCount(fresh.getPrefRowCount());
66 tested.setText(fresh.getText());
67 tested.setFocusTraversable(fresh.isFocusTraversable());
68 tested.setWrapText(fresh.isWrapText());
69 }
70
71 @Override
72 public void addControlSpecificButtons(Pane pane) {
73 Button button = new Button("Add much text");
74 button.setId(ADD_TEXT_BUTTON_ID);
75 button.setOnAction(new EventHandler() {
76
77 public void handle(Event t) {
78 for (int i = 0; i < 1000; i++) {
79 TextArea ta = (TextArea) testedTextInput;
80 ta.setText(ta.getText() + " some text");
81 if (i % 10 == 0) {
82 ta.setText(ta.getText() + "\n");
83 }
84 }
85 }
86 });
87 pane.getChildren().add(button);
88 }
89
90 @Override
91 protected void addControlDependentProperties() {
92 TextArea textArea = (TextArea) testedTextInput;
93 tb.addSimpleListener(textArea.focusedProperty(), textArea);
94 }
|