Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javafx.application.Application;
- import javafx.scene.Scene;
- import javafx.scene.control.Label;
- import javafx.scene.image.Image;
- import javafx.scene.layout.StackPane;
- import javafx.stage.Stage;
- public class Icon extends Application{
- public static void main(String[] args) {
- Application.launch(args);
- }
- @Override
- public void start(Stage stage) throws Exception {
- // TODO Auto-generated method stub
- //Set title
- stage.setTitle("JavaFX Icon Tutorial");
- Image image = new Image("icon.png");
- stage.getIcons().add(image);
- //Layout
- StackPane sp = new StackPane();
- //Message
- Label lbl = new Label("JavaFX 2 Icon Tutorial");
- sp.getChildren().add(lbl);
- //Adding Layout to the scene
- Scene scene = new Scene(sp,300,200);
- stage.setScene(scene);
- stage.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement