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 */
24 package test.fxapp;
25
26 import java.util.List;
27 import java.util.Map;
28 import javafx.application.Application;
29 import javafx.event.ActionEvent;
30 import javafx.event.EventHandler;
31 import javafx.scene.Group;
32 import javafx.scene.Scene;
33 import javafx.scene.control.ButtonBuilder;
34 import javafx.stage.Stage;
35
36 /**
37 *
38 * @author Sergey
39 */
40 public class LifecycleApp extends Application {
41
42 static final String PARAM1 = "param1";
43 static final String PARAM2 = " param2";
44 static final String PARAM3 = " param3 ";
45 static final String PARAMZ = "param4 param5";
46 static final String NAME1 = "named1";
47 static final String VALUE1 = "value1";
48 static final String NAME2 = "named2";
49 static final String FAKENAMED = "fakenamed3=value3";
50
51 static final String[] DEFAULT_PARAMS = new String[] {PARAM1, PARAM2, "--" + NAME1 + "=" + VALUE1, "--" + NAME2 + "=", FAKENAMED, PARAMZ, PARAM3};
52
53 public static void main(String[] args) {
57
58 @Override
59 public void start(final Stage stage) throws Exception {
60
61 System.out.println("START");
62 status.start = now();
63
64 status.named = getParameters().getNamed();
65 System.out.println("Named Parameters:");
66 for (String pkey : status.named.keySet()) {
67 System.out.println(pkey + "=" + status.named.get(pkey));
68 }
69 System.out.println("Unnamed Parameters:");
70 for (String string : status.unnamed = getParameters().getUnnamed()) {
71 System.out.println(string);
72 }
73 System.out.println("Raw Parameters:");
74 for (String string : status.raw = getParameters().getRaw()) {
75 System.out.println(string);
76 }
77 stage.setScene(new Scene(new Group(ButtonBuilder.create().text("close").onAction(new EventHandler<ActionEvent>() {
78
79 public void handle(ActionEvent t) {
80 stage.close();
81 }
82
83 }).build())));
84 stage.show();
85
86 }
87
88 @Override
89 public void init() throws Exception {
90 super.init();
91 System.out.println("INIT");
92 status.init = now();
93 }
94
95 @Override
96 public void stop() throws Exception {
97 super.stop();
98 System.out.println("STOP");
99 status.stop = now();
100 }
101
102
103 // reporting utility, we use an interpid assume that there is one test in the VM at one time
|
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 */
24 package test.fxapp;
25
26 import java.util.List;
27 import java.util.Map;
28 import javafx.application.Application;
29 import javafx.event.ActionEvent;
30 import javafx.event.EventHandler;
31 import javafx.scene.Group;
32 import javafx.scene.Scene;
33 import javafx.scene.control.Button;
34 import javafx.stage.Stage;
35
36 /**
37 *
38 * @author Sergey
39 */
40 public class LifecycleApp extends Application {
41
42 static final String PARAM1 = "param1";
43 static final String PARAM2 = " param2";
44 static final String PARAM3 = " param3 ";
45 static final String PARAMZ = "param4 param5";
46 static final String NAME1 = "named1";
47 static final String VALUE1 = "value1";
48 static final String NAME2 = "named2";
49 static final String FAKENAMED = "fakenamed3=value3";
50
51 static final String[] DEFAULT_PARAMS = new String[] {PARAM1, PARAM2, "--" + NAME1 + "=" + VALUE1, "--" + NAME2 + "=", FAKENAMED, PARAMZ, PARAM3};
52
53 public static void main(String[] args) {
57
58 @Override
59 public void start(final Stage stage) throws Exception {
60
61 System.out.println("START");
62 status.start = now();
63
64 status.named = getParameters().getNamed();
65 System.out.println("Named Parameters:");
66 for (String pkey : status.named.keySet()) {
67 System.out.println(pkey + "=" + status.named.get(pkey));
68 }
69 System.out.println("Unnamed Parameters:");
70 for (String string : status.unnamed = getParameters().getUnnamed()) {
71 System.out.println(string);
72 }
73 System.out.println("Raw Parameters:");
74 for (String string : status.raw = getParameters().getRaw()) {
75 System.out.println(string);
76 }
77 Button temp = new Button();
78 temp.setText("close");
79 temp.setOnAction(new EventHandler<ActionEvent>() {
80 public void handle(ActionEvent t) {
81 stage.close();
82 }
83 });
84 stage.setScene(new Scene(new Group(temp)));
85 stage.show();
86
87 }
88
89 @Override
90 public void init() throws Exception {
91 super.init();
92 System.out.println("INIT");
93 status.init = now();
94 }
95
96 @Override
97 public void stop() throws Exception {
98 super.stop();
99 System.out.println("STOP");
100 status.stop = now();
101 }
102
103
104 // reporting utility, we use an interpid assume that there is one test in the VM at one time
|