Search in sources :

Example 16 with AnchorPane

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();
}
Also used : HBox(javafx.scene.layout.HBox) TextArea(javafx.scene.control.TextArea) Button(javafx.scene.control.Button) Scene(javafx.scene.Scene) AnchorPane(javafx.scene.layout.AnchorPane) Font(javafx.scene.text.Font)

Example 17 with AnchorPane

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()));
    });
}
Also used : Label(javafx.scene.control.Label) Node(javafx.scene.Node) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController) FXCollections(javafx.collections.FXCollections) DoubleProperty(javafx.beans.property.DoubleProperty) FileInputStream(java.io.FileInputStream) IntegerProperty(javafx.beans.property.IntegerProperty) File(java.io.File) FileNotFoundException(java.io.FileNotFoundException) FXML(javafx.fxml.FXML) ScrollPane(javafx.scene.control.ScrollPane) ListChangeListener(javafx.collections.ListChangeListener) FlowPane(javafx.scene.layout.FlowPane) AnchorPane(javafx.scene.layout.AnchorPane) ImageView(javafx.scene.image.ImageView) Map(java.util.Map) FileUtil(com.kyj.fx.voeditor.visual.util.FileUtil) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) Scale(javafx.scene.transform.Scale) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) Point2D(javafx.geometry.Point2D) Image(javafx.scene.image.Image) AnchorPane(javafx.scene.layout.AnchorPane) FXML(javafx.fxml.FXML)

Example 18 with AnchorPane

use of javafx.scene.layout.AnchorPane in project trex-stateless-gui by cisco-system-traffic-generator.

the class TrexApp method start.

@Override
public void start(Stage stage) throws Exception {
    speedupTooltip();
    primaryStage = stage;
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/MainView.fxml"));
    AnchorPane page = fxmlLoader.load();
    MainViewController mainviewcontroller = fxmlLoader.getController();
    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(780);
    stage.setMinHeight(700);
    stage.getIcons().add(new Image("/icons/trex.png"));
    packetBuilderAppController = injector.getInstance(AppController.class);
    PreferencesManager.getInstance().setPacketEditorConfigurations(packetBuilderAppController.getConfigurations());
    packetBuilderAppController.registerEventBusHandler(mainviewcontroller);
    stage.show();
}
Also used : MainViewController(com.exalttech.trex.ui.controllers.MainViewController) AppController(com.xored.javafx.packeteditor.controllers.AppController) Scene(javafx.scene.Scene) Image(javafx.scene.image.Image) FXMLLoader(javafx.fxml.FXMLLoader) AnchorPane(javafx.scene.layout.AnchorPane)

Aggregations

AnchorPane (javafx.scene.layout.AnchorPane)18 Scene (javafx.scene.Scene)7 ImageView (javafx.scene.image.ImageView)7 Popup (io.bitsquare.gui.main.overlays.popups.Popup)6 UserThread (io.bitsquare.common.UserThread)5 Tuple2 (io.bitsquare.common.util.Tuple2)5 ChangeListener (javafx.beans.value.ChangeListener)5 Inject (javax.inject.Inject)5 ActivatableViewAndModel (io.bitsquare.gui.common.view.ActivatableViewAndModel)4 FxmlView (io.bitsquare.gui.common.view.FxmlView)4 BSFormatter (io.bitsquare.gui.util.BSFormatter)4 Insets (javafx.geometry.Insets)4 javafx.scene.control (javafx.scene.control)4 Label (javafx.scene.control.Label)4 Tuple3 (io.bitsquare.common.util.Tuple3)3 TitledGroupBg (io.bitsquare.gui.components.TitledGroupBg)3 FormBuilder (io.bitsquare.gui.util.FormBuilder)3 ImageUtil (io.bitsquare.gui.util.ImageUtil)3 Layout (io.bitsquare.gui.util.Layout)3 VPos (javafx.geometry.VPos)3