use of javafx.scene.layout.Pane in project PayFile by mikehearn.
the class ClickableBitcoinAddress method showQRCode.
@FXML
protected void showQRCode(MouseEvent event) {
// Serialize to PNG and back into an image. Pretty lame but it's the shortest code to write and I'm feeling
// lazy tonight.
final byte[] imageBytes = QRCode.from(uri()).withSize(320, 240).to(ImageType.PNG).stream().toByteArray();
Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
ImageView view = new ImageView(qrImage);
view.setEffect(new DropShadow());
// Embed the image in a pane to ensure the drop-shadow interacts with the fade nicely, otherwise it looks weird.
// Then fix the width/height to stop it expanding to fill the parent, which would result in the image being
// non-centered on the screen. Finally fade/blur it in.
Pane pane = new Pane(view);
pane.setMaxSize(qrImage.getWidth(), qrImage.getHeight());
final Main.OverlayUI<ClickableBitcoinAddress> overlay = Main.instance.overlayUI(pane, this);
view.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
overlay.done();
}
});
}
use of javafx.scene.layout.Pane in project PayFile by mikehearn.
the class GuiUtils method runAlert.
public static void runAlert(BiConsumer<Stage, AlertWindowController> setup) {
// JavaFX doesn't actually have a standard alert template. Instead the Scene Builder app will create FXML
// files for an alert window for you, and then you customise it as you see fit. I guess it makes sense in
// an odd sort of way.
Stage dialogStage = new Stage();
dialogStage.initModality(Modality.APPLICATION_MODAL);
FXMLLoader loader = new FXMLLoader(GuiUtils.class.getResource("alert.fxml"));
Pane pane = evalUnchecked(() -> (Pane) loader.load());
AlertWindowController controller = loader.getController();
setup.accept(dialogStage, controller);
dialogStage.setScene(new Scene(pane));
dialogStage.showAndWait();
}
use of javafx.scene.layout.Pane in project aic-praise by aic-sri-international.
the class HOGMPageEditorController method initialize.
// END-ModelPageEditor
//
@FXML
private void initialize() throws IOException {
FXUtil.anchor(modelCodeArea);
modelEditorPane.getChildren().add(modelCodeArea);
FXMLLoader queryLoader = QueryController.newLoader();
Pane queryPane = queryLoader.load();
queryController = queryLoader.getController();
queryController.setModelPageEditor(this);
FXUtil.anchor(queryPane);
queryOutputPane.getChildren().add(queryPane);
}
use of javafx.scene.layout.Pane in project aima-java by aimacode.
the class SimulationPaneBuilder method getResultFor.
/**
* Adds a toolbar, a state view, and a status label to the provided pane and returns
* a controller class instance. The toolbar contains combo boxes to control parameter settings
* and buttons for simulation control. The controller class instance handles user events and provides
* access to user settings (parameter settings, simulation speed, status text, ...).
*/
public SimulationPaneCtrl getResultFor(BorderPane pane) {
List<ComboBox<String>> combos = new ArrayList<>();
parameters.add(createSimSpeedParam());
for (Parameter param : parameters) {
ComboBox<String> combo = new ComboBox<>();
combo.setId(param.getName());
combo.getItems().addAll(param.getValueNames());
combo.getSelectionModel().select(param.getDefaultValueIndex());
combos.add(combo);
}
Button simBtn = new Button();
Node[] tools = new Node[combos.size() + 2];
for (int i = 0; i < combos.size() - 1; i++) tools[i] = combos.get(i);
tools[combos.size() - 1] = new Separator();
tools[combos.size() + 0] = combos.get(combos.size() - 1);
tools[combos.size() + 1] = simBtn;
ToolBar toolBar = new ToolBar(tools);
Label statusLabel = new Label();
statusLabel.setMaxWidth(Double.MAX_VALUE);
statusLabel.setAlignment(Pos.CENTER);
statusLabel.setFont(Font.font(16));
pane.setTop(toolBar);
if (stateView.isPresent()) {
if (stateView.get() instanceof Canvas) {
// make canvas resizable
Canvas canvas = (Canvas) stateView.get();
Pane canvasPane = new Pane();
canvasPane.getChildren().add(canvas);
canvas.widthProperty().bind(canvasPane.widthProperty());
canvas.heightProperty().bind(canvasPane.heightProperty());
pane.setCenter(canvasPane);
pane.setStyle("-fx-background-color: white");
} else
pane.setCenter(stateView.get());
}
pane.setBottom(statusLabel);
if (!initMethod.isPresent())
throw new IllegalStateException("No initialization method defined.");
if (!simMethod.isPresent())
throw new IllegalStateException("No simulation method defined.");
return new SimulationPaneCtrl(parameters, combos, initMethod.get(), simMethod.get(), simBtn, statusLabel);
}
use of javafx.scene.layout.Pane in project bitsquare by bitsquare.
the class Transitions method blur.
public void blur(Node node, int duration, double brightness, boolean removeNode, double blurRadius) {
if (removeEffectTimeLine != null)
removeEffectTimeLine.stop();
node.setMouseTransparent(true);
GaussianBlur blur = new GaussianBlur(0.0);
Timeline timeline = new Timeline();
KeyValue kv1 = new KeyValue(blur.radiusProperty(), blurRadius);
KeyFrame kf1 = new KeyFrame(Duration.millis(getDuration(duration)), kv1);
ColorAdjust darken = new ColorAdjust();
darken.setBrightness(0.0);
blur.setInput(darken);
KeyValue kv2 = new KeyValue(darken.brightnessProperty(), brightness);
KeyFrame kf2 = new KeyFrame(Duration.millis(getDuration(duration)), kv2);
timeline.getKeyFrames().addAll(kf1, kf2);
node.setEffect(blur);
if (removeNode)
timeline.setOnFinished(actionEvent -> UserThread.execute(() -> ((Pane) (node.getParent())).getChildren().remove(node)));
timeline.play();
}
Aggregations