use of javafx.scene.layout.AnchorPane in project Gargoyle by callakrsos.
the class CaptureScreenController method initialize.
@FXML
public void initialize() {
itemHandler = new CaptureItemHandler(this);
flowItems.getChildren().addAll(itemHandler.getItems());
anchorBoard = new AnchorPane();
//아이템 카운트 수를 핸들링하는 이벤트 리스너
anchorBoard.getChildren().addListener((ListChangeListener) c -> {
if (c.next()) {
if (c.wasAdded()) {
int addedSize = c.getAddedSize();
itemCount.add(addedSize);
} else if (c.wasRemoved()) {
itemCount.subtract(c.getRemovedSize());
}
}
});
spPic.setContent(anchorBoard);
anchorBoard.setOnScroll(ev -> {
if (ev.isControlDown()) {
if (ev.getDeltaY() > 0) {
scaleDeltaX.set(scaleDeltaX.get() + 0.1);
scaleDeltaY.set(scaleDeltaY.get() + 0.1);
scale.setX(scaleDeltaX.get());
scale.setY(scaleDeltaY.get());
scale.setPivotX(ev.getX());
scale.setPivotY(ev.getY());
} else {
double value = scaleDeltaX.get() - 0.1;
double value2 = scaleDeltaY.get() - 0.1;
if (value < 0)
return;
if (value2 < 0)
return;
scaleDeltaX.set(value);
scaleDeltaY.set(value2);
scale.setX(scaleDeltaX.get());
scale.setY(scaleDeltaY.get());
scale.setPivotX(ev.getX());
scale.setPivotY(ev.getY());
}
lblStatus.setText(String.format(STATUS_FORMAT, scaleDeltaX.get(), ev.getX(), ev.getY(), itemCount.get()));
}
});
anchorBoard.setOnMouseMoved(ev -> {
lblStatus.setText(String.format(STATUS_FORMAT, scaleDeltaX.get(), ev.getX(), ev.getY(), itemCount.get()));
});
}
use of javafx.scene.layout.AnchorPane in project bitsquare by bitsquare.
the class PreferencesView method initializeDisplayCurrencies.
///////////////////////////////////////////////////////////////////////////////////////////
// Initialize
///////////////////////////////////////////////////////////////////////////////////////////
private void initializeDisplayCurrencies() {
TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, 3, "Currencies in market price feed list");
GridPane.setColumnSpan(titledGroupBg, 4);
preferredTradeCurrencyComboBox = addLabelComboBox(root, gridRow, "Preferred currency:", Layout.FIRST_ROW_DISTANCE).second;
preferredTradeCurrencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
@Override
public String toString(TradeCurrency tradeCurrency) {
// http://boschista.deviantart.com/journal/Cool-ASCII-Symbols-214218618
return tradeCurrency.getDisplayPrefix() + tradeCurrency.getNameAndCode();
}
@Override
public TradeCurrency fromString(String s) {
return null;
}
});
Tuple2<Label, ListView> fiatTuple = addLabelListView(root, ++gridRow, "Display national currencies:");
GridPane.setValignment(fiatTuple.first, VPos.TOP);
fiatCurrenciesListView = fiatTuple.second;
fiatCurrenciesListView.setMinHeight(2 * Layout.LIST_ROW_HEIGHT + 2);
fiatCurrenciesListView.setMaxHeight(6 * Layout.LIST_ROW_HEIGHT + 2);
Label placeholder = new Label("There are no national currencies selected");
placeholder.setWrapText(true);
fiatCurrenciesListView.setPlaceholder(placeholder);
fiatCurrenciesListView.setCellFactory(new Callback<ListView<FiatCurrency>, ListCell<FiatCurrency>>() {
@Override
public ListCell<FiatCurrency> call(ListView<FiatCurrency> list) {
return new ListCell<FiatCurrency>() {
final Label label = new Label();
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new Button("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
{
label.setLayoutY(5);
removeButton.setId("icon-button");
AnchorPane.setRightAnchor(removeButton, 0d);
}
@Override
public void updateItem(final FiatCurrency item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
label.setText(item.getNameAndCode());
removeButton.setOnAction(e -> {
if (item.equals(preferences.getPreferredTradeCurrency())) {
new Popup().warning("You cannot remove your selected preferred display currency").show();
} else {
preferences.removeFiatCurrency(item);
if (!allFiatCurrencies.contains(item))
allFiatCurrencies.add(item);
}
});
setGraphic(pane);
} else {
setGraphic(null);
removeButton.setOnAction(null);
}
}
};
}
});
Tuple2<Label, ListView> cryptoCurrenciesTuple = addLabelListView(root, gridRow, "Display altcoins:");
GridPane.setValignment(cryptoCurrenciesTuple.first, VPos.TOP);
GridPane.setMargin(cryptoCurrenciesTuple.first, new Insets(0, 0, 0, 20));
cryptoCurrenciesListView = cryptoCurrenciesTuple.second;
GridPane.setColumnIndex(cryptoCurrenciesTuple.first, 2);
GridPane.setColumnIndex(cryptoCurrenciesListView, 3);
cryptoCurrenciesListView.setMinHeight(2 * Layout.LIST_ROW_HEIGHT + 2);
cryptoCurrenciesListView.setMaxHeight(6 * Layout.LIST_ROW_HEIGHT + 2);
placeholder = new Label("There are no altcoins selected");
placeholder.setWrapText(true);
cryptoCurrenciesListView.setPlaceholder(placeholder);
cryptoCurrenciesListView.setCellFactory(new Callback<ListView<CryptoCurrency>, ListCell<CryptoCurrency>>() {
@Override
public ListCell<CryptoCurrency> call(ListView<CryptoCurrency> list) {
return new ListCell<CryptoCurrency>() {
final Label label = new Label();
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new Button("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
{
label.setLayoutY(5);
removeButton.setId("icon-button");
AnchorPane.setRightAnchor(removeButton, 0d);
}
@Override
public void updateItem(final CryptoCurrency item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
label.setText(item.getNameAndCode());
removeButton.setOnAction(e -> {
if (item.equals(preferences.getPreferredTradeCurrency())) {
new Popup().warning("You cannot remove your selected preferred display currency").show();
} else {
preferences.removeCryptoCurrency(item);
if (!allCryptoCurrencies.contains(item))
allCryptoCurrencies.add(item);
}
});
setGraphic(pane);
} else {
setGraphic(null);
removeButton.setOnAction(null);
}
}
};
}
});
fiatCurrenciesComboBox = addLabelComboBox(root, ++gridRow).second;
fiatCurrenciesComboBox.setPromptText("Add national currency");
fiatCurrenciesComboBox.setConverter(new StringConverter<FiatCurrency>() {
@Override
public String toString(FiatCurrency tradeCurrency) {
return tradeCurrency.getNameAndCode();
}
@Override
public FiatCurrency fromString(String s) {
return null;
}
});
Tuple2<Label, ComboBox> labelComboBoxTuple2 = addLabelComboBox(root, gridRow);
cryptoCurrenciesComboBox = labelComboBoxTuple2.second;
GridPane.setColumnIndex(cryptoCurrenciesComboBox, 3);
cryptoCurrenciesComboBox.setPromptText("Add altcoin");
cryptoCurrenciesComboBox.setConverter(new StringConverter<CryptoCurrency>() {
@Override
public String toString(CryptoCurrency tradeCurrency) {
return tradeCurrency.getNameAndCode();
}
@Override
public CryptoCurrency fromString(String s) {
return null;
}
});
}
use of javafx.scene.layout.AnchorPane in project Gargoyle by callakrsos.
the class PropertyChangeExam method start.
@Override
public void start(Stage primaryStage) throws Exception {
TextArea textArea = new TextArea("");
Button button = new Button("ssss");
button.setStyle("-fx-base: red;");
button.setFont(new Font(55));
Button button2 = new Button("ssss2");
// button2.textProperty().bind(button.textProperty());
// button2.styleProperty().bind(button.styleProperty());
// button2.getStyleClass().addAll(button.getStyleClass());
propertyCopy2(button, button2);
//
// button.setVisible(false);
// propertyCopy(button, button2);
// List<CssMetaData<? extends Styleable, ?>> cssMetaData =
// button.getCssMetaData();
// cssMetaData.forEach(cssMeta -> {
// String property = cssMeta.getProperty();
// System.out.print(property);
// try {
// String ss = String.valueOf(cssMeta.getInitialValue(null));
//
// System.out.println(" : " + ss);
// } catch (NullPointerException e) {
//
// }
//
// });
// button.setStyle(button.getStyle());
// button2.styleProperty().set(button.getStyle());
// button2.setSkin(button.getSkin());
// button2.getCssMetaData().clear();
// button2.getCssMetaData().addAll(button.getControlCssMetaData());
// button2.fire();
//
// ExpressionHelper.fireValueChangedEvent(helper);
// button2.getCssMetaData().addAll(button.getControlCssMetaData());
// button2.textProperty().bind(button.textProperty());
// button2.styleProperty().bind(button.styleProperty());
// button2.visibleProperty().bind(button.visibleProperty());
// button2.disableProperty().bind(button.disableProperty());
// button2.fontProperty().bind(button.fontProperty());
textArea.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> oba, String oldval, String newval) {
button.setStyle(newval);
button2.setStyle(newval);
}
});
AnchorPane root = new AnchorPane(new HBox(textArea, button, button2));
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
}
use of javafx.scene.layout.AnchorPane in project graphysica by Graphysica.
the class MainApp method start.
@Override
public void start(Stage stage) throws Exception {
panneauPrincipal = new AnchorPane();
initialiserPanneau();
Scene scene = new Scene(panneauPrincipal);
LOGGER.debug("");
scene.getStylesheets().add("/styles/Styles.css");
stage.setTitle("Graphysica");
stage.setScene(scene);
stage.show();
// showDialog();
}
use of javafx.scene.layout.AnchorPane in project arquivoProject by fader-azevedo.
the class DBConnector method backtoMenu.
public void backtoMenu(AnchorPane pane) {
FXMLLoader fxmlLoader = new FXMLLoader();
try {
fxmlLoader.load(getClass().getResource("/view/Menu.fxml").openStream());
AnchorPane root = fxmlLoader.getRoot();
pane.getChildren().clear();
pane.getChildren().add(root);
pane.setStyle("-fx-border-color:transparent;");
} catch (IOException ex) {
Logger.getLogger(DBConnector.class.getName()).log(Level.SEVERE, null, ex);
}
}
Aggregations