|
3 | 3 | /*******************************************************************************
|
4 | 4 | * Copyright (c) 2016 comtel2000
|
5 | 5 | *
|
6 |
| - * Redistribution and use in source and binary forms, with or without modification, |
7 |
| - * are permitted provided that the following conditions are met: |
| 6 | + * Redistribution and use in source and binary forms, with or without modification, are permitted |
| 7 | + * provided that the following conditions are met: |
8 | 8 | *
|
9 |
| - * 1. Redistributions of source code must retain the above copyright notice, this |
10 |
| - * list of conditions and the following disclaimer. |
| 9 | + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions |
| 10 | + * and the following disclaimer. |
11 | 11 | *
|
12 |
| - * 2. Redistributions in binary form must reproduce the above copyright notice, |
13 |
| - * this list of conditions and the following disclaimer in the documentation |
14 |
| - * and/or other materials provided with the distribution. |
| 12 | + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of |
| 13 | + * conditions and the following disclaimer in the documentation and/or other materials provided with |
| 14 | + * the distribution. |
15 | 15 | *
|
16 |
| - * 3. Neither the name of the comtel2000 nor the names of its contributors |
17 |
| - * may be used to endorse or promote products derived from this software without |
18 |
| - * specific prior written permission. |
| 16 | + * 3. Neither the name of the comtel2000 nor the names of its contributors may be used to endorse or |
| 17 | + * promote products derived from this software without specific prior written permission. |
19 | 18 | *
|
20 |
| - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
21 |
| - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
22 |
| - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
23 |
| - * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
24 |
| - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
25 |
| - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 |
| - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
27 |
| - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
28 |
| - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
29 |
| - * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 19 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR |
| 20 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 21 | + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| 22 | + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 23 | + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 25 | + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY |
| 26 | + * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 27 | *******************************************************************************/
|
31 | 28 |
|
32 | 29 | import java.util.Locale;
|
|
52 | 49 |
|
53 | 50 | public class MainDemo extends Application implements VkProperties {
|
54 | 51 |
|
55 |
| - @Override |
56 |
| - public void start(Stage stage) { |
57 |
| - stage.setTitle("FX Keyboard (" + System.getProperty("javafx.runtime.version") + ")"); |
58 |
| - stage.setResizable(true); |
| 52 | + @Override |
| 53 | + public void start(Stage stage) { |
| 54 | + stage.setTitle("FX Keyboard (" + System.getProperty("javafx.runtime.version") + ")"); |
| 55 | + stage.setResizable(true); |
59 | 56 |
|
60 |
| - KeyBoardPopup popup = KeyBoardPopupBuilder.create().initLocale(Locale.ENGLISH).build(); |
| 57 | + KeyBoardPopup popup = KeyBoardPopupBuilder.create().initLocale(Locale.ENGLISH).build(); |
61 | 58 |
|
62 |
| - VBox pane = new VBox(20); |
| 59 | + VBox pane = new VBox(20); |
63 | 60 |
|
64 |
| - Button okButton = new Button("Ok"); |
65 |
| - okButton.setDefaultButton(true); |
| 61 | + Button okButton = new Button("Ok"); |
| 62 | + okButton.setDefaultButton(true); |
66 | 63 |
|
67 |
| - Button cancelButton = new Button("Cancel"); |
68 |
| - cancelButton.setCancelButton(true); |
| 64 | + Button cancelButton = new Button("Cancel"); |
| 65 | + cancelButton.setCancelButton(true); |
69 | 66 |
|
70 |
| - CheckBox spaceKeyMove = new CheckBox("Movable"); |
71 |
| - spaceKeyMove.setSelected(true); |
72 |
| - popup.getKeyBoard().spaceKeyMoveProperty().bindBidirectional(spaceKeyMove.selectedProperty()); |
| 67 | + CheckBox spaceKeyMove = new CheckBox("Movable"); |
| 68 | + spaceKeyMove.setSelected(true); |
| 69 | + popup.getKeyBoard().spaceKeyMoveProperty().bindBidirectional(spaceKeyMove.selectedProperty()); |
73 | 70 |
|
74 |
| - CheckBox capsLock = new CheckBox("CapsLock"); |
75 |
| - capsLock.setSelected(true); |
76 |
| - popup.getKeyBoard().capsLockProperty().bindBidirectional(capsLock.selectedProperty()); |
| 71 | + CheckBox capsLock = new CheckBox("CapsLock"); |
| 72 | + capsLock.setSelected(true); |
| 73 | + popup.getKeyBoard().capsLockProperty().bindBidirectional(capsLock.selectedProperty()); |
77 | 74 |
|
78 |
| - CheckBox numblock = new CheckBox("NumBlock"); |
79 |
| - numblock.setSelected(false); |
80 |
| - numblock.selectedProperty().addListener((l, a, b) -> popup.getKeyBoard().switchLayer(b ? DefaultLayer.NUMBLOCK : DefaultLayer.DEFAULT)); |
| 75 | + CheckBox numblock = new CheckBox("NumBlock"); |
| 76 | + numblock.setSelected(false); |
| 77 | + numblock.selectedProperty().addListener((l, a, b) -> popup.getKeyBoard().switchLayer(b ? DefaultLayer.NUMBLOCK : DefaultLayer.DEFAULT)); |
81 | 78 |
|
82 |
| - pane.getChildren().add(new ToolBar(okButton, cancelButton, spaceKeyMove, capsLock, numblock)); |
| 79 | + pane.getChildren().add(new ToolBar(okButton, cancelButton, spaceKeyMove, capsLock, numblock)); |
83 | 80 |
|
84 |
| - pane.getChildren().add(new Label("Text0")); |
85 |
| - TextField tf0 = new TextField(); |
86 |
| - tf0.setPromptText("text"); |
87 |
| - pane.getChildren().add(tf0); |
| 81 | + pane.getChildren().add(new Label("Text0")); |
| 82 | + TextField tf0 = new TextField(); |
| 83 | + tf0.setPromptText("text"); |
| 84 | + pane.getChildren().add(tf0); |
88 | 85 |
|
89 |
| - pane.getChildren().add(new Label("Text1 (numeric)")); |
90 |
| - TextField tf1 = new TextField(); |
91 |
| - tf1.setPromptText("0-9"); |
92 |
| - // Currently, the vkType property supports the following values: |
93 |
| - // numeric, url, email, and text |
94 |
| - tf1.getProperties().put(VK_TYPE, "numeric"); |
95 |
| - pane.getChildren().add(tf1); |
| 86 | + pane.getChildren().add(new Label("Text1 (numeric)")); |
| 87 | + TextField tf1 = new TextField(); |
| 88 | + tf1.setPromptText("0-9"); |
| 89 | + // Currently, the vkType property supports the following values: |
| 90 | + // numeric, url, email, and text |
| 91 | + tf1.getProperties().put(VK_TYPE, "numeric"); |
| 92 | + pane.getChildren().add(tf1); |
96 | 93 |
|
97 |
| - pane.getChildren().add(new Label("Text2 (locale 'de')")); |
98 |
| - TextField tf2 = new TextField(); |
99 |
| - tf2.setPromptText("switch locale to 'DE'"); |
100 |
| - tf2.getProperties().put(VK_LOCALE, "de"); |
101 |
| - pane.getChildren().add(tf2); |
| 94 | + pane.getChildren().add(new Label("Text2 (locale 'de')")); |
| 95 | + TextField tf2 = new TextField(); |
| 96 | + tf2.setPromptText("switch locale to 'DE'"); |
| 97 | + tf2.getProperties().put(VK_LOCALE, "de"); |
| 98 | + pane.getChildren().add(tf2); |
102 | 99 |
|
103 |
| - pane.getChildren().add(new Label("Text3 (email)")); |
104 |
| - TextField tf3 = new TextField(); |
105 |
| - tf3.setPromptText("email"); |
106 |
| - tf3.getProperties().put(VK_TYPE, VK_TYPE_EMAIL); |
107 |
| - pane.getChildren().add(tf3); |
| 100 | + pane.getChildren().add(new Label("Text3 (email)")); |
| 101 | + TextField tf3 = new TextField(); |
| 102 | + tf3.setPromptText("email"); |
| 103 | + tf3.getProperties().put(VK_TYPE, VK_TYPE_EMAIL); |
| 104 | + pane.getChildren().add(tf3); |
108 | 105 |
|
109 |
| - pane.getChildren().add(new Label("Text4 (url)")); |
110 |
| - TextField tf4 = new TextField(); |
111 |
| - tf4.setPromptText("url"); |
112 |
| - tf4.getProperties().put(VK_TYPE, VK_TYPE_URL); |
113 |
| - pane.getChildren().add(tf4); |
| 106 | + pane.getChildren().add(new Label("Text4 (url)")); |
| 107 | + TextField tf4 = new TextField(); |
| 108 | + tf4.setPromptText("url"); |
| 109 | + tf4.getProperties().put(VK_TYPE, VK_TYPE_URL); |
| 110 | + pane.getChildren().add(tf4); |
114 | 111 |
|
115 |
| - ComboBox<String> combo = new ComboBox<>(); |
116 |
| - combo.setEditable(true); |
117 |
| - combo.getProperties().put(VK_TYPE, VK_TYPE_NUMERIC); |
118 |
| - pane.getChildren().add(combo); |
| 112 | + ComboBox<String> combo = new ComboBox<>(); |
| 113 | + combo.setEditable(true); |
| 114 | + combo.getProperties().put(VK_TYPE, VK_TYPE_NUMERIC); |
| 115 | + pane.getChildren().add(combo); |
119 | 116 |
|
120 |
| - pane.getChildren().add(new TextArea()); |
121 |
| - pane.getChildren().add(new Label("Password")); |
122 |
| - pane.getChildren().add(new PasswordField()); |
123 |
| - pane.getChildren().add(new Separator()); |
| 117 | + pane.getChildren().add(new TextArea()); |
| 118 | + pane.getChildren().add(new Label("Password")); |
| 119 | + pane.getChildren().add(new PasswordField()); |
| 120 | + pane.getChildren().add(new Separator()); |
124 | 121 |
|
125 |
| - Scene scene = new Scene(pane, 600, 800); |
| 122 | + Scene scene = new Scene(pane, 600, 800); |
126 | 123 |
|
127 |
| - stage.setOnCloseRequest(e -> System.exit(0)); |
128 |
| - stage.setScene(scene); |
| 124 | + stage.setOnCloseRequest(e -> System.exit(0)); |
| 125 | + stage.setScene(scene); |
129 | 126 |
|
130 |
| - popup.addDoubleClickEventFilter(stage); |
131 |
| - popup.addFocusListener(scene); |
| 127 | + popup.addDoubleClickEventFilter(stage); |
| 128 | + popup.addFocusListener(scene); |
132 | 129 |
|
133 |
| - stage.show(); |
| 130 | + stage.show(); |
134 | 131 |
|
135 |
| - } |
| 132 | + } |
136 | 133 |
|
137 |
| - public static void main(String[] args) { |
138 |
| - Application.launch(args); |
139 |
| - } |
| 134 | + public static void main(String[] args) { |
| 135 | + Application.launch(args); |
| 136 | + } |
140 | 137 |
|
141 | 138 | }
|
0 commit comments