Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *@author Ariel Carraro
- *@date 3 de enero de 2013
- *@description Ventana en JavaFX
- */
- package sample;
- import javafx.application.Application;
- import javafx.fxml.FXMLLoader;
- import javafx.scene.Parent;
- import javafx.scene.Scene;
- import javafx.scene.control.Tooltip;
- import javafx.stage.Stage;
- import javafx.event.Event;
- import javafx.event.ActionEvent;
- import javafx.event.EventHandler;
- import javafx.scene.control.Button;
- import javafx.scene.layout.StackPane;
- import javafx.scene.paint.Color;
- import javax.swing.*;
- public class Main extends Application {
- private Button boton;
- private StackPane panel;
- @Override
- public void start(Stage primaryStage) throws Exception{
- Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
- panel = new StackPane();
- boton = new Button("Activa");
- boton.setVisible(true);
- boton.setOnAction(new EventHandler<ActionEvent>() {
- public void handle(ActionEvent event) {
- javax.swing.JOptionPane.showMessageDialog(null,"Hola mundo");
- }
- });
- panel.getChildren().add(boton);
- Scene escena = new Scene(panel, 250, 150, Color.BLACK);
- primaryStage.setTitle("Iniciando con Java FX");
- primaryStage.setScene(new Scene(root, 300, 275));
- primaryStage.setScene(escena);
- primaryStage.show();
- }
- public static void main(String[] args) {
- launch(args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement