Skip to content

Commit 859bae7

Browse files
committed
Switched to Java Fx 16
1 parent ba93923 commit 859bae7

File tree

3 files changed

+60
-8
lines changed

3 files changed

+60
-8
lines changed

.idea/libraries/lib.xml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MajorProject.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<orderEntry type="inheritedJdk" />
99
<orderEntry type="sourceFolder" forTests="false" />
1010
<orderEntry type="library" name="com.fazecast:jSerialComm:2.6.2" level="project" />
11-
<orderEntry type="library" name="lib" level="project" />
1211
<orderEntry type="library" name="net.aksingh:owm-japis:2.5.3.0" level="project" />
12+
<orderEntry type="library" name="lib" level="project" />
1313
</component>
1414
</module>

src/sample/Main.java

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44
import javafx.fxml.FXMLLoader;
55
import javafx.scene.Parent;
66
import javafx.scene.Scene;
7+
import javafx.scene.control.Button;
8+
import javafx.scene.control.Hyperlink;
79
import javafx.scene.layout.BorderPane;
10+
import javafx.scene.layout.HBox;
11+
import javafx.scene.layout.VBox;
12+
import javafx.scene.text.Font;
13+
import javafx.scene.text.FontWeight;
14+
import javafx.scene.text.Text;
815
import javafx.stage.Stage;
916
import net.aksingh.owmjapis.api.APIException;
1017
import sample.SerialPortService;
@@ -39,6 +46,47 @@ public static void main(String[] args) {
3946
launch(args);
4047
}
4148

49+
public HBox addHBox(){
50+
HBox hbox = new HBox();
51+
hbox.setPadding(new Insets(15,12,15,12));
52+
hbox.setSpacing(10);
53+
hbox.setStyle("-fx-background-color: #336699;");
54+
55+
Button buttonCurrent = new Button("Outdoor Temperature");
56+
buttonCurrent.setPrefSize(100,20);
57+
58+
Button buttonProjected = new Button("Indoor Temperature");
59+
buttonProjected.setPrefSize(100,20);
60+
hbox.getChildren().addAll(buttonCurrent,buttonProjected);
61+
62+
return hbox;
63+
}
64+
65+
public VBox addVBox(){
66+
VBox vbox = new VBox();
67+
vbox.setPadding(new Insets(10));
68+
vbox.setSpacing(8);
69+
70+
Text title = new Text("Data");
71+
title.setFont(Font.font("Arial", FontWeight.BOLD,14));
72+
vbox.getChildren().add(title);
73+
74+
Hyperlink options[] = new Hyperlink[] {
75+
new Hyperlink("Sales"),
76+
new Hyperlink("Marketing"),
77+
new Hyperlink("Distribution"),
78+
new Hyperlink("Costs")};
79+
80+
for (int i=0; i<4; i++) {
81+
VBox.setMargin(options[i], new Insets(0, 0, 0, 8));
82+
vbox.getChildren().add(options[i]);
83+
}
84+
85+
return vbox;
86+
}
87+
88+
89+
4290
@Override
4391
public void start(Stage primaryStage) {
4492
/*var sp = SerialPortService.getSerialPort("COM3");
@@ -80,8 +128,12 @@ public void start(Stage primaryStage) {
80128
CountdownHandler part, timer for CountdownHandler
81129
*/
82130

131+
// Here we are testing the Borderpane layout
83132
var pane = new BorderPane();
84133
var label = new Label();
134+
HBox hbox = addHBox();
135+
pane.setTop(hbox);
136+
pane.setCenter(addVBox());
85137

86138
// Getting temperature data from the OpenWeather API class
87139
try {
@@ -97,11 +149,11 @@ public void start(Stage primaryStage) {
97149

98150
//label.setText(name);
99151

100-
pane.setCenter(label);
101-
pane.setPadding(new Insets(0, 20, 0, 20));
152+
//pane.setCenter(label);
153+
//pane.setPadding(new Insets(0, 20, 0, 20));
102154
//pane.setStyle("")
103155

104-
var scene = new Scene(pane, 400, 200);
156+
var scene = new Scene(pane, 400, 400);
105157

106158
primaryStage.setScene(scene);
107159
primaryStage.show();

0 commit comments

Comments
 (0)