document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import javafx.application.Application;
  2. import javafx.scene.Scene;
  3. import javafx.scene.control.Label;
  4. import javafx.scene.image.Image;
  5. import javafx.scene.layout.StackPane;
  6. import javafx.stage.Stage;
  7.  
  8.  
  9. public class Icon extends Application{
  10.    
  11.      public static void main(String[] args) {
  12.             Application.launch(args);
  13.       }
  14.    
  15.     @Override
  16.     public void start(Stage stage) throws Exception {
  17.         // TODO Auto-generated method stub
  18.        
  19.         //Set title
  20.         stage.setTitle("JavaFX Icon Tutorial");
  21.        
  22.         Image image = new Image("icon.png");
  23.         stage.getIcons().add(image);
  24.        
  25.         //Layout
  26.         StackPane sp = new StackPane();
  27.        
  28.         //Message
  29.         Label lbl = new Label("JavaFX 2 Icon Tutorial");
  30.         sp.getChildren().add(lbl);
  31.        
  32.        
  33.         //Adding Layout to the scene
  34.         Scene scene = new Scene(sp,300,200);
  35.         stage.setScene(scene);
  36.         stage.show();
  37.     }
  38.    
  39. }
');