本文整理汇总了Java中javafx.scene.image.ImageView.setPickOnBounds方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setPickOnBounds方法的具体用法?Java ImageView.setPickOnBounds怎么用?Java ImageView.setPickOnBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.image.ImageView
的用法示例。
在下文中一共展示了ImageView.setPickOnBounds方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createIv
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private ImageView createIv(double x, double y) {
ImageView iv = new ImageView();
iv.setImage(image);
iv.setSmooth(true);
iv.setPickOnBounds(true);
iv.setCache(true);
iv.setX(x);
iv.setY(y);
iv.setCursor(Cursor.HAND);
iv.setOnMouseDragged((t) -> {
ImageView i = (ImageView) (t.getSource());
i.setX(t.getSceneX()-size/2);
i.setY(t.getSceneY()-size/2);
});
iv.setOnMouseReleased((t) -> {
double newX = t.getSceneX();
double newY = t.getSceneY();
if(zones.isInZone(newX, newY, type)) {
iv.setVisible(false);
}
});
return iv;
}
示例2: handlePortrait
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
private void handlePortrait(ActionEvent event) {
final Stage infoStage = new Stage();
GridPane infoPane = new GridPane();
infoPane.setPadding(new Insets(20, 20, 20, 20));
infoPane.setHgap(25);
infoPane.setVgap(25);
infoPane.setAlignment(Pos.CENTER);
ImageView portait = new ImageView(new Image(Main.class.getResourceAsStream("Resources/wdhpor.png")));
portait.setFitWidth(200);
portait.setFitHeight(200);
portait.setPreserveRatio(true);
portait.setPickOnBounds(true);
infoPane.add(portait, 0, 0, 3, 3);
Label nickNameLabel = new Label("昵称");
Label nickNameInfo = new Label("xx");
infoPane.add(nickNameLabel, 0, 3);
infoPane.add(nickNameInfo, 1, 3);
Label IDlabel = new Label("ID");
Label IDinfo = new Label("xx");
infoPane.add(IDlabel, 0, 4);
infoPane.add(IDinfo, 1, 4);
Label accumulateTimeLabel = new Label("积累算时");
Label accumuateTimeInfo = new Label("xx");
infoPane.add(accumulateTimeLabel, 0, 5);
infoPane.add(accumuateTimeInfo, 1, 5);
Scene scene = new Scene(infoPane,Main.screenWidth /5 , Main.screenHeight/2);
scene.getStylesheets().add(Main.class.getResource("base.css").toExternalForm());
infoStage.setScene(scene);
infoStage.setFullScreen(false);
infoStage.setResizable(false);
infoStage.show();
}
示例3: PatientCardPrescription
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public PatientCardPrescription(Patient patient) {
imageView = new ImageView();
vBox = new VBox();
label = new Label();
label0 = new Label();
label1 = new Label();
setAlignment(javafx.geometry.Pos.CENTER);
setSpacing(5.0);
getStylesheets().add("/view/prescription/../../css/main.css");
imageView.setFitHeight(108.0);
imageView.setFitWidth(93.0);
imageView.setPickOnBounds(true);
imageView.setPreserveRatio(true);
showImage(patient);
vBox.setAlignment(javafx.geometry.Pos.CENTER_LEFT);
label.setText(patient.getName());
label0.setText("Age : " + age(patient) + " Years");
String sex = patient.getSex() == 1 ? "Male" : patient.getSex() == 2 ? "Fe-Male" : "Other";
label1.setText("Sex : " + sex);
vBox.setPadding(new Insets(0.0, 10.0, 0.0, 5.0));
getChildren().add(imageView);
vBox.getChildren().add(label);
vBox.getChildren().add(label0);
vBox.getChildren().add(label1);
getChildren().add(vBox);
}
示例4: AudioItem
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public AudioItem() {
super();
super.setPrefHeight(80.0);
super.setPrefWidth(661.0);
final ImageView imageViewPlayButton = new ImageView(IMAGE_PLAY);
imageViewPlayButton.setFitHeight(50.0);
imageViewPlayButton.setFitWidth(50.0);
imageViewPlayButton.setPreserveRatio(true);
imageViewPlayButton.setPickOnBounds(true);
final ImageView imageViewStopButton = new ImageView(IMAGE_STOP);
imageViewStopButton.setFitHeight(50.0);
imageViewStopButton.setFitWidth(50.0);
imageViewStopButton.setPreserveRatio(true);
imageViewStopButton.setPickOnBounds(true);
play.setLayoutX(14.0);
play.setLayoutY(8.0);
play.setPrefHeight(64.0);
play.setPrefWidth(64.0);
play.setMnemonicParsing(false);
play.setGraphic(imageViewPlayButton);
play.setShape(new Circle(RADIUS_IMAGE_VIEW_BUTTON));
label_for_name.setLayoutX(84.0);
label_for_name.setLayoutY(14.0);
label_for_name.setPrefWidth(493.0);
slider.setLayoutX(78.0);
slider.setLayoutY(33.0);
slider.setPrefWidth(504.0);
slider.setPrefHeight(14.0);
label_for_time.setLayoutX(302.0);
label_for_time.setLayoutY(47.0);
label_for_time.setPrefHeight(25.0);
label_for_time.setPrefWidth(57.0);
stop.setLayoutX(584.0);
stop.setLayoutY(8.0);
stop.setPrefHeight(64.0);
stop.setPrefWidth(64.0);
stop.setMnemonicParsing(false);
stop.setGraphic(imageViewStopButton);
stop.setShape(new Circle(RADIUS_IMAGE_VIEW_BUTTON));
this.getChildren().addAll(play, stop, label_for_name, label_for_time, slider);
}