You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: data/part-13/1-graphical-user-interfaces.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ A test library called [TestFX] (https://github.com/TestFX/TestFX/wiki) is used i
45
45
</text-box>
46
46
47
47
<!-- <text-box variant='hint' name='Tarvittavat oikeudet macOS:lla tehtävien testeihin'> -->
48
-
<text-box variant='hint' name='Required Rights on macOS for Exercise Tests''>
48
+
<text-boxvariant='hint'name='Required Rights on macOS for Exercise Tests'>
49
49
50
50
<!-- Tämän osan tehtävissä osa testeistä odottaa, että tmcbeans saa vapaasti liikuttaa kursoria näytöllä. macOS-käyttöjärjestelmällä (Apple-tietokoneet) tähän tarvitsee antaa erikseen tmcbeansille oikeus. Täältä löytyy ohjeet, miten oikeus myönnetään: [macOS ohjeet](/macos-ohjeet) -->
51
51
@@ -108,6 +108,8 @@ When the launch method is called, the method of the Application class creates a
108
108
109
109
<!-- Luo tehtäväpohjassa olevaan luokkaan graafinen käyttöliittymä, jonka otsikkona on "Sovellukseni". Sovelluksen tulee käynnistyä kun main-metodi suoritetaan. -->
110
110
111
+
Create a GUI app with the title "My first application". The App shou start when main method is executed
Copy file name to clipboardExpand all lines: data/part-13/4-launch-parameters.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,7 +91,7 @@ When the `main` method of the class above is executed, the user interface define
91
91
92
92
The application can also be provided run-time parameters as part of the `launch` method. In addition to the lauched class, the `launch` method can be provided an unlimited number of strings that can be used as part of the launch. These strings are available during the application's launch via the `getParameters` method call.
93
93
94
-
The `getParameters ()` method returns a [Parameters] (https://docs.oracle.com/javase/8/javafx/api/javafx/application/Application.Parameters.html) type object whose method `getNamed` can access a hash table containing key-value pairs. The key-value pairs are given to the launch method in the form `--key = value`. In the example below, the title is made up of two parameters: `organization` and `course`.
94
+
The `getParameters` method returns a [Parameters] (https://docs.oracle.com/javase/8/javafx/api/javafx/application/Application.Parameters.html) type object whose method `getNamed` can access a hash table containing key-value pairs. The key-value pairs are given to the launch method in the form `--key = value`. In the example below, the title is made up of two parameters: `organization` and `course`.
Copy file name to clipboardExpand all lines: data/part-13/5-multiple-views.md
+188-2Lines changed: 188 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -225,7 +225,7 @@ Sometimes one wants an application to have a permanent view whose parts are swap
225
225
226
226
In the example below, there is a application which contains a main menu and an area with variable content. When pressing the buttons on the main menu the the content of the content area changes.
227
227
228
-
228
+
<!--
229
229
```java
230
230
package application;
231
231
@@ -300,6 +300,82 @@ public class ExampleApplication extends Application {
300
300
}
301
301
}
302
302
```
303
+
-->
304
+
305
+
```java
306
+
packageapplication;
307
+
308
+
importjavafx.application.Application;
309
+
importjavafx.geometry.Insets;
310
+
importjavafx.geometry.Pos;
311
+
importjavafx.scene.Scene;
312
+
importjavafx.scene.control.Button;
313
+
importjavafx.scene.control.Label;
314
+
importjavafx.scene.layout.BorderPane;
315
+
importjavafx.scene.layout.HBox;
316
+
importjavafx.scene.layout.StackPane;
317
+
importjavafx.stage.Stage;
318
+
319
+
publicclassExampleApplicationextendsApplication {
320
+
321
+
@Override
322
+
publicvoidstart(Stagewindow) throwsException {
323
+
324
+
// 1. Create main layout
325
+
BorderPane layout =newBorderPane();
326
+
327
+
// 1.1. Create menu for main layout
328
+
HBox menu =newHBox();
329
+
menu.setPadding(newInsets(20, 20, 20, 20));
330
+
menu.setSpacing(10);
331
+
332
+
// 1.2. Create buttons for menu
333
+
Button first =newButton("First");
334
+
Button second =newButton("Second");
335
+
336
+
// 1.3. Add buttons to menu
337
+
menu.getChildren().addAll(first, second);
338
+
339
+
layout.setTop(menu);
340
+
341
+
342
+
// 2. Add subviews and add them to the menu buttons
@@ -359,9 +435,13 @@ public interface PersonWarehouse {
359
435
360
436
When implementing a user interface a good starting point is drawing the interface followed bt adding appropriate user interface components to the user interface. When saving persons to a database we need a field for name, a field for social security number and a button for adding the person. In addition we'll also create
361
437
438
+
<!--
362
439
Käytetään käyttöliittymän asetteluun `GridPane`-asettelijaa. Rivejä käyttöliittymässä on 3, sarakkeita 2. Lisätään tapahtumien käsittelytoiminnallisuus myöhemmin. Käyttöliittymän alustusmetodi näyttää seuraavalta.
440
+
-->
363
441
442
+
Lets use `GridPane` class for the layout. There are 3 rows and 2 columns in the user interface. We'll add the event handling later. The initialization method is as follows:
364
443
444
+
<!--
365
445
```java
366
446
@Override
367
447
public void start(Stage ikkuna) {
@@ -391,13 +471,50 @@ public void start(Stage ikkuna) {
0 commit comments