use of javafx.scene.layout.AnchorPane in project Gargoyle by callakrsos.
the class AbsoltePointFocusExam method start.
@Override
public void start(Stage stage) throws Exception {
// 포커스
ScrollPane scrPane = new ScrollPane();
scrPane.setPrefWidth(ScrollPane.USE_COMPUTED_SIZE);
BorderPane borderPane = new BorderPane(scrPane);
Scene scene = new Scene(borderPane, Color.LINEN);
VBox vbox = new VBox();
VBox.setVgrow(vbox, Priority.ALWAYS);
vbox.setPrefWidth(VBox.USE_PREF_SIZE);
vbox.setPrefHeight(VBox.USE_COMPUTED_SIZE);
for (int i = 0; i < 20; i++) {
AnchorPane ancPane = new AnchorPane();
AnchorPane ancPane2 = new AnchorPane();
ancPane2.setLayoutY(500);
TextField text1 = new TextField();
TextField text2 = new TextField();
text2.setLayoutY(800);
Button btn = new Button("Focus" + i);
btn.setOnMouseClicked(event -> {
text2.requestFocus();
double absolteY = FxUtil.getAbsolteY(vbox, text2) + text2.getHeight();
scrPane.setVvalue((absolteY / vbox.getHeight()));
});
btn.setLayoutX(150);
ancPane2.getChildren().add(text2);
ancPane.getChildren().addAll(text1, btn, ancPane2);
vbox.getChildren().add(ancPane);
}
scrPane.setContent(vbox);
stage.setWidth(700);
stage.setHeight(400);
Label status = new Label();
borderPane.setBottom(status);
vbox.addEventFilter(MouseEvent.ANY, event -> {
status.textProperty().set(String.format(" x: %s y : %s scene x : %s scene y : %s screen x :%s screen y : %s", event.getX(), event.getY(), event.getSceneX(), event.getSceneY(), event.getScreenX(), event.getScreenY()));
});
stage.setScene(scene);
stage.show();
}
use of javafx.scene.layout.AnchorPane in project trex-stateless-gui by cisco-system-traffic-generator.
the class UIBaseTest method start.
@Override
public void start(Stage stage) throws Exception {
TrexApp.setPrimaryStage(stage);
AnchorPane page = (AnchorPane) FXMLLoader.load(getClass().getResource("/fxml/MainView.fxml"));
Scene scene = new Scene(page);
scene.getStylesheets().add(TrexApp.class.getResource("/styles/mainStyle.css").toExternalForm());
stage.setScene(scene);
stage.setTitle("TRex");
stage.setResizable(true);
stage.setMinWidth(1100);
stage.setMinHeight(670);
stage.show();
}
use of javafx.scene.layout.AnchorPane in project trex-stateless-gui by cisco-system-traffic-generator.
the class AbstractProtocolView method buildUI.
private void buildUI() {
container = new AnchorPane();
buildCustomProtocolView();
setContent(container);
if (dataBinding != null) {
bindProperties();
}
addInputValidation();
}
use of javafx.scene.layout.AnchorPane in project trex-stateless-gui by cisco-system-traffic-generator.
the class EthernetProtocolView method buildCustomProtocolView.
/**
* Build custom view
*/
@Override
protected void buildCustomProtocolView() {
AnchorPane container = new AnchorPane();
type = new CheckBox("Ethernet Type");
addCheckBox(type, 20, 10);
typeField = new TextField();
addInput(typeField, 20, 165, 220);
typeField.disableProperty().bind(type.selectedProperty().not());
setContent(container);
}
use of javafx.scene.layout.AnchorPane in project trex-stateless-gui by cisco-system-traffic-generator.
the class MultiplierView method buildUI.
/**
* Build UI
*/
private void buildUI() {
// add slider area
addLabel("Bandwidth", 7, 336);
addLabel("0", 22, 287);
addLabel("100", 22, 454);
slider = new Slider(0, 100, 1);
slider.setDisable(true);
getChildren().add(slider);
MultiplierView.setTopAnchor(slider, 22d);
MultiplierView.setLeftAnchor(slider, 304d);
slider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
// check min value for slider
if ((double) newValue < MultiplierType.percentage.getMinRate(rate)) {
slider.setValue(MultiplierType.percentage.getMinRate(rate));
}
updateOptionsValues(slider.getValue(), updateAll);
if (fireUpdateCommand) {
optionValueChangeHandler.optionValueChanged();
}
}
});
// add separator
Separator separator = new Separator(Orientation.HORIZONTAL);
separator.setPrefHeight(1);
getChildren().add(separator);
MultiplierView.setTopAnchor(separator, 50d);
MultiplierView.setLeftAnchor(separator, 15d);
MultiplierView.setRightAnchor(separator, 15d);
group = new ToggleGroup();
int index = 0;
double prevComponentWidth = 0;
AnchorPane optionContainer = new AnchorPane();
getChildren().add(optionContainer);
MultiplierView.setTopAnchor(optionContainer, 51d);
MultiplierView.setLeftAnchor(optionContainer, 15d);
MultiplierView.setRightAnchor(optionContainer, 150d);
for (MultiplierType type : MultiplierType.values()) {
MultiplierOption option = new MultiplierOption(type.getTitle(), group, type, this);
option.setMultiplierSelectionEvent(this);
optionContainer.getChildren().add(option);
double leftSpace = prevComponentWidth + (index * 15);
MultiplierView.setLeftAnchor(option, leftSpace);
MultiplierView.setTopAnchor(option, 0d);
MultiplierView.setBottomAnchor(option, 0d);
multiplierOptionMap.put(type, option);
index++;
prevComponentWidth += option.getComponentWidth();
}
multiplierOptionMap.get(MultiplierType.pps).setSelected();
// add suration
Separator vSeparator = new Separator(Orientation.VERTICAL);
vSeparator.setPrefWidth(1);
getChildren().add(vSeparator);
MultiplierView.setTopAnchor(vSeparator, 93d);
MultiplierView.setLeftAnchor(vSeparator, 560d);
MultiplierView.setBottomAnchor(vSeparator, 15d);
addLabel("Duration", 70, 606);
durationCB = new CheckBox();
getChildren().add(durationCB);
MultiplierView.setTopAnchor(durationCB, 94d);
MultiplierView.setLeftAnchor(durationCB, 581d);
MultiplierView.setBottomAnchor(durationCB, 20d);
durationTF = new TextField("0");
durationTF.setPrefSize(70, 22);
durationTF.setDisable(true);
getChildren().add(durationTF);
MultiplierView.setTopAnchor(durationTF, 93d);
MultiplierView.setLeftAnchor(durationTF, 606d);
MultiplierView.setBottomAnchor(durationTF, 15d);
durationTF.disableProperty().bind(durationCB.selectedProperty().not());
durationTF.setTextFormatter(Util.getNumberFilter(4));
}
Aggregations