public TextFieldEventsCounter(final String counterName) { if (counterName == null) { throw new IllegalArgumentException("Counter name cannot be null."); } try { this.counterName = counterName; Label label = LabelBuilder.create().text(counterName + " : ").prefWidth((new Text(counterName + " : ")).getBoundsInParent().getWidth() + 30).build(); final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(counterName.toUpperCase() + COUNTER_SUFFIX).build(); counter.addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) { log("Counter " + counterName + ": new value : <" + t1 + ">."); tf.setText(t1.toString()); } }); getChildren().addAll(label, tf); } catch (Throwable ex) { log(ex); } }
public <ValueType> PropertyValueListener(String labelDescription, ReadOnlyProperty listenedProperty, String textFieldId, Object owningObject, Boolean showCounters) { this.owningObject = owningObject; receivedValueTF.setId(textFieldId); receivedValueTF.setTooltip(new Tooltip()); if (listenedProperty.getName().contains("BOUNDS")) { //Make text field width, because bounds - big. receivedValueTF.setMinWidth(500); } this.listenedProperty = listenedProperty; counter = new PropertyValueCounter(listenedProperty); getChildren().add(LabelBuilder.create().text(labelDescription).prefWidth(100).build()); if (showCounters) { getChildren().add(counter.getVisualRepresentation()); } getChildren().add(receivedValueTF); listenedProperty.addListener(new ChangeListener() { public void changed(ObservableValue ov, Object t, Object t1) { processNewValue(t1); } }); processNewValue(listenedProperty.getValue()); }
/** * {@inheritDoc} */ @Override protected void initView() { this.defaultCommand = new Button("Trigger a default Command into JIT"); this.uiCommand = new Button("Trigger an UI Command into JAT"); this.pooledCommand = new Button("Trigger a pooled Command into JTP"); getRootNode().setCenter( LabelBuilder.create() .text("JRebirth Sample") .build() ); getRootNode().setBottom(FlowPaneBuilder.create().children( this.defaultCommand, this.uiCommand, this.pooledCommand ).build()); }
/** * {@inheritDoc} */ @Override protected void execute(final Wave wave) { LOGGER.info("Display a pop up from JAT"); final Stage s = StageBuilder.create() .title("Sample Ui Command Test") .style(StageStyle.DECORATED) .scene(SceneBuilder.create() .root(LabelBuilder.create().text("Run into JAT").build()) .build()) .build(); s.show(); // Sample for popup => Attach owner !!! // getLocalFacade().getGlobalFacade().getApplication().getStage() }
private void configureTable(VBox root) { final ObservableList<MyDomain> data = FXCollections.observableArrayList( new MyDomain("Apple","This is a fruit.","Red"), new MyDomain("Orange","This is also a fruit.","Orange"), new MyDomain("Potato","This is a vegetable.","Brown") ); TableView<MyDomain> table1 = getTableView(data); table1.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); TableView<MyDomain> table2 = getTableView(data); table2.setColumnResizePolicy(TableView.UNCONSTRAINED_RESIZE_POLICY); root.setSpacing(15); root.getChildren().addAll(LabelBuilder.create().text("CONSTRAINED_RESIZE_POLICY").style("-fx-font-weight:bold;").build(),table1, LabelBuilder.create().text("UNCONSTRAINED_RESIZE_POLICY").style("-fx-font-weight:bold;").build(),table2); }
private void configureTable(VBox root) { final ObservableList<MyDomain> data = FXCollections.observableArrayList( new MyDomain("Apple","This is a fruit.","Red"), new MyDomain("Orange","This is also a fruit.","Orange"), new MyDomain("Potato","This is a vegetable.","Brown") ); CustomTableView<MyDomain> table1 = getTableView(data); table1.getTableView().setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); CustomTableView<MyDomain> table2 = getTableView(data); table2.getTableView().setColumnResizePolicy(TableView.UNCONSTRAINED_RESIZE_POLICY); root.setSpacing(15); root.getChildren().addAll(LabelBuilder.create().text("CONSTRAINED_RESIZE_POLICY").style("-fx-font-weight:bold;").build(),table1, LabelBuilder.create().text("UNCONSTRAINED_RESIZE_POLICY").style("-fx-font-weight:bold;").build(),table2); }
/** * Constructor for Header Cell * @param c - LockingTableColumn<T, ?> */ public LockingTableCell(LockingTableColumn<T, ?> c){ super(); super.getStyleClass().add("locktable-cell"); super.setAlignment(Pos.CENTER); super.minWidthProperty().bind(c.widthProperty()); super.maxWidthProperty().bind(c.widthProperty()); if(c.getGraphic()==null){ String str = c.getColumnTitle(); label = LabelBuilder.create().text(str).build(); label.setAlignment(Pos.CENTER); getChildren().add(label); }else{ getChildren().add(c.getGraphic()); } }
/** * Build and return the footer panel. * * @return the footer panel */ protected Node getFooterPanel() { this.pageLabel = LabelBuilder.create() .text(String.valueOf(model().getSlide().getPage())) .font(PrezFonts.PAGE.get()) .build(); final AnchorPane ap = AnchorPaneBuilder.create() .children(this.pageLabel) .build(); AnchorPane.setRightAnchor(this.pageLabel, 20.0); final StackPane sp = StackPaneBuilder.create() .styleClass("footer") .prefHeight(35.0) .minHeight(Region.USE_PREF_SIZE) .maxHeight(Region.USE_PREF_SIZE) .children(ap) .build(); StackPane.setAlignment(ap, Pos.CENTER_RIGHT); return sp; }
public InsetTextSample() { String insetTextCss = InsetTextSample.class.getResource("InsetText.css").toExternalForm(); Label label = LabelBuilder.create().text("Label styled as a bar").id("label1").build(); label.getStylesheets().add(insetTextCss); getChildren().add(label); }
/** * * @return center_box */ private HBox getCenterBox() { @SuppressWarnings("deprecation") HBox center = HBoxBuilder.create() .children(LabelBuilder.create().text("Game Over!!") .textFill(Color.BLACK) .font(Font.font("System", FontWeight.MEDIUM, FontPosture.REGULAR, 30)) .build()) .alignment(Pos.CENTER) .build(); return center; }
/** * * @return root-node */ @SuppressWarnings("deprecation") private BorderPane getBody() { return BorderPaneBuilder.create().minHeight(200).minWidth(440).center( VBoxBuilder.create().alignment(Pos.CENTER).children( LabelBuilder.create() .minHeight(10).build(), LabelBuilder.create().text("Congratulation !! You won the game.") .font(Font.font("", FontWeight.BOLD, FontPosture.ITALIC, 20)) .textFill(Color.WHITE).build(), LabelBuilder.create() .minHeight(30).build(), HBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children( ButtonBuilder.create().text("Continue").font(Font.font("", FontWeight.SEMI_BOLD, FontPosture.REGULAR, 18)) .minWidth(140).textFill(Color.WHITE).style("-fx-base:darkslategrey") .onAction(e -> this.close()).build(), ButtonBuilder.create().text("Try Again").font(Font.font("", FontWeight.SEMI_BOLD, FontPosture.REGULAR, 18)) .minWidth(140).textFill(Color.WHITE).style("-fx-base:darkslategrey") .onAction(e -> { controller.restart(); this.close(); }).build() ).build() ) .build() ).style("-fx-background-color: linear-gradient(#000000cc, darkslategrey); -fx-background-radius: 15; -fx-border-radius:15;" + "-fx-border-width:1; -fx-border-color:lightgrey").build(); }
public HBox getGraphicNode(final Date dt){ CheckBox cb = new CheckBox(); cb.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed( ObservableValue<? extends Boolean> paramObservableValue, Boolean paramT1, Boolean paramT2) { if(paramT2){ colSelectList.add(dt); }else{ colSelectList.remove(dt); } } }); String str1 = getDatetoString(dt); String str2 = getTimetoString(dt); VBox vb = new VBox(); vb.setAlignment(Pos.CENTER); vb.getChildren().addAll(LabelBuilder.create().text(str1).build(), LabelBuilder.create().text(str2).build()); HBox hb = new HBox(); hb.getChildren().addAll(cb,vb); hb.setAlignment(Pos.CENTER); hb.setSpacing(5); hb.setPadding(new Insets(0,5,0,5)); return hb; }
private GridPane configureMemoryAnalyzer() { GridPane gp = GridPaneBuilder.create().vgap(8).hgap(8).build(); Label usedLbl = LabelBuilder.create().build(); Label freeLbl = LabelBuilder.create().build(); Label totalLbl = LabelBuilder.create().build(); Label maxLbl = LabelBuilder.create().build(); gp.addRow(0, new Label("Used :"), usedLbl); gp.addRow(1, new Label("Free :"), freeLbl); gp.addRow(2, new Label("Total :"), totalLbl); gp.addRow(3, new Label("Max :"), maxLbl); read(usedLbl, freeLbl, totalLbl, maxLbl); return gp; }
public CustomTextField(){ super(); addListener(); VBox vb = new VBox(); vb.getChildren().add(new Label("Hello dude")); vb.getChildren().add(LabelBuilder.create().text("Last line").style("-fx-font-weight:bold;").build()); Tooltip tp = new Tooltip(); tp.setGraphic(vb); setTooltip(tp); }
private void configureScene() { root = new VBox(); root.setPadding(new Insets(20)); root.getChildren().add( StackPaneBuilder .create() .padding(new Insets(0, 0, 20, 0)) .children( LabelBuilder.create().text("CustomTextField Demo").style("-fx-font-weight:bold;-fx-font-size:20px;") .build()) .build()); root.autosize(); this.scene = new Scene(root, Color.LINEN); }
protected void setText(Object item){ getChildren().clear(); if(item!=null){ setLabel(LabelBuilder.create().text(item.toString()).build()); getChildren().add(getLabel()); } }
/** * create the UI on first call * * @return */ private Node createUI() { final AnchorPane anchor = AnchorPaneBuilder.create() .styleClass("roundedAnchorPaneFX").build(); final Label heading = LabelBuilder.create() .text(this.getResourceBundle().getString("javafxCompTop")) .alignment(Pos.CENTER).styleClass("propLabel").build(); final Button top = ButtonBuilder.create() .text(this.getResourceBundle().getString("send")).layoutX(120) .onMouseClicked(this.getEventHandler()).alignment(Pos.CENTER) .build(); this.textField = TextFieldBuilder.create().text("") .styleClass("propTextField").alignment(Pos.CENTER).build(); AnchorPane.setBottomAnchor(top, 25.0); AnchorPane.setRightAnchor(top, 25.0); AnchorPane.setRightAnchor(heading, 50.0); AnchorPane.setTopAnchor(heading, 10.0); AnchorPane.setTopAnchor(this.textField, 50.0); AnchorPane.setRightAnchor(this.textField, 25.0); anchor.getChildren().addAll(heading, top, this.textField); GridPane.setHgrow(anchor, Priority.ALWAYS); GridPane.setVgrow(anchor, Priority.ALWAYS); return anchor; }
/** * create the UI on first call * * @return */ private Node createUI() { final AnchorPane anchor = AnchorPaneBuilder.create() .styleClass("roundedAnchorPaneFX").build(); final Label heading = LabelBuilder.create() .text(this.getResourceBundle().getString("javafxComp")) .alignment(Pos.CENTER_RIGHT).styleClass("propLabelBig").build(); final Button left = ButtonBuilder .create() .text(this.getResourceBundle().getString("send")) .layoutX(120) .onMouseClicked( this.getActionListener("id01.id003", "hello stateful component").getListener()) .alignment(Pos.CENTER).build(); this.textField = TextFieldBuilder.create().text("") .styleClass("propTextField").alignment(Pos.CENTER).build(); AnchorPane.setRightAnchor(heading, 25.0); AnchorPane.setTopAnchor(heading, 15.0); AnchorPane.setTopAnchor(left, 80.0); AnchorPane.setRightAnchor(left, 25.0); AnchorPane.setTopAnchor(this.textField, 50.0); AnchorPane.setRightAnchor(this.textField, 25.0); AnchorPane.setLeftAnchor(this.textField, 25.0); anchor.getChildren().addAll(heading, left, this.textField); GridPane.setHgrow(anchor, Priority.ALWAYS); GridPane.setVgrow(anchor, Priority.ALWAYS); return anchor; }
/** * * @param stage * @throws Exception */ @Override public void start(Stage stage) throws Exception { VBox box = new VBox(); Scene scene = new Scene(box); accordion.getPanes().add(new TitledPane("First pane", LabelBuilder.create().text("First pane's content").minHeight(200).build())); accordion.getPanes().add(new TitledPane("Second pane", LabelBuilder.create().text("Second pane's content").minHeight(200).build())); box.getChildren().add(accordion); Button reset = new Button("Reset"); reset.setOnAction(t -> reset()); box.getChildren().add(reset); stage.setScene(scene); stage.setWidth(300); stage.setHeight(300); stage.show(); reset(); }
@Override public void start(Stage stage) { final Group root; Scene scene = SceneBuilder.create() .width(500).height(500) .fill(Color.WHITE) .root(root = GroupBuilder.create() .children(RectangleBuilder.create() .layoutX(5).layoutY(5) .width(490).height(490) .fill(Color.LIGHTSKYBLUE) .onMouseClicked(new EventHandler<MouseEvent>() { // Eventhandler for mouse click event @Override public void handle(MouseEvent e) { if (clickcount > 2) { initialize(); } for (int j = clickcount; j < 3; j++) { org_x[j].set(e.getSceneX()); org_y[j].set(e.getSceneY()); } clickcount++; } }).build(), // line for x-axis through the Origin LineBuilder.create() .startX(5).startY(490) .endX(495).endY(490) .build(), // Line for y-axis through the Origin LineBuilder.create() .startX(10).startY(5) .endX(10).endY(495) .build(), // grid horizontal lines which interval is of 1cm a_x_l[0], a_x_l[1], a_x_l[2], a_x_l[3], a_x_l[4], a_x_l[5], a_x_l[6], a_x_l[7], a_x_l[8], a_x_l[9], a_x_l[10], a_x_l[11], // grid vertical lines which interval is of 1cm a_y_l[0], a_y_l[1], a_y_l[2], a_y_l[3], a_y_l[4], a_y_l[5], a_y_l[6], a_y_l[7], a_y_l[8], a_y_l[9], a_y_l[10], a_y_l[11], // Sides l[0], l[1], l[2], // Vertices c[0], c[1], c[2], // the printing space of the coordinates and // the area of triangle HBoxBuilder.create() .layoutX(10) .padding(new Insets(10, 10, 10, 10)).spacing(3) .alignment(Pos.BOTTOM_CENTER) .children( LabelBuilder.create().text("A(").build(), tx[0], LabelBuilder.create().text(",").build(), ty[0], LabelBuilder.create().text("),").build(), LabelBuilder.create().text("B(").build(), tx[1], LabelBuilder.create().text(",").build(), ty[1], LabelBuilder.create().text("),").build(), LabelBuilder.create().text("C(").build(), tx[2], LabelBuilder.create().text(",").build(), ty[2], LabelBuilder.create().text(") ⇒ ").build(), area_Label ).build() ).build() ).build(); stage.setTitle("Triangle Area"); stage.setScene(scene); stage.show(); }
/** * Builds the top panel. * * @return the node */ private Node buildTopPanel() { final AnchorPane ap = new AnchorPane(); // Success Part this.successCounter = LabelBuilder.create() .id("SuccessCounter") .font(MTFonts.COUNTER.get()) .minWidth(100) .alignment(Pos.CENTER_RIGHT) .build(); this.successIcon = LabelBuilder.create() .id("SuccessIcon") .build(); StackPane.setMargin(this.successIcon, new Insets(0, 0, 12, 92)); StackPane.setAlignment(this.successIcon, Pos.TOP_RIGHT); StackPane.setAlignment(this.successCounter, Pos.BOTTOM_LEFT); final StackPane successPane = StackPaneBuilder.create() .children(this.successIcon, this.successCounter) .build(); // Failure Part this.failureCounter = LabelBuilder.create() .id("FailureCounter") .font(MTFonts.COUNTER.get()) .minWidth(100) .alignment(Pos.CENTER_RIGHT) .build(); this.failureIcon = LabelBuilder.create() .id("FailureIcon") .build(); StackPane.setMargin(this.failureIcon, new Insets(0, 0, 12, 92)); StackPane.setAlignment(this.failureIcon, Pos.TOP_RIGHT); StackPane.setAlignment(this.failureCounter, Pos.BOTTOM_LEFT); final StackPane failurePane = StackPaneBuilder.create() .children(this.failureIcon, this.failureCounter) .build(); this.timer = LabelBuilder.create() .id("Timer") .text("00:00") .font(MTFonts.COUNTER.get()) .minWidth(100) .alignment(Pos.CENTER_RIGHT) .build(); // Add Part to the view root node AnchorPane.setTopAnchor(failurePane, 10.0); AnchorPane.setRightAnchor(failurePane, 20.0); AnchorPane.setTopAnchor(successPane, 10.0); AnchorPane.setRightAnchor(successPane, 200.0); AnchorPane.setTopAnchor(this.timer, 10.0); AnchorPane.setLeftAnchor(this.timer, 10.0); ap.getChildren().addAll(successPane, failurePane, this.timer); return ap; }