parent
bc312a7959
commit
f9dce36bbf
@ -0,0 +1,60 @@
|
|||||||
|
### Java template
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
### JetBrains template
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
|
||||||
|
|
||||||
|
*.iml
|
||||||
|
|
||||||
|
## Directory-based project format:
|
||||||
|
.idea/
|
||||||
|
# if you remove the above rule, at least ignore the following:
|
||||||
|
|
||||||
|
# User-specific stuff:
|
||||||
|
# .idea/workspace.xml
|
||||||
|
# .idea/tasks.xml
|
||||||
|
# .idea/dictionaries
|
||||||
|
|
||||||
|
# Sensitive or high-churn files:
|
||||||
|
# .idea/dataSources.ids
|
||||||
|
# .idea/dataSources.xml
|
||||||
|
# .idea/sqlDataSources.xml
|
||||||
|
# .idea/dynamic.xml
|
||||||
|
# .idea/uiDesigner.xml
|
||||||
|
|
||||||
|
# Gradle:
|
||||||
|
# .idea/gradle.xml
|
||||||
|
# .idea/libraries
|
||||||
|
|
||||||
|
# Mongo Explorer plugin:
|
||||||
|
# .idea/mongoSettings.xml
|
||||||
|
|
||||||
|
## File-based project format:
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
## Plugin-specific files:
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
/out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.Button?>
|
||||||
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.ListView?>
|
||||||
|
<?import javafx.scene.layout.BorderPane?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
|
||||||
|
<BorderPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="view.MainWindow">
|
||||||
|
<left>
|
||||||
|
<ListView fx:id="birdsLV"/>
|
||||||
|
</left>
|
||||||
|
<center>
|
||||||
|
<VBox prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER">
|
||||||
|
<Label fx:id="nameLbl"/>
|
||||||
|
<Label fx:id="dobLbl"/>
|
||||||
|
<Label fx:id="ageLbl"/>
|
||||||
|
<Label fx:id="colorLbl"/>
|
||||||
|
<Label fx:id="hungerLbl"/>
|
||||||
|
<Button alignment="CENTER" mnemonicParsing="false" onAction="#clickFeed" text="Feed"/>
|
||||||
|
</VBox>
|
||||||
|
</center>
|
||||||
|
<top>
|
||||||
|
<HBox prefHeight="100.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||||
|
<Label text="Today: " fx:id="dateLbl"/>
|
||||||
|
<Button mnemonicParsing="false" onAction="#clickTomorrow" text="To tomorrow"/>
|
||||||
|
</HBox>
|
||||||
|
</top>
|
||||||
|
|
||||||
|
</BorderPane>
|
@ -0,0 +1,20 @@
|
|||||||
|
package launcher;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class Launcher extends Application {
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/MainWindow.fxml")));
|
||||||
|
Scene scene = new Scene(root);
|
||||||
|
primaryStage.setScene(scene);
|
||||||
|
primaryStage.setTitle("Dah birbs");
|
||||||
|
primaryStage.show();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package model;
|
||||||
|
|
||||||
|
import javafx.beans.property.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
|
||||||
|
public class Birb {
|
||||||
|
private final StringProperty name = new SimpleStringProperty();
|
||||||
|
public StringProperty nameProperty() {return name;}
|
||||||
|
public String getName() {return name.get();}
|
||||||
|
public void setName(String name) {this.name.set(name);}
|
||||||
|
private final ObjectProperty<LocalDate> dob = new SimpleObjectProperty<>();
|
||||||
|
public ObjectProperty<LocalDate> dobProperty() {return dob;}
|
||||||
|
public LocalDate getDob() {return dob.get();}
|
||||||
|
public void setDob(LocalDate dob) {this.dob.set(dob);}
|
||||||
|
private final LongProperty age = new SimpleLongProperty();
|
||||||
|
public LongProperty ageProperty() {return age;}
|
||||||
|
public long getAge() {return age.get();}
|
||||||
|
public void setAge(LocalDate timeFromCall) {this.age.set(ChronoUnit.DAYS.between(getDob(), timeFromCall));}
|
||||||
|
|
||||||
|
private final StringProperty color = new SimpleStringProperty();
|
||||||
|
public StringProperty colorProperty() {return color;}
|
||||||
|
public String getColor() {return color.get();}
|
||||||
|
public void setColor(String color) {this.color.set(color);}
|
||||||
|
|
||||||
|
private final IntegerProperty hunger = new SimpleIntegerProperty();
|
||||||
|
public IntegerProperty hungerProperty() {return hunger;}
|
||||||
|
public int getHunger() {return hunger.get();}
|
||||||
|
public void setHunger(int hunger) {this.hunger.set(hunger);}
|
||||||
|
|
||||||
|
public Birb(String name, String color) {
|
||||||
|
this(name, LocalDate.now(), color, LocalDate.now(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Birb(String name, LocalDate dob, String color, LocalDate timeFromCall, int hunger) {
|
||||||
|
setName(name);
|
||||||
|
setDob(dob);
|
||||||
|
setColor(color);
|
||||||
|
setAge(timeFromCall);
|
||||||
|
setHunger(hunger);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package view;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.ListView;
|
||||||
|
|
||||||
|
|
||||||
|
public class MainWindow {
|
||||||
|
@FXML
|
||||||
|
private Label nameLbl;
|
||||||
|
@FXML
|
||||||
|
private ListView birdsLV;
|
||||||
|
@FXML
|
||||||
|
private Label dobLbl;
|
||||||
|
@FXML
|
||||||
|
private Label ageLbl;
|
||||||
|
@FXML
|
||||||
|
private Label colorLbl;
|
||||||
|
@FXML
|
||||||
|
private Label hungerLbl;
|
||||||
|
@FXML
|
||||||
|
private Label dateLbl;
|
||||||
|
@FXML
|
||||||
|
private void clickFeed(ActionEvent evt) {
|
||||||
|
|
||||||
|
}
|
||||||
|
@FXML
|
||||||
|
private void clickTomorrow(ActionEvent evt) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue