javafx.scene.image.ImageView.setOnMouseReleased()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中javafx.scene.image.ImageView.setOnMouseReleased()方法的一些代码示例,展示了ImageView.setOnMouseReleased()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.setOnMouseReleased()方法的具体详情如下:
包路径:javafx.scene.image.ImageView
类名称:ImageView
方法名:setOnMouseReleased

ImageView.setOnMouseReleased介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;

public class ImageButton extends Button {

  public void updateImages(final Image selected, final Image unselected) {
    final ImageView iv = new ImageView(selected);
    this.getChildren().add(iv);

    iv.setOnMousePressed(new EventHandler<MouseEvent>() {
      public void handle(MouseEvent evt) {
        iv.setImage(unselected);
      }
    });
    iv.setOnMouseReleased(new EventHandler<MouseEvent>() {
      public void handle(MouseEvent evt) {
        iv.setImage(selected);
      }
    });

    super.setGraphic(iv);
  }
}

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

ImageView imgView = new ImageView(img);
imgView.setId("minusIcon");
imgView.setOnMouseReleased((e) -> {
  int value = Integer.parseInt(input.getText());
  moneyTranfer.setAmount(Math.max(value - moneyTranfer.getStepSize(), 0));
imgView.setOnMouseReleased((e) -> {
  int value = Integer.parseInt(input.getText());
  moneyTranfer.setAmount(Math.min(value + moneyTranfer.getStepSize(), moneyTranfer.getMaxTransfereable()));

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

ImageView plusIcon = new ImageView(img);
plusIcon.setId("plusIcon");
plusIcon.setOnMouseReleased((e) -> {
  int newValue = Math.min(cityWall.getRequiredBricks(), numberOfBricks.get() + 1);
  final int amount = city.getCity().getWare(EWare.BRICK).getAmount();
ImageView minusIcon = new ImageView(img);
minusIcon.setId("minusIcon");
minusIcon.setOnMouseReleased((e) -> {
  int newValue = Math.max(0, numberOfBricks.get() - 1);
  newValue = Math.min(newValue, city.getCity().getWare(EWare.BRICK).getAmount());

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

input.setId("headTaxLabel");
input.setText(String.valueOf(cityHallAccessor.getCityHall(city.getCity()).getTreasury().getCurrentHeadTaxValue()));
imgView.setOnMouseReleased((e) -> {
  double value = Double.parseDouble(input.getText());
  input.setText(String.valueOf(Math.max(value - 0.5, 0)));
imgView = new ImageView(img);
imgView.setId("plusIcon");
imgView.setOnMouseReleased((e) -> {
  double value = Double.parseDouble(input.getText());
  input.setText(String.valueOf(value + 0.5));
input.setId("specialTaxLabel");
input.setText("0");
imgView.setOnMouseReleased((e) -> {
  int value = Integer.parseInt(input.getText());
  input.setText(String.valueOf(Math.max(value - 5000, 0)));
imgView = new ImageView(img);
imgView.setId("plusIcon");
imgView.setOnMouseReleased((e) -> {
  int value = Integer.parseInt(input.getText());
  input.setText(String.valueOf(value + 5000));

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

imgViewUp.setOnMouseReleased(event -> {
  if (isNumeticalOptions()) {
    selectNextInList(spinner);
imgViewDown.setOnMouseReleased(event -> {
  if (isNumeticalOptions()) {
    selectPreviousInList(spinner);

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

sideView.setLayoutX(30);
final EventHandler<? super MouseEvent> historyDisplayHandler = createHistoryDisplayHandler();
sideView.setOnMouseReleased(historyDisplayHandler);
ImageView frontView = new ImageView();
frontView.imageProperty().bind(shipFrontImageBinding());
frontView.setLayoutY(70);
frontView.setLayoutX(289);
frontView.setOnMouseReleased(historyDisplayHandler);
getContent().addAll(sideView, frontView);
Table topTable = createTopTable();

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

prioView.setId("priority"+weapon);
setPriorityImage(unchecked, checked, weapon, prioView);
prioView.setOnMouseReleased(evt -> {
  togglePrio(weapon);
  setPriorityImage(unchecked, checked, weapon, prioView);

相关文章