Skip to content

Commit

Permalink
fix bug maximize screen
Browse files Browse the repository at this point in the history
  • Loading branch information
ky0men committed Feb 13, 2022
1 parent 055debc commit 72725ed
Show file tree
Hide file tree
Showing 30 changed files with 55 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified out/production/ProjectJava15/controller/RoomViewController$1.class
Binary file not shown.
Binary file modified out/production/ProjectJava15/controller/RoomViewController.class
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
-fx-background-color: #E9E9E9;
-fx-border-width: 1;
-fx-border-color: #03506F;
/*-fx-border-color: red;*/
-fx-border-radius: 12;
}
/*TITLE PANE*/
Expand Down Expand Up @@ -43,12 +44,14 @@
/* -fx-background-color: linear-gradient(to right bottom, #070537, #003c74, #0074a6, #00afc8, #12ebd8);*/
/*}*/
.left-pane{
-fx-background-color: #E9E9E9;
/*-fx-background-color: #297bff;*/
/*-fx-background-color: #E9E9E9;*/
-fx-background-color: transparent;
-fx-background-radius: 0 0 0 10;
}
.hbox-button{
-fx-background-color: #00699C;
-fx-border-color: red;
-fx-border-width: 0;
}
.left-pane-vbox{
-fx-background-radius: 0 0 0 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<children>
<HBox fx:id="hboxHome" prefWidth="200.0" styleClass="hbox-button">
<children>
<JFXButton fx:id="roomMapBtn" alignment="TOP_LEFT" prefHeight="28.0" prefWidth="210.0" ripplerFill="#16314f" style="-fx-background-color: #E9E9E9; -fx-text-fill: #16314f; -fx-background-radius: 20 0 0 20;" text=" Room Map" textFill="WHITE">
<JFXButton fx:id="roomMapBtn" alignment="TOP_LEFT" prefHeight="28.0" prefWidth="210.0" ripplerFill="#15304d" style="-fx-background-color: #E9E9E9; -fx-text-fill: #16314f; -fx-background-radius: 20 0 0 20;" text=" Room Map" textFill="WHITE">
<graphic>
<FontIcon fx:id="roomMapIcon" iconColor="#16314f" iconLiteral="gmi-table-chart" iconSize="20" styleClass="home-btn-icon" />
</graphic>
Expand Down Expand Up @@ -242,7 +242,7 @@
</VBox>
</children>
</AnchorPane>
<AnchorPane fx:id="titleBar" layoutX="215.0" layoutY="-52.0" prefHeight="24.0" prefWidth="200.0" style="-fx-border-width: 0 0 1 0;" styleClass="title-pane" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<AnchorPane fx:id="titleBar" layoutX="215.0" layoutY="-52.0" prefHeight="24.0" prefWidth="200.0" style="-fx-border-width: 0 0 0 0;" styleClass="title-pane" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" spacing="6.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="0.0">
<children>
Expand Down Expand Up @@ -305,7 +305,7 @@
</children>
</HBox>
</children></AnchorPane>
<AnchorPane fx:id="contentPane" layoutX="463.0" layoutY="173.0" prefHeight="200.0" prefWidth="200.0" styleClass="content-pane" AnchorPane.bottomAnchor="50.0" AnchorPane.leftAnchor="250.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="34.0">
<AnchorPane fx:id="contentPane" layoutX="255.0" layoutY="39.0" prefHeight="200.0" prefWidth="200.0" styleClass="content-pane" AnchorPane.bottomAnchor="47.0" AnchorPane.leftAnchor="255.0" AnchorPane.rightAnchor="7.0" AnchorPane.topAnchor="39.0">
<effect>
<DropShadow height="15.0" offsetX="2.0" offsetY="2.0" radius="7.0" width="15.0" />
</effect>
Expand Down
10 changes: 5 additions & 5 deletions out/production/ProjectJava15/resources/views/BookingRoom.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<Font size="14.0" />
</font>
</Label>
<DatePicker editable="false" prefHeight="26.0" prefWidth="245.0">
<DatePicker fx:id="checkinDate" editable="false" prefHeight="26.0" prefWidth="245.0">
<opaqueInsets>
<Insets />
</opaqueInsets>
Expand All @@ -166,7 +166,7 @@
<Font size="14.0" />
</font>
</Label>
<JFXTextField focusColor="#00699c" prefHeight="30.0" prefWidth="200.0">
<JFXTextField fx:id="roomType" editable="false" focusColor="#00699c" prefHeight="30.0" prefWidth="206.0">
<font>
<Font size="14.0" />
</font>
Expand All @@ -186,7 +186,7 @@
<Font size="14.0" />
</font>
</Label>
<DatePicker editable="false" prefHeight="26.0" prefWidth="245.0">
<DatePicker fx:id="checkoutDate" editable="false" prefHeight="26.0" prefWidth="245.0">
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
Expand All @@ -207,7 +207,7 @@
<Font size="14.0" />
</font>
</Label>
<JFXTextField focusColor="#00699c" prefHeight="30.0" prefWidth="151.0">
<JFXTextField fx:id="prepaidField" focusColor="#00699c" prefHeight="30.0" prefWidth="151.0" text="0">
<font>
<Font size="14.0" />
</font>
Expand All @@ -232,7 +232,7 @@
<Font size="14.0" />
</font>
</Label>
<JFXTextField focusColor="#00699c" prefHeight="30.0" prefWidth="194.0">
<JFXTextField fx:id="discountField" focusColor="#00699c" prefHeight="30.0" prefWidth="194.0" text="0">
<font>
<Font size="14.0" />
</font>
Expand Down
39 changes: 36 additions & 3 deletions src/controller/AdminDashboardController.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.geometry.Rectangle2D;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
Expand All @@ -18,6 +19,7 @@
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.util.Duration;
import org.kordamp.ikonli.javafx.FontIcon;
Expand Down Expand Up @@ -167,14 +169,45 @@ public void handle(MouseEvent mouseEvent) {
}
});

//Maximize action
maximizeBtn.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
stage = (Stage) adminMainPane.getScene().getWindow();
if (stage.isMaximized()) {
stage.setMaximized(false);
Screen screen = Screen.getPrimary();
Rectangle2D bounds = screen.getVisualBounds();
if (stage.getX() == 0 && stage.getY() == 0) {
stage.setWidth(1000);
stage.setHeight(700);
stage.setX((bounds.getWidth() - stage.getWidth())/2);
stage.setY((bounds.getHeight() - stage.getHeight())/2);
} else {
stage.setMaximized(true);
stage.setX(bounds.getMinX());
stage.setY(bounds.getMinY());
stage.setWidth(bounds.getWidth());
stage.setHeight(bounds.getHeight());
}
}
});

titleBar.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
stage = (Stage) adminMainPane.getScene().getWindow();
Screen screen = Screen.getPrimary();
Rectangle2D bounds = screen.getVisualBounds();
if(mouseEvent.getClickCount() == 2){
if (stage.getX() == 0 && stage.getY() == 0) {
stage.setWidth(1000);
stage.setHeight(700);
stage.setX((bounds.getWidth() - stage.getWidth())/2);
stage.setY((bounds.getHeight() - stage.getHeight())/2);
} else {
stage.setX(bounds.getMinX());
stage.setY(bounds.getMinY());
stage.setWidth(bounds.getWidth());
stage.setHeight(bounds.getHeight());
}
}
}
});
Expand Down

0 comments on commit 72725ed

Please sign in to comment.