A sentimental robot

UI 본문

Java

UI

GOD03219 2018. 2. 7. 11:43

import javafx.application.Application;
import javafx.stage.Stage;

public class Hello extends Application {
 @Override
 public void init() throws Exception {
  System.out.println("initiate");
 }

 @Override
 public void start(Stage arg0) throws Exception {

  System.out.println(2);
  arg0.show();
  System.out.println(3);

 }

 @Override
 public void stop() throws Exception {
  System.out.println("stop");

 }

 public static void main(String[] args) {

  System.out.println(1);
  launch(); // init()->start()->stop()
  System.out.println(4);

 }

}

 


 

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class Hello extends Application {

 @Override
 public void start(Stage arg0) throws Exception {

  VBox vbox = new VBox(); // Vertical Box
  vbox.setPrefSize(300, 300);
  
  Scene scene = new Scene(vbox);
  arg0.setScene(scene);
  arg0.setTitle("server");
  arg0.show();

 }

 public static void main(String[] args) {

  launch();

 }

}


 

package Pack01;

import javafx.scene.control.Button;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class Hello extends Application {

 @Override
 public void start(Stage arg0) throws Exception {

  VBox vbox = new VBox(); // Vertical Box
  vbox.setPrefSize(300, 300);
  
  // ---------------
  Button btn1 = new Button("코끼리1");
  btn1.setOnAction(new EventHandler<>() {

   @Override
   public void handle(ActionEvent arg0) {
    System.out.println("btn1.setonaction");

   }
  });

  Button btn2 = new Button("코끼리2");

  vbox.getChildren().addAll(btn1, btn2);

  // ---------------
  
  Scene scene = new Scene(vbox);
  arg0.setScene(scene);
  arg0.setTitle("server");
  arg0.show();

 }

 public static void main(String[] args) {

  launch();

 }

}


 

'Java' 카테고리의 다른 글

Platform.runLater( )  (0) 2018.02.07
Chatting UI  (0) 2018.02.07
진수에 대해서  (0) 2018.01.09
객체참조  (0) 2018.01.09
다운캐스팅, Downcasting  (0) 2018.01.09