本文整理汇总了Java中javafx.beans.property.SimpleIntegerProperty.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleIntegerProperty.addListener方法的具体用法?Java SimpleIntegerProperty.addListener怎么用?Java SimpleIntegerProperty.addListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.beans.property.SimpleIntegerProperty
的用法示例。
在下文中一共展示了SimpleIntegerProperty.addListener方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SequenceVisualizer
import javafx.beans.property.SimpleIntegerProperty; //导入方法依赖的package包/类
/**
* Create instance of {@link SequenceVisualizer}.
*/
public SequenceVisualizer() {
sequenceProperty = new SimpleStringProperty();
offsetProperty = new SimpleIntegerProperty();
onScreenBasesProperty = new SimpleIntegerProperty();
hoveredBaseIdProperty = new SimpleIntegerProperty(-1);
sequenceProperty.addListener((observable, oldValue, newValue) -> {
if (offsetProperty.get() == 0) {
draw(); // force redraw if offset remains unchanged.
}
offsetProperty.set(0);
});
offsetProperty.addListener((observable, oldValue, newValue) -> draw());
hoveredBaseIdProperty.addListener((observable, oldValue, newValue) -> draw());
visibleProperty = new SimpleBooleanProperty(false);
}
示例2: onDeath
import javafx.beans.property.SimpleIntegerProperty; //导入方法依赖的package包/类
@Override
public void onDeath() {
dying = true;
sprite.setImage(Config.Images.EXPLOSION);
sprite.setViewport(new Rectangle2D(0, 0, 40, 40));
SimpleIntegerProperty frameProperty = new SimpleIntegerProperty();
frameProperty.addListener((obs, old, newValue) -> {
if (newValue.intValue() > old.intValue())
sprite.setViewport(new Rectangle2D((newValue.intValue() % 5) * 40, (newValue.intValue() / 5) * 40, 40, 40));
});
Timeline t = new Timeline(new KeyFrame(Duration.seconds(1), new KeyValue(frameProperty, 24)));
t.setOnFinished(event -> {
alive = false;
});
t.play();
Config.Audio.EXPLOSION.play();
}
示例3: Powerup
import javafx.beans.property.SimpleIntegerProperty; //导入方法依赖的package包/类
public Powerup(float x, float y, PowerType type) {
super(x, y, Config.BLOCK_SIZE, Config.BLOCK_SIZE, BodyType.KINEMATIC, false);
this.type = type;
sprite = new ImageView(Config.Images.POWERUP);
sprite.setFitHeight(Config.BLOCK_SIZE);
sprite.setFitWidth(Config.BLOCK_SIZE);
sprite.setViewport(new Rectangle2D(0, 0, 81, 81));
getChildren().add(sprite);
SimpleIntegerProperty frameProperty = new SimpleIntegerProperty();
frameProperty.addListener((obs, old, newValue) -> {
if (newValue.intValue() > old.intValue())
sprite.setViewport(new Rectangle2D(newValue.intValue() * 81, (type.ordinal() + 1) * 81, 81, 81));
});
timeline = new Timeline(new KeyFrame(Duration.seconds(2), new KeyValue(frameProperty, 7)));
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.play();
}
示例4: Coin
import javafx.beans.property.SimpleIntegerProperty; //导入方法依赖的package包/类
public Coin(float x, float y) {
super(x, y, Config.BLOCK_SIZE, Config.BLOCK_SIZE, BodyType.KINEMATIC, false);
sprite = new ImageView(Config.Images.COIN);
sprite.setFitHeight(Config.BLOCK_SIZE);
sprite.setFitWidth(Config.BLOCK_SIZE);
sprite.setViewport(new Rectangle2D(0, 0, 128, 128));
getChildren().add(sprite);
SimpleIntegerProperty frameProperty = new SimpleIntegerProperty();
frameProperty.addListener((obs, old, newValue) -> {
if (newValue.intValue() > old.intValue())
sprite.setViewport(new Rectangle2D((newValue.intValue() % 8) * 128, (newValue.intValue() / 8) * 128, 128, 128));
});
timeline = new Timeline(new KeyFrame(Duration.seconds(2), new KeyValue(frameProperty, 23)));
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.play();
}
示例5: MazeView
import javafx.beans.property.SimpleIntegerProperty; //导入方法依赖的package包/类
public MazeView() {
super();
showAll = true;
selection = null;
editMode = SELECT_MODE;
showUnvisited = new SimpleBooleanProperty();
ChangeListener resize = (a, b, c) -> resize();
cellSize = new SimpleIntegerProperty();
wallThickness = new SimpleIntegerProperty();
cellSize.addListener(resize);
wallThickness.addListener(resize);
ChangeListener redraw = (a, b, c) -> redraw();
cellColor = new SimpleObjectProperty();
wallColor = new SimpleObjectProperty();
goalColor = new SimpleObjectProperty();
spriteColor = new SimpleObjectProperty();
visitedColor = new SimpleObjectProperty();
cellColor.addListener(redraw);
wallColor.addListener(redraw);
goalColor.addListener(redraw);
spriteColor.addListener(redraw);
visitedColor.addListener(redraw);
setOnMousePressed(this::handlePress);
setOnMouseReleased(this::handleRelease);
setOnMouseDragged(this::handleDrag);
setOnMouseEntered(this::mouseIn);
setOnMouseExited(this::mouseOut);
}
示例6: setObservable
import javafx.beans.property.SimpleIntegerProperty; //导入方法依赖的package包/类
protected void setObservable(SimpleIntegerProperty simpleIntProperty){
simpleIntProperty.addListener(new ChangeListener<Number>(){
@Override
public void changed(ObservableValue<? extends Number> arg0,
Number arg1,Number arg2) {
myTextBox.setText(arg2.doubleValue()+"");
}
});
}
示例7: GraphDimensionsCalculator
import javafx.beans.property.SimpleIntegerProperty; //导入方法依赖的package包/类
/**
* Create a new instance of {@link GraphDimensionsCalculator}.
*
* @param graphStore the {@link GraphStore} who's {@link org.dnacronym.hygene.parser.GfaFile} is observed
*/
@Inject
@SuppressWarnings({"PMD.AvoidInstantiatingObjectsInLoops", "squid:S1188", "squid:S3776"})
public GraphDimensionsCalculator(final GraphStore graphStore) {
observableQueryNodes = FXCollections.observableArrayList();
readOnlyObservableNodes = new ReadOnlyListWrapper<>(observableQueryNodes);
centerNodeIdProperty = new SimpleIntegerProperty(1);
radiusProperty = new SimpleIntegerProperty(DEFAULT_RADIUS);
nodeCountProperty = new SimpleIntegerProperty(1);
centerNodeIdProperty.addListener((observable, oldValue, newValue) -> {
if (newValue.intValue() < 1) {
centerNodeIdProperty.set(1);
return;
}
if (newValue.intValue() >= getNodeCountProperty().intValue() - 1) {
centerNodeIdProperty.set(nodeCountProperty.intValue() - 2);
return;
}
centerPointQuery.query(centerNodeIdProperty.get(), radiusProperty.get());
});
radiusProperty.addListener((observable, oldValue, newValue) -> {
if (centerPointQuery == null) {
return;
}
centerPointQuery.query(centerNodeIdProperty.get(), radiusProperty.get());
});
viewPointProperty = new SimpleLongProperty(2000);
viewPointProperty.addListener((observable, oldValue, newValue) -> {
if (newValue.longValue() < 0) {
viewPointProperty.set(0);
return;
}
final int sentinelId = getGraphProperty().get().getNodeArrays().length - 1;
final long sentinelEndPosition = getGraphProperty().get().getRealEndXPosition(sentinelId);
if (newValue.longValue() > sentinelEndPosition) {
viewPointProperty.set(sentinelEndPosition);
return;
}
centerNodeIdProperty.set(getGraphProperty().get().getNodeAtPosition(newValue.longValue()));
calculate(subgraph);
});
viewRadiusProperty = new SimpleIntegerProperty(1);
viewRadiusProperty.addListener((observable, oldValue, newValue) -> {
calculate(subgraph);
radiusProperty.set(((newValue.intValue() + FafospLayerer.LAYER_WIDTH - 1)
/ FafospLayerer.LAYER_WIDTH) / 2);
});
nodeHeightProperty = new SimpleDoubleProperty(1);
laneHeightProperty = new SimpleDoubleProperty(1);
laneCountProperty = new SimpleIntegerProperty(1);
graphProperty = new SimpleObjectProperty<>();
graphStore.getGfaFileProperty().addListener((observable, oldValue, newValue) -> setGraph(newValue.getGraph()));
HygeneEventBus.getInstance().register(this);
}
示例8: TimelineDiffViewerRenderer
import javafx.beans.property.SimpleIntegerProperty; //导入方法依赖的package包/类
public TimelineDiffViewerRenderer() {
nbStates = new SimpleIntegerProperty();
statesRange = new SimpleIntegerProperty();
nbDisplayableStates = new SimpleIntegerProperty();
nbDisplayableStates.bind(widthProperty().divide(UNIT));
statesRange.bind(nbStates.subtract(nbDisplayableStates));
nbDisplayableStates.addListener((v, o, n) -> {
refresh();
});
setupBox(eqBox, "Toggle identical traces", eqLines);
setupBox(substBox, "Toggle similar traces", substLines);
setupBox(inBox, "Toggle inserted traces", inLines);
setupBox(delBox, "Toggle deleted traces", delLines);
ScrollPane scrollPane = new ScrollPane(rootVBox);
scrollPane.minWidthProperty().bind(widthProperty());
scrollPane.maxWidthProperty().bind(widthProperty());
scrollPane.prefWidthProperty().bind(widthProperty());
scrollPane.setFitToWidth(true);
scrollPane.setBorder(Border.EMPTY);
VBox headerPane = new VBox();
headerPane.minWidthProperty().bind(widthProperty());
headerPane.maxWidthProperty().bind(widthProperty());
headerPane.setBackground(HEADER_BACKGROUND);
scrollPane.translateYProperty().bind(headerPane.heightProperty());
scrollPane.maxHeightProperty().bind(heightProperty().subtract(headerPane.heightProperty()));
getChildren().add(headerPane);
getChildren().add(scrollPane);
minHeightProperty().bind(headerPane.heightProperty().add(scrollPane.heightProperty()));
prefHeightProperty().bind(headerPane.heightProperty().add(scrollPane.heightProperty()));
maxHeightProperty().bind(headerPane.heightProperty().add(scrollPane.heightProperty()));
scrollBar.setVisibleAmount(1);
scrollBar.setBlockIncrement(10);
scrollBar.setMin(0);
scrollBar.disableProperty().bind(statesRange.lessThanOrEqualTo(0));
scrollBar.maxProperty().bind(statesRange);
scrollBar.valueProperty().addListener((v, o, n) -> {
if (o.intValue() != n.intValue() && n.intValue() != currentState) {
currentState = n.intValue();
refresh();
}
});
headerPane.getChildren().add(scrollBar);
headerPane.getChildren().add(line1);
headerPane.getChildren().add(line2);
setBackground(WHITE_BACKGROUND);
scrollPane.setBackground(WHITE_BACKGROUND);
rootVBox.setBackground(WHITE_BACKGROUND);
}