25
26 import javafx.beans.value.ChangeListener;
27 import javafx.beans.value.ObservableValue;
28 import javafx.collections.FXCollections;
29 import javafx.event.ActionEvent;
30 import javafx.event.EventHandler;
31 import javafx.geometry.Insets;
32 import javafx.geometry.Pos;
33 import javafx.scene.Parent;
34 import javafx.scene.Scene;
35 import javafx.scene.control.Button;
36 import javafx.scene.control.ChoiceBox;
37 import javafx.scene.layout.HBox;
38 import javafx.scene.layout.Pane;
39 import javafx.scene.layout.StackPane;
40 import javafx.scene.layout.VBox;
41 import javafx.scene.shape.Rectangle;
42 import javafx.scene.text.FontSmoothingType;
43 import javafx.scene.text.Text;
44 import javafx.scene.text.TextAlignment;
45 import javafx.scene.text.TextBuilder;
46 import test.javaclient.shared.InteroperabilityApp;
47 import test.javaclient.shared.Utils;
48
49 /**
50 *
51 * @author Alexander Petrov
52 */
53 public class LCDTextTestApp extends InteroperabilityApp {
54 static {
55 System.setProperty("prism.lcdtext", "true");
56 }
57
58 public static TestCollections testCollection = null;
59 public static TestAction testAction = null;
60
61 private static final int WIDTH = 300;
62 private static final int HEIGHT = 480;
63 private ChoiceBox<TestAction> actionChoice;
64 private ChoiceBox<TestCollections> collecionChoice;
65 private Text grayText;
83 controlsPane.setAlignment(Pos.CENTER);
84 controlsPane.setPadding(new Insets(5));
85
86 leftPane = new StackPane();
87 leftPane.setId("leftPane");
88 leftPane.setPrefSize(WIDTH, HEIGHT);
89 leftPane.setMaxSize(WIDTH, HEIGHT);
90 leftPane.setMinSize(WIDTH, HEIGHT);
91
92 collecionChoice = new ChoiceBox<TestCollections>(
93 FXCollections.observableArrayList(TestCollections.values()));
94 collecionChoice.setPrefWidth(150);
95 actionChoice = new ChoiceBox<TestAction>();
96 actionChoice.setPrefWidth(150);
97
98 collecionChoice.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TestCollections>() {
99
100 public void changed(ObservableValue<? extends TestCollections> ov, TestCollections t, TestCollections newValue) {
101 actionChoice.setItems(FXCollections.observableArrayList(newValue.getActions()));
102 actionChoice.getSelectionModel().selectFirst();
103 lcdText = TextBuilder.create().text("Test text")
104 .textAlignment(TextAlignment.CENTER)
105 .style("-fx-font-size: 16;-fx-font-smoothing-type: lcd;")
106 .fontSmoothingType(FontSmoothingType.LCD)
107 .build();
108
109 leftPane.getChildren().clear();
110 leftPane.getChildren().add(lcdText);
111 }
112 });
113
114 if(LCDTextTestApp.testCollection != null){
115 collecionChoice.getSelectionModel().select(LCDTextTestApp.testCollection);
116 }
117
118
119 Button applyButton = new Button("Apply");
120 applyButton.setId("btnApply");
121 applyButton.setOnAction(new EventHandler<ActionEvent>() {
122
123 public void handle(ActionEvent t) {
124 apply();
125 }
126 });
127 applyButton.setPrefWidth(75);
128
|
25
26 import javafx.beans.value.ChangeListener;
27 import javafx.beans.value.ObservableValue;
28 import javafx.collections.FXCollections;
29 import javafx.event.ActionEvent;
30 import javafx.event.EventHandler;
31 import javafx.geometry.Insets;
32 import javafx.geometry.Pos;
33 import javafx.scene.Parent;
34 import javafx.scene.Scene;
35 import javafx.scene.control.Button;
36 import javafx.scene.control.ChoiceBox;
37 import javafx.scene.layout.HBox;
38 import javafx.scene.layout.Pane;
39 import javafx.scene.layout.StackPane;
40 import javafx.scene.layout.VBox;
41 import javafx.scene.shape.Rectangle;
42 import javafx.scene.text.FontSmoothingType;
43 import javafx.scene.text.Text;
44 import javafx.scene.text.TextAlignment;
45 import test.javaclient.shared.InteroperabilityApp;
46 import test.javaclient.shared.Utils;
47
48 /**
49 *
50 * @author Alexander Petrov
51 */
52 public class LCDTextTestApp extends InteroperabilityApp {
53 static {
54 System.setProperty("prism.lcdtext", "true");
55 }
56
57 public static TestCollections testCollection = null;
58 public static TestAction testAction = null;
59
60 private static final int WIDTH = 300;
61 private static final int HEIGHT = 480;
62 private ChoiceBox<TestAction> actionChoice;
63 private ChoiceBox<TestCollections> collecionChoice;
64 private Text grayText;
82 controlsPane.setAlignment(Pos.CENTER);
83 controlsPane.setPadding(new Insets(5));
84
85 leftPane = new StackPane();
86 leftPane.setId("leftPane");
87 leftPane.setPrefSize(WIDTH, HEIGHT);
88 leftPane.setMaxSize(WIDTH, HEIGHT);
89 leftPane.setMinSize(WIDTH, HEIGHT);
90
91 collecionChoice = new ChoiceBox<TestCollections>(
92 FXCollections.observableArrayList(TestCollections.values()));
93 collecionChoice.setPrefWidth(150);
94 actionChoice = new ChoiceBox<TestAction>();
95 actionChoice.setPrefWidth(150);
96
97 collecionChoice.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TestCollections>() {
98
99 public void changed(ObservableValue<? extends TestCollections> ov, TestCollections t, TestCollections newValue) {
100 actionChoice.setItems(FXCollections.observableArrayList(newValue.getActions()));
101 actionChoice.getSelectionModel().selectFirst();
102 lcdText = new Text("Test text");
103 lcdText.setTextAlignment(TextAlignment.CENTER);
104 lcdText.setStyle("-fx-font-size: 16;-fx-font-smoothing-type: lcd;");
105 lcdText.setFontSmoothingType(FontSmoothingType.LCD);
106 leftPane.getChildren().clear();
107 leftPane.getChildren().add(lcdText);
108 }
109 });
110
111 if(LCDTextTestApp.testCollection != null){
112 collecionChoice.getSelectionModel().select(LCDTextTestApp.testCollection);
113 }
114
115
116 Button applyButton = new Button("Apply");
117 applyButton.setId("btnApply");
118 applyButton.setOnAction(new EventHandler<ActionEvent>() {
119
120 public void handle(ActionEvent t) {
121 apply();
122 }
123 });
124 applyButton.setPrefWidth(75);
125
|