Advertisement
Guest User

Untitled

a guest
May 12th, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1.  
  2. import javafx.application.Application;
  3. import javafx.fxml.FXMLLoader;
  4. import javafx.scene.Parent;
  5. import javafx.scene.Scene;
  6. import javafx.stage.Stage;
  7.  
  8.  
  9. public class Main extends Application {
  10.  
  11.     private static Controller controller;
  12.  
  13.     @Override
  14.     public void start(Stage primaryStage) throws Exception{
  15.         FXMLLoader loader = new FXMLLoader(getClass().getResource("/sample.fxml"));
  16.         Parent root = loader.load();
  17.         controller = loader.getController();
  18.  
  19.         primaryStage.setTitle("ugly javafx");
  20.         primaryStage.setScene(new Scene(root, 350, 400));
  21.         primaryStage.show();
  22.  
  23.         doSomething();
  24.     }
  25.  
  26.     private void doSomething() {
  27.         controller.sendBtn.setText("aaa");
  28.     }
  29.  
  30.     public static void main(String[] args) {
  31.         launch(args);
  32.     }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement