Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.41 KB | None | 0 0
  1. package OverFight;
  2.  
  3. import java.beans.EventHandler;
  4.  
  5. import fr.trxyy.launcherlib.Init;
  6. import fr.trxyy.launcherlib.LauncherConstants;
  7. import fr.trxyy.launcherlib.components.LauncherButton;
  8. import fr.trxyy.launcherlib.components.LauncherPasswordField;
  9. import fr.trxyy.launcherlib.components.LauncherTextField;
  10. import fr.trxyy.launcherlib.interfaces.IScreen;
  11. import fr.trxyy.launcherlib.interfaces.Mover;
  12. import fr.trxyy.launcherlib.utils.FontLoader;
  13. import fr.trxyy.launcherlib.utils.PropertiesSaver;
  14. import fr.trxyy.launcherlib.utils.ResourceLocation;
  15. import javafx.application.Platform;
  16. import javafx.event.ActionEvent;
  17. import javafx.event.Event;
  18. import javafx.scene.Parent;
  19. import javafx.scene.image.ImageView;
  20. import javafx.scene.layout.Pane;
  21.  
  22. public class LauncherPanel extends IScreen{
  23.  
  24. private static final LauncherConstants LaucherConstants = null;
  25. private LauncherTextField usernameField;
  26. private LauncherPasswordField passwordField;
  27. private LauncherButton loginButton;
  28. private LauncherButton settingsButton;
  29. private LauncherButton minimizeButton;
  30. private LauncherButton closeButton;
  31.  
  32. @SuppressWarnings("static-access")
  33. public Parent createContent() {
  34. Pane ContentPane = new Pane();
  35. ContentPane.setPrefSize(LauncherConstants.getWidth(), LauncherConstants.getHeight());
  36. IScreen.drawAnimatedBackground(ContentPane, "background.mp4");
  37. IScreen.drawLogo(ResourceLocation.loadImage("logo.png"), 150, 70, 600, 120, ContentPane, Mover.MOVE_ON_CLICK);
  38.  
  39. this.usernameField = new LauncherTextField(ContentPane);
  40. this.usernameField.setText(Init.getUserProps().getUsername());
  41. this.usernameField.setText(PropertiesSaver.getUsername());
  42. this.usernameField.setStyle("-fx-background-color: rgba(53,89,119,0.4); -fx-text-fill: white;");
  43. this.usernameField.setFont(FontLoader.loadFont("Roboto-Light.ttf", "Roboto Lt", 18F));
  44. this.usernameField.setPosition(LauncherConstants.getWidth() / 2 - 100, LauncherConstants.getHeight() / 2);
  45. this.usernameField.setPromptText("Pseudonyme/Email");
  46. this.usernameField.setSize(200, 35);
  47.  
  48. this.passwordField = new LauncherPasswordField(ContentPane);
  49. this.passwordField.setStyle("-fx-background-color: rgba(53,89,119,0.4); -fx-text-fill:white;");
  50. this.passwordField.setFont(FontLoader.loadFont("Roboto-Light.ttf", "Roboto Lt", 18F));
  51. this.passwordField.setPosition(LauncherConstants.getWidth() / 2 - 100, LauncherConstants.getHeight() / 2);
  52. this.passwordField.setPromptText("MDP (vide pour crack)");
  53. this.passwordField.setSize(200, 35);
  54.  
  55. this.loginButton = new LauncherButton(ContentPane);
  56. this.loginButton.setText("Se connecter");
  57. this.loginButton.setStyle("-fx-background-color: rgba(53,89,119,0.4); -fx-text-fill: white;");
  58. this.loginButton.setFont(FontLoader.loadFont("Roboto-Light.ttf", "Roboto Lt", 18F));
  59. this.loginButton.setPosition(LauncherConstants.getWidth() / 2 - 50, LauncherConstants.getHeight() / 2 + 40);
  60. this.loginButton.setSize(150, 35);
  61. this.loginButton.setAction(new EventHandler<ActionEvent>() {
  62. @Override
  63. public void handle(ActionEvent k) {
  64. trylogin(contentpane);
  65. }
  66. });
  67.  
  68. this.settingsButton = new LauncherButton(ContentPane);
  69. this.settingsButton.setSize(35, 35);
  70. this.settingsButton.setPosition(LauncherConstants.getWidth() / 2 - 100, LauncherConstants.getHeight() / 2 + 40);
  71. this.settingsButton.setInvisible();
  72. this.settingsButton.setStyle("-fx-padding: 0;");
  73. ImageView settingsIcon = new ImageView(ResourceLocation.loadImage("settings.png"));
  74. settingsIcon.setFitWidth(this.settingsButton.getPrefWidth());
  75. settingsIcon.setFitHeight(this.settingsButton.getPrefHeight());
  76. this.settingsButton.setGraphic(settingsIcon);
  77. this.settingsButton.setAction(new EventHandler<ActionEvent>() {
  78. @Override
  79. public void handle(ActionEvent k) {
  80. new OptionsScreenn();
  81. }
  82. });
  83.  
  84. this.minimizeButton = new LauncherButton(ContentPane);
  85. this.minimizeButton.setSize(38,22);
  86. this.minimizeButton.setPosition(LauncherConstants.getWidth() - 76, 0);
  87. this.minimizeButton.setInvisible();
  88. this.minimizeButton.setStyle("-fx-padding: 0;");
  89. ImageView minimizeIcon = new ImageView(ResourceLocation.loadImage("minimize.png"));
  90. minimizeIcon.setFitWidth(this.minimizeButton.getPrefWidth());
  91. minimizeIcon.setFitHeight(this.minimizeButton.getPrefHeight());
  92. this.minimizeButton.setGraphic(minimizeIcon);
  93. this.minimizeButton.setAction(new EventHandler<ActionEvent>() {
  94. @Override
  95. public void handle( ActionEvent k) {
  96. Stage Stage = (Stage)((LauncherButton)k.getSource()).getScene().getWindow();
  97. stage.setIconified(true);
  98. }
  99. });
  100.  
  101. this.closeButton = new LauncherButton(ContentPane);
  102. this.closeButton.setSize(38, 22);
  103. this.closeButton.setPosition(LaucherConstants.getWidth() -38, 0);
  104. this.closeButton.setStyle("-fx-padding: 0;");
  105. ImageView closeIcon = new ImageView(ResourceLocation.loadImage("close.png"));
  106. closeIcon.setFitWidth(this.minimizeButton.getPrefWidth());
  107. closeIcon.setFitHeight(this.minimizeButton.getPrefHeight());
  108. this.closeButton.setGraphic(closeIcon);
  109. this.closeButton.setAction(new EventHandler<ActionEvent>() {
  110. @Override
  111. public void handle( ActionEvent k ) {
  112. Platform.exit();
  113. system.exit(0);
  114.  
  115. }
  116.  
  117. });
  118. return ContentPane;
  119. }
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement