Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.35 KB | None | 0 0
  1. //Main
  2. package Queuefx;
  3.  
  4. import javafx.application.Application;
  5. import javafx.fxml.FXMLLoader;
  6. import javafx.scene.Scene;
  7. import javafx.scene.layout.AnchorPane;
  8. import javafx.stage.Stage;
  9.  
  10. import java.io.IOException;
  11.  
  12. public class Main extends Application {
  13.  
  14.     Stage stage;
  15.     @Override
  16.     public void start(Stage primaryStage) throws Exception{
  17.         this.stage=primaryStage;
  18.         StartQueue();
  19.     }
  20.  
  21.     public void StartQueue(){
  22.         try {
  23.         FXMLLoader loader = new FXMLLoader(Main.class.getResource("../fxmls/ui.fxml"));
  24.         AnchorPane pane = loader.load();
  25.         Scene scene = new Scene(pane);
  26.         stage.setTitle("Login");
  27.         stage.setResizable(false);
  28.  
  29.         stage.setScene(scene);
  30.         stage.show();
  31.         } catch (
  32.     IOException e){
  33.         e.printStackTrace();
  34.     }
  35.  
  36.  
  37.     }
  38.  
  39.     public static void main(String[] args) {
  40.         launch(args);
  41.     }
  42. }
  43.  
  44. //QueueController
  45. package Queuefx;
  46.  
  47.  
  48. import javafx.animation.Animation;
  49. import javafx.animation.KeyFrame;
  50. import javafx.animation.Timeline;
  51. import javafx.beans.property.StringProperty;
  52. import javafx.event.ActionEvent;
  53. import javafx.fxml.FXML;
  54. import javafx.fxml.FXMLLoader;
  55. import javafx.fxml.Initializable;
  56. import javafx.scene.Node;
  57. import javafx.scene.Parent;
  58. import javafx.scene.Scene;
  59. import javafx.scene.control.Button;
  60. import javafx.scene.control.Label;
  61. import javafx.scene.layout.Pane;
  62. import javafx.stage.Stage;
  63. import javafx.util.Duration;
  64.  
  65. import java.io.IOException;
  66. import java.net.URL;
  67. import java.text.DateFormat;
  68. import java.text.SimpleDateFormat;
  69. import java.time.LocalDateTime;
  70. import java.util.Calendar;
  71. import java.util.Date;
  72. import java.util.ResourceBundle;
  73. import java.util.logging.Level;
  74. import java.util.logging.Logger;
  75.  
  76. public class Queuecontroller implements Initializable{
  77.     int count;
  78.     String sum;
  79.  
  80.  
  81.     @FXML
  82.     private Button Reset;
  83.  
  84.     @FXML
  85.     private Button Next;
  86.  
  87.     @FXML
  88.     private Button previous;
  89.  
  90.     @FXML
  91.     private Button back;
  92.  
  93.     @FXML
  94.     public static Label counter;
  95.  
  96.     @FXML
  97.     public void handleNext(ActionEvent event) throws IOException {
  98.  
  99.     }
  100.  
  101.     @FXML
  102.     public void handlePrevious(ActionEvent event) throws IOException {
  103.  
  104.     }
  105.  
  106.     @FXML
  107.     public void handleReset(ActionEvent event) throws IOException {
  108.  
  109.     }
  110.  
  111.     @FXML
  112.     public void handleback(ActionEvent event) throws IOException {
  113.         Parent quel = FXMLLoader.load(getClass().getResource("/fxmls/dash.fxml"));
  114.         Scene disp = new Scene(quel);
  115.         Stage win1 = (Stage) ((Node) event.getSource()).getScene().getWindow();
  116.         win1.setResizable(false);
  117.         win1.setScene(disp);
  118.         win1.show();
  119.     }
  120.  
  121.  
  122.  
  123.     @Override
  124.     public void initialize(URL location, ResourceBundle resources) {
  125.  
  126.     }
  127. }
  128.  
  129. //Display Controller
  130.  
  131. package Queuefx;
  132.  
  133.  
  134. import javafx.animation.Animation;
  135. import javafx.animation.KeyFrame;
  136. import javafx.animation.Timeline;
  137. import javafx.fxml.FXML;
  138. import javafx.fxml.Initializable;
  139. import javafx.scene.control.Label;
  140. import javafx.util.Duration;
  141. import java.net.URL;
  142. import java.text.DateFormat;
  143. import java.text.SimpleDateFormat;
  144. import java.time.LocalDateTime;
  145. import java.util.Calendar;
  146. import java.util.Date;
  147. import java.util.ResourceBundle;
  148.  
  149. public class Displaycontroller  {
  150.  
  151.     private int minutes;
  152.     private int hours;
  153.     private int seconds;
  154.     Date d = new Date();
  155.  
  156.     @FXML
  157.     public static Label counterr;
  158.  
  159.     @FXML
  160.     private Label time;
  161.  
  162.     @FXML
  163.     private Label date;
  164.  
  165.     @FXML
  166.     public void initialize() {
  167.         DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss a");
  168.         DateFormat aFormat = new SimpleDateFormat("MM-d-yyyy");
  169.         Calendar cal = Calendar.getInstance();
  170.         Timeline clock = new Timeline(new KeyFrame(Duration.ZERO, e -> {
  171.             seconds = LocalDateTime.now().getSecond();
  172.             minutes = LocalDateTime.now().getMinute();
  173.             hours = LocalDateTime.now().getHour();
  174.             date.setText(aFormat.format(d));
  175.             time.setText(hours + ":" + (minutes) + ":" + seconds);
  176.         }),
  177.                 new KeyFrame(Duration.seconds(1))
  178.         );
  179.         clock.setCycleCount(Animation.INDEFINITE);
  180.         clock.play();
  181.     }
  182.  
  183.     public void sets(String a){
  184.         counterr.setText(a);
  185.     }
  186.  
  187.  
  188. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement