javafx.scene.layout.StackPane Java Examples

The following examples show how to use javafx.scene.layout.StackPane. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CSSFXTab.java    From scenic-view with GNU General Public License v3.0 7 votes vote down vote up
private Node createTabGraphic() {
    SVGPath p = new SVGPath();
    p.setContent("m 180.75256,334.77228 -0.53721,2.68603 10.93285,0 -0.3412,1.73502 -10.9401,0 -0.52996,2.68603 10.93286,0 -0.6098,3.06352 -4.40654,1.45917 -3.81851,-1.45917 0.26134,-1.32849 -2.68602,0 -0.63884,3.22323 6.31579,2.41742 7.2813,-2.41742 0.96552,-4.84937 0.19601,-0.97277 1.24138,-6.2432 z");
    StackPane sp = new StackPane(p);
    sp.setMaxWidth(24.0);
    sp.setMaxHeight(24.0);
    sp.setPrefWidth(24.0);
    sp.setPrefHeight(24.0);
    return sp;
}
 
Example #2
Source File: FlowPaneSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public static Node createIconContent() {
    StackPane sp = new StackPane();
    FlowPane fp = new FlowPane();
    fp.setAlignment(Pos.CENTER);

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    fp.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle[] littleRecs = new Rectangle[4];
    Rectangle[] bigRecs = new Rectangle[4];
    for (int i = 0; i < 4; i++) {
        littleRecs[i] = new Rectangle(14, 14, Color.web("#1c89f4"));
        bigRecs[i] = new Rectangle(16, 12, Color.web("#349b00"));
        fp.getChildren().addAll(littleRecs[i], bigRecs[i]);
        FlowPane.setMargin(littleRecs[i], new Insets(2, 2, 2, 2));
    }
    sp.getChildren().addAll(rectangle, fp);
    return new Group(sp);
}
 
Example #3
Source File: DashboardController.java    From OEE-Designer with MIT License 6 votes vote down vote up
private void onSelectPlannedDowntimePareto() throws Exception {
	List<ParetoItem> items = EquipmentLossManager.getParetoData(equipmentLoss, TimeLoss.PLANNED_DOWNTIME);

	Number divisor = equipmentLoss.getLoss(TimeLoss.PLANNED_DOWNTIME).getSeconds();

	StackPane spPlannedDowntimePareto = new StackPane();

	AnchorPane.setBottomAnchor(spPlannedDowntimePareto, 0.0);
	AnchorPane.setLeftAnchor(spPlannedDowntimePareto, 0.0);
	AnchorPane.setRightAnchor(spPlannedDowntimePareto, 0.0);
	AnchorPane.setTopAnchor(spPlannedDowntimePareto, 0.0);

	apPlannedDowntimePareto.getChildren().clear();
	apPlannedDowntimePareto.getChildren().add(0, spPlannedDowntimePareto);

	ParetoChartController controller = new ParetoChartController();
	controller.createParetoChart(DesignerLocalizer.instance().getLangString("planned.downtime.pareto"),
			spPlannedDowntimePareto, items, divisor, DesignerLocalizer.instance().getLangString("time.by.reason"));
}
 
Example #4
Source File: AboutDialog.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new about dialog.
 *
 * @param root root stack pane.
 */
public AboutDialog(StackPane root) {
  super();
  AnchorPane anchor = new AnchorPane();
  anchor.setMaxHeight(274);
  anchor.setMaxWidth(500);
  anchor.setMinHeight(274);
  anchor.setMaxWidth(500);
  ImageView about = Icons.about();
  Label version = new Label(Globals.VERSION);
  Label license = new Label(Globals.LICENSE);
  version.getStyleClass().add("about");
  license.getStyleClass().add("about");
  anchor.setTopAnchor(about, 0.0);
  anchor.setBottomAnchor(about, 0.0);
  anchor.setLeftAnchor(about, 0.0);
  anchor.setRightAnchor(about, 0.0);
  anchor.setTopAnchor(version, 5.0);
  anchor.setRightAnchor(version, 10.0);
  anchor.setBottomAnchor(license, 5.0);
  anchor.setLeftAnchor(license, 10.0);
  anchor.getChildren().addAll(about, version, license);
  setDialogContainer(root);
  setContent((Region) anchor);
  setTransitionType(JFXDialog.DialogTransition.TOP);
}
 
Example #5
Source File: JFXChartUtil.java    From jfxutils with Apache License 2.0 6 votes vote down vote up
/**
 * Convenience method for simple and default setup of zooming on an {@link XYChart} via a
 * {@link ChartZoomManager}. Wraps the chart in the components required to implement zooming. The
 * current implementation wraps the chart in a StackPane, which has the chart and a blue
 * translucent rectangle as children. Returns the top level of the created components.
 * <p>
 * If the chart already has a parent, that parent must be a {@link Pane}, and the chart is
 * replaced with the wrapping region, and the return value could be ignored. If the chart does
 * not have a parent, the same wrapping node is returned, which will need to be added to some
 * parent.
 * <p>
 * The chart's axes must both be a type of ValueAxis.
 * <p>
 * The wrapping logic does not seem to be perfect, in fact there is a special case to handle
 * {@link BorderPane}s. If it's not found to be reliable, then create the wrapping components
 * yourself (such as in the FXML), or setup zooming before adding it to a parent.
 *
 * @param mouseFilter EventHandler that consumes events that should not trigger a zoom action
 *
 * @return The top-level Region
 */
public static Region setupZooming( XYChart<?, ?> chart,
                                   EventHandler<? super MouseEvent> mouseFilter ) {
	StackPane chartPane = new StackPane();

	if ( chart.getParent() != null )
		JFXUtil.replaceComponent( chart, chartPane );

	Rectangle selectRect = new Rectangle( 0, 0, 0, 0 );
	selectRect.setFill( Color.DODGERBLUE );
	selectRect.setMouseTransparent( true );
	selectRect.setOpacity( 0.3 );
	selectRect.setStroke( Color.rgb( 0, 0x29, 0x66 ) );
	selectRect.setStrokeType( StrokeType.INSIDE );
	selectRect.setStrokeWidth( 3.0 );
	StackPane.setAlignment( selectRect, Pos.TOP_LEFT );

	chartPane.getChildren().addAll( chart, selectRect );

	ChartZoomManager zoomManager = new ChartZoomManager( chartPane, selectRect, chart );
	zoomManager.setMouseFilter( mouseFilter );
	zoomManager.start();
	return chartPane;
}
 
Example #6
Source File: ScanAllController.java    From FlyingAgent with Apache License 2.0 6 votes vote down vote up
public void updateLocation(jade.util.leap.List locations) {
    this.locationsJade = locations;
    Iterator ite = locationsJade.iterator();

    listLocation.getItems().clear();
    while (ite.hasNext()) {
        StackPane stackPane = new StackPane();

        Label lbl = new Label(ite.next().toString());
        ImageView pcIcon = new ImageView(new Image("/resources/images/pc.png"));
        stackPane.getChildren().addAll(lbl, pcIcon);
        stackPane.setAlignment(lbl, Pos.CENTER_LEFT);
        stackPane.setAlignment(pcIcon, Pos.CENTER_RIGHT);
        listLocation.getItems().add(stackPane);
    }
}
 
Example #7
Source File: Exercise_15_06.java    From Intro-to-Java-Programming with MIT License 6 votes vote down vote up
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
	StackPane pane = new StackPane();
	Text text1 = new Text("Java is fun");
	Text text2 = new Text("Java is powerful");
	pane.getChildren().addAll(text1);

	pane.setOnMouseClicked(e -> {
		if (pane.getChildren().contains(text1)) {
			pane.getChildren().add(text2);
			pane.getChildren().remove(text1);
		}
		else {
			pane.getChildren().add(text1);
			pane.getChildren().remove(text2);
		}
	});

	// Create a scene and place it in the stage
	Scene scene = new Scene(pane, 150, 50);
	primaryStage.setTitle("Exercise_15_06"); // Set the stage title
	primaryStage.setScene(scene); // Place the scene in the stage
	primaryStage.show(); // Display the stage
}
 
Example #8
Source File: MainManagerClient.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void construct(StackPane root, Parameters params) {
    this.root = root;
    
    boolean status = Boolean.parseBoolean(HelloPlatform.getInstance().getProperty("window.status", "false"));
    if (status) {
        try {                
            showApplication();      
        } catch (HelloIoTException ex) {
            MessageUtils.showException(MessageUtils.getRoot(root), resources.getString("exception.topicinfotitle"), ex, ev -> {
                showLogin();
            });
        }
    } else {
        showLogin();
    }
}
 
Example #9
Source File: LineIndicatorDemo.java    From RichTextFX with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void start(Stage primaryStage) {
    CodeArea codeArea = new CodeArea();

    IntFunction<Node> numberFactory = LineNumberFactory.get(codeArea);
    IntFunction<Node> arrowFactory = new ArrowFactory(codeArea.currentParagraphProperty());
    IntFunction<Node> graphicFactory = line -> {
        HBox hbox = new HBox(
                numberFactory.apply(line),
                arrowFactory.apply(line));
        hbox.setAlignment(Pos.CENTER_LEFT);
        return hbox;
    };
    codeArea.setParagraphGraphicFactory(graphicFactory);
    codeArea.replaceText("The green arrow will only be on the line where the caret appears.\n\nTry it.");
    codeArea.moveTo(0, 0);

    primaryStage.setScene(new Scene(new StackPane(codeArea), 600, 400));
    primaryStage.show();
}
 
Example #10
Source File: ChartViewerSkin.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/** 
 * Creates the node representing this control.
 * 
 * @return The node.
 */
private BorderPane createNode(ChartViewer control) {
    BorderPane borderPane = new BorderPane();
    borderPane.setPrefSize(800, 500);
    StackPane sp = new StackPane();
    sp.setMinSize(10, 10);
    sp.setPrefSize(600, 400);
    this.canvas = new ChartCanvas(getSkinnable().getChart());
    this.canvas.setTooltipEnabled(control.isTooltipEnabled());
    this.canvas.addChartMouseListener(control);
    this.canvas.widthProperty().bind(sp.widthProperty());
    this.canvas.heightProperty().bind(sp.heightProperty());
 
    this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", control));
    sp.getChildren().add(this.canvas);
    
    borderPane.setCenter(sp);
    return borderPane;
}
 
Example #11
Source File: FXInSwing.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
public FXInSwing(){
    panel = new JFXPanel();
    Platform.runLater(new Runnable(){
        @Override
        public void run() {
            stack = new StackPane();
            scene = new Scene(stack,300,300);
            hello = new Text("Hello");

            scene.setFill(Color.BLACK);
            hello.setFill(Color.WHEAT);
            hello.setEffect(new Reflection());

            panel.setScene(scene);
            stack.getChildren().add(hello);

            wait = false;
        }
    });
    this.getContentPane().add(panel);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setSize(300, 300);
    this.setVisible(true);
}
 
Example #12
Source File: BillBoardBehaviorTest.java    From FXyzLib with GNU General Public License v3.0 6 votes vote down vote up
private void createCameraView(){
    cameraView = new CameraView(subScene);
    cameraView.setFitWidth(400);
    cameraView.setFitHeight(300);
    cameraView.setFirstPersonNavigationEabled(true);
    cameraView.setFocusTraversable(true);
    cameraView.getCamera().setTranslateZ(-2500);
    cameraView.getCamera().setTranslateX(500);
    
    StackPane.setAlignment(cameraView, Pos.BOTTOM_RIGHT);
    StackPane.setMargin(cameraView, new Insets(10));
    
    rootPane.getChildren().add(cameraView);
    
    cameraView.startViewing();
}
 
Example #13
Source File: Test.java    From medusademo with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(gauge);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(50, 50, 50), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Test");
    stage.setScene(scene);
    stage.show();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");

}
 
Example #14
Source File: Demo.java    From JFX8CustomControls with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    Led control = new Led();
    control.setPrefWidth(200);
    control.setPrefHeight(200);

    StackPane pane = new StackPane();
    pane.getChildren().setAll(control);

    Scene scene = new Scene(pane);

    stage.setTitle("JavaFX Led Region");
    stage.setScene(scene);
    stage.show();

    control.setBlinking(true);
    
    calcNoOfNodes(scene.getRoot());
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example #15
Source File: EmojiDisplayer.java    From ChatRoom-JavaFX with Apache License 2.0 6 votes vote down vote up
/**
 * 创建emoji图片节点
 *
 * @param emoji
 *            emoji
 * @param size
 *            图片显示大小
 * @param pad
 *            图片间距
 * @param isCursor
 *            是否需要图片光标及鼠标处理事件
 * @return
 */
public static Node createEmojiNode(Emoji emoji, int size, int pad) {
	// 将表情放到stackpane中
	StackPane stackPane = new StackPane();
	stackPane.setMaxSize(size, size);
	stackPane.setPrefSize(size, size);
	stackPane.setMinSize(size, size);
	stackPane.setPadding(new Insets(pad));
	ImageView imageView = new ImageView();
	imageView.setFitWidth(size);
	imageView.setFitHeight(size);
	imageView.setImage(ImageCache.getInstance().getImage(getEmojiImagePath(emoji.getHex())));
	stackPane.getChildren().add(imageView);

	return stackPane;
}
 
Example #16
Source File: Demo.java    From Enzo with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    HBox lcd = new HBox();
    lcd.setPadding(new Insets(15, 15, 15, 15));
    lcd.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY)));
    lcd.setSpacing(10);
    lcd.setAlignment(Pos.CENTER);
    lcd.setFillHeight(false);
    HBox.setMargin(seg3, new Insets(0, 20, 0, 0));
    lcd.getChildren().addAll(seg0, seg1, seg2, seg3);
    /*
    for (int i = 0 ; i < 256 ; i++) {
        System.out.println(i + "   :   " + Character.toString((char) i));
    }
    */
    StackPane pane = new StackPane();
    pane.getChildren().setAll(lcd);

    Scene scene = new Scene(pane, Color.BLACK);

    stage.setTitle("SevenSegment DemoGauge");
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example #17
Source File: ProposalListItem.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public Label getMyVoteIcon() {
    Label myVoteIcon;
    if (vote != null) {
        if ((vote).isAccepted()) {
            myVoteIcon = getIcon(AwesomeIcon.THUMBS_UP, "dao-accepted-icon");
        } else {
            myVoteIcon = getIcon(AwesomeIcon.THUMBS_DOWN, "dao-rejected-icon");
        }
        if (!isMyBallotIncluded) {
            Label notIncluded = FormBuilder.getIcon(AwesomeIcon.BAN_CIRCLE);
            return new Label("", new HBox(10, new StackPane(myVoteIcon, notIncluded),
                    getIcon(AwesomeIcon.MINUS, "dao-ignored-icon")));
        }
    } else {
        myVoteIcon = getIcon(AwesomeIcon.MINUS, "dao-ignored-icon");
        if (!isMyBallotIncluded) {
            myVoteIcon.setPadding(new Insets(0, 0, 0, 25));
            return myVoteIcon;
        }
    }
    return myVoteIcon;
}
 
Example #18
Source File: ScaleBarSample.java    From arcgis-runtime-samples-java with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) {

  // create stack pane and application scene
  StackPane stackPane = new StackPane();
  Scene scene = new Scene(stackPane);

  // set title, size and scene to stage
  stage.setTitle("Scale Bar Sample");
  stage.setWidth(800);
  stage.setHeight(700);
  stage.setScene(scene);
  stage.show();

  // create a map view
  mapView = new MapView();
  ArcGISMap map = new ArcGISMap(Basemap.Type.IMAGERY, 64.1405, -16.2426, 16);
  mapView.setMap(map);

  // create a scale bar for the map view
  Scalebar scaleBar = new Scalebar(mapView);

  // specify skin style for the scale bar
  scaleBar.setSkinStyle(Scalebar.SkinStyle.GRADUATED_LINE);

  // set the unit system (default is METRIC)
  scaleBar.setUnitSystem(UnitSystem.IMPERIAL);

  // to enhance visibility of the scale bar, by making background transparent
  Color transparentWhite = new Color(1, 1, 1, 0.7);
  scaleBar.setBackground(new Background(new BackgroundFill(transparentWhite, new CornerRadii(5), Insets.EMPTY)));

  // add the map view and scale bar to stack pane
  stackPane.getChildren().addAll(mapView, scaleBar);

  // set position of scale bar
  StackPane.setAlignment(scaleBar, Pos.BOTTOM_CENTER);
  // give padding to scale bar
  StackPane.setMargin(scaleBar, new Insets(0, 0, 50, 0));
}
 
Example #19
Source File: BaseFileEditorWithSplitRightTool.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
/**
 * Build split component.
 *
 * @param first the first component.
 * @param second the second component.
 * @param root the root.
 * @return the result component.
 */
@FxThread
protected Region buildSplitComponent(@NotNull final Node first, @NotNull final Node second,
                                     @NotNull final StackPane root) {

    final SplitPane splitPane = new SplitPane(first, second);
    splitPane.prefHeightProperty().bind(root.heightProperty());
    splitPane.prefWidthProperty().bind(root.widthProperty());

    root.heightProperty().addListener((observableValue, oldValue, newValue) -> calcVSplitSize(splitPane));

    FXUtils.addClassTo(splitPane, CssClasses.FILE_EDITOR_TOOL_SPLIT_PANE);

    return splitPane;
}
 
Example #20
Source File: FunLevelGaugeDemo.java    From medusademo with Apache License 2.0 5 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(gauge);
    pane.setPadding(new Insets(10));

    Scene scene = new Scene(pane);

    stage.setTitle("Medusa FunLevelGauge");
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example #21
Source File: BorderPaneSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    StackPane sp = new StackPane();
    BorderPane borderPane = new BorderPane();

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    borderPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
 
    Rectangle recTop = new Rectangle(62, 5, Color.web("#349b00"));
    recTop.setStroke(Color.BLACK);
    Rectangle recBottom = new Rectangle(62, 14, Color.web("#349b00"));
    recBottom.setStroke(Color.BLACK);
    Rectangle recLeft = new Rectangle(20, 41, Color.TRANSPARENT);
    recLeft.setStroke(Color.BLACK);
    Rectangle recRight = new Rectangle(20, 41, Color.TRANSPARENT);
    recRight.setStroke(Color.BLACK);
    Rectangle centerRight = new Rectangle(20, 41, Color.TRANSPARENT);
    centerRight.setStroke(Color.BLACK);
    borderPane.setRight(recRight);
    borderPane.setTop(recTop);
    borderPane.setLeft(recLeft);
    borderPane.setBottom(recBottom);
    borderPane.setCenter(centerRight);
 
    sp.getChildren().addAll(rectangle, borderPane);
    return new Group(sp);
}
 
Example #22
Source File: ADCCanvasView.java    From arma-dialog-creator with MIT License 5 votes vote down vote up
ADCCanvasView() {
	EditorManager editorManager = EditorManager.instance;
	this.display = editorManager.getEditingDisplay();
	canvasControls = new CanvasControls(this);
	this.uiCanvasEditor = new UICanvasEditor(editorManager.getResolution(), canvasControls, display);
	initializeUICanvasEditor(display);

	//init notification pane
	{
		VBox vboxNotifications = new VBox(10);
		vboxNotifications.setFillWidth(true);
		vboxNotifications.setAlignment(Pos.BOTTOM_RIGHT);
		vboxNotifications.setPadding(new Insets(5));
		vboxNotifications.setMinWidth(120);

		notificationPane = new NotificationPane(vboxNotifications);
		Notifications.setDefaultNotificationPane(notificationPane);
	}

	final StackPane stackPane = new StackPane(uiCanvasEditor, notificationPane.getContentPane());
	notificationPane.getContentPane().setMouseTransparent(true);

	this.getChildren().addAll(stackPane, canvasControls);
	HBox.setHgrow(canvasControls, Priority.ALWAYS);

	setOnMouseMoved(new CanvasViewMouseEvent(this));
	focusToCanvas(true);
}
 
Example #23
Source File: TextFilePreview.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
@Override
@FxThread
protected void initialize(@NotNull final TextArea node, @NotNull final StackPane pane) {
    super.initialize(node, pane);

    node.prefWidthProperty().bind(pane.widthProperty().subtract(2));
    node.prefHeightProperty().bind(pane.heightProperty().subtract(2));

    FXUtils.addClassTo(node, CssClasses.TRANSPARENT_TEXT_AREA);
}
 
Example #24
Source File: DisplayCanvas.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
public final ImageView getNewImageView() {
    ImageView ret = new ImageView(Utils.getImageFromColour(Color.BLACK));
    ret.setFitHeight(getHeight());
    ret.setFitWidth(getWidth());
    StackPane.setAlignment(ret, Pos.CENTER);
    return ret;
}
 
Example #25
Source File: TinySpinner.java    From milkman with MIT License 5 votes vote down vote up
public TinySpinner() {
	this.getStyleClass().add("spinner");
	this.getChildren().add(spinner("tiny-spinner", -40));
	
	cancellation = button("tiny-cancellation", icon(FontAwesomeIcon.TIMES, "1.5em"));
	StackPane.setAlignment(cancellation, Pos.CENTER);
	this.getChildren().add(cancellation);
}
 
