Package belotetime.tests

Source Code of belotetime.tests.TestDialog

package belotetime.tests;

import belotetime.core.dialog.AskBox;
import belotetime.core.dialog.InputBox;
import belotetime.core.dialog.MessageBox;
import javafx.application.Application;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;

@SuppressWarnings("rawtypes")
public class TestDialog extends Application implements EventHandler {

  private Button _messageTest, _inputTest, _askTest;
 
  @SuppressWarnings("unchecked")
  @Override
  public void start(Stage stage) throws Exception {
    stage.setTitle("Test des dialogues");
   
    Insets insets = new Insets(5, 5, 5, 5);
   
    FlowPane flow = new FlowPane(Orientation.VERTICAL);
    flow.setAlignment(Pos.CENTER);
   
    _messageTest = new Button("Message");
    _messageTest.setOnAction(this);
    FlowPane.setMargin(_messageTest, insets);
    flow.getChildren().add(_messageTest);
   
    _inputTest = new Button("Input");
    _inputTest.setOnAction(this);
    FlowPane.setMargin(_inputTest, insets);
    flow.getChildren().add(_inputTest);
   
    _askTest = new Button("Ask");
    _askTest.setOnAction(this);
    FlowPane.setMargin(_askTest, insets);
    flow.getChildren().add(_askTest);
   
    Scene scene = new Scene(flow);
    stage.setScene(scene);
    stage.show();
  }

  /**
   * @param args
   */
  public static void main(String[] args) {
    launch();
  }

  @Override
  public void handle(Event arg0) {
    if(arg0.getSource() == _messageTest){
      MessageBox.Show("Titre test", "Message test");
    }else if (arg0.getSource() == _inputTest){
      System.out.println("Saisi : \"" + InputBox.Show("Titre test", "Message test") + "\"");
    }else if (arg0.getSource() == _askTest){
      System.out.println("R�ponse : " + AskBox.Show("Titre test", "Question test"));
    }
  }

}
TOP

Related Classes of belotetime.tests.TestDialog

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.