From ec5888cae2e0651f4de708154106c729a1179966 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Fri, 11 Dec 2020 06:31:38 +0300 Subject: [PATCH] Prevent exit on (x) ViewBuses and del fx test --- src/GUI_ViewBuses.java | 1 - src/testfx.java | 104 ----------------------------------------- 2 files changed, 105 deletions(-) delete mode 100644 src/testfx.java diff --git a/src/GUI_ViewBuses.java b/src/GUI_ViewBuses.java index ecfd38f..b580ed1 100644 --- a/src/GUI_ViewBuses.java +++ b/src/GUI_ViewBuses.java @@ -90,7 +90,6 @@ public class GUI_ViewBuses { frame.getContentPane().setBackground(new Color(70, 70, 70)); frame.getContentPane().setForeground(new Color(0, 0, 0)); frame.setBounds(100,100,814,454); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); frame.setLocationRelativeTo(null); frame.getContentPane().add(scrollPane); diff --git a/src/testfx.java b/src/testfx.java deleted file mode 100644 index 0e35223..0000000 --- a/src/testfx.java +++ /dev/null @@ -1,104 +0,0 @@ -import javafx.application.Application; -import javafx.beans.property.SimpleStringProperty; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.geometry.Pos; -import javafx.scene.Group; -import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.Label; -import javafx.scene.control.TableColumn; -import javafx.scene.control.TableView; -import javafx.scene.control.TextField; -import javafx.scene.control.cell.PropertyValueFactory; -import javafx.scene.layout.HBox; -import javafx.scene.layout.StackPane; -import javafx.scene.layout.VBox; -import javafx.scene.paint.Color; -import javafx.scene.text.Font; -import javafx.stage.Stage; - -public class testfx extends Application { - - private TableView table = new TableView(); - Stage window; - private Button btVeiwBuses = new Button("View Buses"); - private Button btViewStreets = new Button("View Streets"); - private Button btViewCampaigns = new Button("View Campaigns"); - private Button btViewRoutes= new Button("View Routes"); - private Button btPrintReport = new Button("Print Report"); - private Button btExit = new Button("Exit"); - - @Override - public void start(Stage primarystage) { - window = primarystage; - - //table title - Label Text = new Label("Streets Report"); - Text.setFont(new Font("Arial", 16)); - Text.setTextFill(Color.WHITE); - - //table - table.setEditable(true); - TableColumn streetName = new TableColumn("Street Name"); - streetName.setPrefWidth(150); - streetName.setStyle("-fx-base: SILVER"); - TableColumn StreetLoad = new TableColumn("Street Load"); - StreetLoad.setPrefWidth(150); - StreetLoad.setStyle("-fx-base: SILVER"); - TableColumn Total = new TableColumn("Total"); - Total.setPrefWidth(100); - Total.setStyle("-fx-base: SILVER"); - TableColumn Buses = new TableColumn("Buses"); - Buses.setStyle("-fx-base: SILVER"); - TableColumn localVehicles = new TableColumn("Local Vehicles"); - localVehicles.setStyle("-fx-base: SILVER"); - localVehicles.setPrefWidth(150); - TableColumn avgTime = new TableColumn("Avg. Time"); - avgTime.setStyle("-fx-base: SILVER"); - avgTime.setPrefWidth(150); - table.getColumns().addAll(streetName, StreetLoad, Total,Buses,localVehicles,avgTime); - - //table root - VBox root1 = new VBox(); - root1.setSpacing(5); - root1.setPadding(new Insets(13, 14, 15, 17)); - root1.getChildren().addAll(Text, table); - root1.setAlignment(Pos.CENTER); - root1.setStyle("-fx-base: SILVER"); - - //buttons - HBox root2 = new HBox(); - root2.getChildren().addAll(btVeiwBuses, btViewStreets, btViewCampaigns, - btViewRoutes, btPrintReport, btExit); - root2.setSpacing(5); - root2.setPadding(new Insets(13, 14, 15, 17)); - root2.setAlignment(Pos.CENTER); - root2.setStyle("-fx-base: SILVER"); - - //All Elements - VBox root3 = new VBox(); - root3.setSpacing(5); - root3.setPadding(new Insets(13, 14, 15, 17)); - root3.getChildren().addAll(root1, root2); - root3.setAlignment(Pos.CENTER); - //widnow - StackPane pane = new StackPane(root3); - - pane.setStyle("-fx-background-color: BLACK; " - + "-fx-padding: 5; -fx-font-size: 14;"); - - Scene scene = new Scene(pane,850,550); - window.setTitle("Hajj Simulation"); - window.setScene(scene); - window.show(); - - } - - public static void main(String[] args) { - launch(args); - } -} \ No newline at end of file