Example #26
Source File: TripleACheckBoxSkin.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
private void layoutRect() {
  StackPane.setAlignment(rect, Pos.BOTTOM_LEFT);
  rect.getStyleClass().setAll("box");
  rect.widthProperty()
      .bind(
          Bindings.multiply(Bindings.min(pane.widthProperty(), pane.heightProperty()), 2.0 / 3));
  rect.heightProperty()
      .bind(
          Bindings.multiply(Bindings.min(pane.widthProperty(), pane.heightProperty()), 2.0 / 3));
  pane.getChildren().add(rect);
}
 
Example #27
Source File: Tab.java    From oim-fx with MIT License 5 votes vote down vote up
private void initComponent() {

		StackPane stackPane = new StackPane();
		this.getChildren().add(borderPane);
		borderPane.setCenter(stackPane);
		// borderPane.setBottom(hBox);
		// // vbox.getChildren().add(stackPane);
		//
		// // this.getChildren().add(imageButton);
		// hBox.setMinHeight(2);

		stackPane.getChildren().add(imageButton);
		imageButton.getStyleClass().clear();

		imageButton.setBackground(Background.EMPTY);
		imageButton.setBorder(Border.EMPTY);
		imageButton.setFocusTraversable(false);
		imageButton.setGraphic(imageView);

		hBox.setStyle("-fx-background-color:rgba(194, 194, 173, 1)");
		// imageButton.setOnAction(new EventHandler() {
		// @Override
		// public void handle(Event event) {
		//
		// }
		// });
		// setStyle("-fx-background-color:rgba(0, 0, 0, 1);");
		setSide(Side.BOTTOM);
	}
 
Example #28
Source File: SmoothedChart.java    From OEE-Designer with MIT License 5 votes vote down vote up
public void setSymbolSize(final Series<X, Y> SERIES, final double SIZE) {
    if (!getData().contains(SERIES)) { return; }
    if (SERIES.getData().isEmpty()) { return; }
    double symbolSize = Helper.clamp(0, 30, SIZE);
    for (XYChart.Data<X, Y> data : SERIES.getData()) {
        StackPane stackPane = (StackPane) data.getNode();
        if (null == stackPane) { continue; }
        stackPane.setPrefSize(symbolSize, symbolSize);
    }
}
 
Example #29
Source File: TabSkin.java    From WorkbenchFX with Apache License 2.0 5 votes vote down vote up
private void initializeParts() {
  closeIconShape = new StackPane();
  closeIconShape.getStyleClass().add("shape");
  closeBtn = new Button("", closeIconShape);
  closeBtn.getStyleClass().addAll("icon", "close-icon");

  nameLbl = new Label();
  nameLbl.getStyleClass().add("tab-name-lbl");

  controlBox = new HBox();
  controlBox.getStyleClass().add("tab-box");
}
 
Example #30
Source File: PacketHex.java    From trex-stateless-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Show dialog
 *
 * @param selectedText
 * @return
 */
private String showDialog(String selectedText) {
    Dialog dialog = new Dialog();
    dialog.setTitle("Edit Hex");
    dialog.setResizable(false);
    TextField text1 = new TextField();
    text1.addEventFilter(KeyEvent.KEY_TYPED, hex_Validation(2));
    text1.setText(selectedText);
    StackPane dialogPane = new StackPane();
    dialogPane.setPrefSize(150, 50);
    dialogPane.getChildren().add(text1);
    dialog.getDialogPane().setContent(dialogPane);
    ButtonType buttonTypeOk = new ButtonType("Save", ButtonData.OK_DONE);
    dialog.getDialogPane().getButtonTypes().add(buttonTypeOk);
    dialog.setResultConverter(new Callback<ButtonType, String>() {
        @Override
        public String call(ButtonType b) {
            
            if (b == buttonTypeOk) {
                switch (text1.getText().length()) {
                    case 0:
                        return null;
                    case 1:
                        return "0".concat(text1.getText());
                    default:
                        return text1.getText();
                }
            }
            return null;
        }
    });
    
    Optional<String> result = dialog.showAndWait();
    if (result.isPresent()) {
        return result.get();
    }
    return null;
}