コード例 #1
0
  @Override
  public void initialize(URL arg0, ResourceBundle arg1) {
    // TODO Auto-generated method stub

    zyugyou.addEventHandler(MouseEvent.ANY, zyugyouHandler);
    lecture.addEventHandler(MouseEvent.ANY, lectureHandler);
    map.addEventHandler(MouseEvent.ANY, mapHandler);
    test.addEventHandler(MouseEvent.ANY, testHandler);
    bus.addEventHandler(MouseEvent.ANY, busHandler);
  }
コード例 #2
0
  @Override
  public void load() throws CannotCreatePreviewerException {

    pdf = new PdfDecoder();

    this.setPrefSize(maxSize.getWidth(), maxSize.getHeight());
    AnchorPane anchor = new AnchorPane();
    this.getChildren().add(anchor);
    anchor.setStyle("-fx-border-color: black; -fx-border-width: 1; -fx-background-color: black;");

    imageView = new ImageView();
    AnchorPane.setLeftAnchor(imageView, 0.0);
    AnchorPane.setTopAnchor(imageView, 0.0);
    AnchorPane.setRightAnchor(imageView, 1.0);
    AnchorPane.setBottomAnchor(imageView, 1.0);

    back = new Button("<");
    back.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent t) {
            showPage(pageNumber - 1);
          }
        });
    back.setPrefSize(50, 50);
    AnchorPane.setLeftAnchor(back, 3.0);
    AnchorPane.setBottomAnchor(back, 4.0);

    next = new Button(">");
    next.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent t) {
            showPage(pageNumber + 1);
          }
        });
    next.setPrefSize(50, 50);
    AnchorPane.setRightAnchor(next, 4.0);
    AnchorPane.setBottomAnchor(next, 4.0);

    // Add buttons to list
    buttonGroup = new ArrayList<Button>();
    buttonGroup.add(next);
    buttonGroup.add(back);

    // Set buttons to transparent
    setButtonOpacities(0.0);

    // Set up mouse listener & add to components
    MouseListener listener = new MouseListener();
    imageView.addEventHandler(MouseEvent.ANY, listener);
    back.addEventHandler(MouseEvent.ANY, listener);
    next.addEventHandler(MouseEvent.ANY, listener);

    // Add components
    anchor.getChildren().addAll(imageView, next, back);

    // Check parameters for file to open - if not show chooser
    openFile(new File(absoluteFilePath));
  }
コード例 #3
0
ファイル: PannelloDado.java プロジェクト: ogavb/progettoIGPE
  public PannelloDado(Integer i1, GameManagerAstratta gm) {

    media = new Media(new File(path).toURI().toString());

    this.gm = gm;

    if (i1 != 0) primo = i1.toString();
    else primo = "roll";

    setMinWidth(GridPane.USE_COMPUTED_SIZE);
    setMinHeight(GridPane.USE_COMPUTED_SIZE);
    setPrefWidth(GridPane.USE_COMPUTED_SIZE);
    setPrefHeight(GridPane.USE_COMPUTED_SIZE);
    setMaxWidth(GridPane.USE_COMPUTED_SIZE);
    setMaxHeight(GridPane.USE_COMPUTED_SIZE);

    imgDadoUno = new Image("file:dadi/" + primo + ".gif");
    imageViewUno = new ImageView(imgDadoUno);

    ColumnConstraints column1 = new ColumnConstraints();
    column1.setPercentWidth(25);
    getColumnConstraints().addAll(column1);

    add(imageViewUno, 1, 0);
    imageViewUno.setTranslateZ(-1);
    eventoDado = new DadiListener();
    imageViewUno.addEventHandler(MouseEvent.MOUSE_RELEASED, eventoDado);
  }
コード例 #4
0
ファイル: PannelloDado.java プロジェクト: ogavb/progettoIGPE
 void setPrimo(int risultato) {
   imgDadoUno = new Image("file:dadi/" + risultato + ".gif");
   imageViewUno = new ImageView(imgDadoUno);
   imageViewUno.addEventHandler(MouseEvent.MOUSE_RELEASED, eventoDado);
   imageViewUno.setTranslateZ(-1);
   this.getChildren().clear();
   add(imageViewUno, 1, 0);
 }