@Override public void start(Stage stage) throws Exception { this.stage = stage; this.root = new BorderPane(); this.root.setPadding(new Insets(20)); this.root.setTop(StackPaneBuilder.create().style("-fx-border-color:red;-fx-border-width:1px;-fx-background-color:white;").padding(new Insets(0,0,10,0)).prefHeight(100).build()); this.root.setLeft(StackPaneBuilder.create().style("-fx-border-color:red;-fx-border-width:1px;-fx-background-color:white;").prefWidth(200).build()); this.root.setBottom(StackPaneBuilder.create().style("-fx-border-color:red;-fx-border-width:1px;-fx-background-color:white;").padding(new Insets(10,0,0,0)).prefHeight(50).build()); centerContainer = StackPaneBuilder.create().style("-fx-background-color:white;").build(); this.root.setCenter(centerContainer); this.scene = new Scene(this.root); stage.setTitle("Slide To Left Demo"); stage.setWidth(1024); stage.setHeight(600); stage.setScene(this.scene); stage.show(); ScenicView.show(scene); configureSlide(); }
private void configureSlideToLeft() { StackPane container = new StackPane(); container.setMinSize(400, 250); container.setStyle("-fx-border-color:red;-fx-border-width:1px;"); StackPane basePane = new StackPane(); basePane.setStyle("-fx-background-color: linear-gradient(to bottom, #4977A3, #B0C6DA, #9CB6CF);"); HBox slidePane = HBoxBuilder.create().padding(new Insets(0,0,0,10)).build(); StackPane slideButton = StackPaneBuilder.create().style(slideButtonCss()).minWidth(30).build(); StackPane slideContent = StackPaneBuilder.create().style(slideContentCss()).children(new Label("This is check for length of the contact pane demo in slide.")).build(); slidePane.getChildren().addAll(slideButton,slideContent); HBox.setHgrow(slideContent, Priority.ALWAYS); Rectangle clipRect = new Rectangle(); container.getChildren().addAll(slidePane); root.getChildren().addAll(container); }
private void createMinus() { Path minus = PathBuilder.create() .elements(new MoveTo(0, 0), new LineTo(0, 5), new LineTo(15, 5), new LineTo(15, 0), new LineTo(0, 0)) .stroke(Color.web("#000000")) .fill(Color.web("#FFFFFF")) .strokeWidth(1) .cursor(Cursor.HAND) .build(); Circle c = CircleBuilder.create().radius(13).style("-fx-fill:-fx-base;").build() ; StackPane sp = StackPaneBuilder.create().styleClass("close-btn") .maxHeight(26).maxWidth(26) .prefHeight(26).prefWidth(26) .children(c,minus).build(); root.getChildren().add(sp); }
@Override public void start(Stage stage) throws Exception { this.stage = stage; configureScene(); configureStage(); ScrollPane bodyScroll = ScrollPaneBuilder.create().fitToHeight(true) .fitToWidth(true) .minHeight(40) .build(); VBox testvb = new VBox(); for (int i = 0; i < 30; i++) { testvb.getChildren().add(new Label("hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello ")); } bodyScroll.setContent(testvb); StackPane sp = new StackPane(); sp.setMaxHeight(200); sp.getChildren().add(bodyScroll); StackPane sp1 = StackPaneBuilder.create().translateY(20).style("-fx-background-color:#86032B;").opacity(.59).maxHeight(200).maxWidth(200).build(); root.getChildren().addAll(sp,sp1); }
private void configure(){ super.setMaxHeight(24); super.setMinWidth(200); super.setAlignment(Pos.CENTER_LEFT); super.setSpacing(5); Slider slider = new Slider(startValue, endValue, value.get()); slider.disableProperty().bind(disabled); //slider.setShowTickLabels(true); IntField intField = new IntField(startValue, endValue, value.get()); intField.disableProperty().bind(disabled); intField.valueProperty().bindBidirectional(slider.valueProperty()); value.bindBidirectional(intField.valueProperty()); intField.setPrefWidth(50); Label label = new Label(); label.setStyle("-fx-font-style:italic;"); label.textProperty().bind(lbl); getChildren().addAll(intField, StackPaneBuilder.create().children(label).prefWidth(30).alignment(Pos.CENTER_LEFT).build(), slider); }
@Override public void start(final Stage stage) throws Exception { this.stage = stage; Platform.setImplicitExit(false); configureScene(); configureStage(); StackPane sp = StackPaneBuilder .create() .maxHeight(40) .maxWidth(100) .style("-fx-background-color:red;-fx-border-width:1px;-fx-border-color:black;-fx-background-radius:5px;-fx-border-radius:5px;-fx-cursor:hand;") .children(new Label("Add Note")).build(); sp.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent arg0) { CustomPopUp p = new CustomPopUp(root); p.setTranslateX(600); p.setTranslateY(200); initEventHandlers(p); root.getChildren().add(p); } }); root.getChildren().add(sp); }
@Override public void start(Stage stage) throws Exception { ComboBox<String> comboBox = new ComboBox<>(); comboBox.setItems(FXCollections.observableArrayList(Arrays.asList("One", "Two", "Three"))); StackPane root = new StackPane(); root.getChildren().add( ScrollPaneBuilder .create() .fitToHeight(true) .fitToWidth(true) .content( StackPaneBuilder.create().minHeight(600).padding(new Insets(50, 20, 20, 20)).alignment(Pos.TOP_LEFT) .children(comboBox).build()).build()); Scene scene = new Scene(root, Color.LINEN); stage.setTitle(this.getClass().getSimpleName()); stage.setWidth(500); stage.setHeight(500); stage.setScene(scene); stage.show(); }
@Override public void start(Stage stage) throws Exception { this.stage = stage; configureScene(); configureStage(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < 150; i++) { sb.append("test "); } // Logic starts VBox vb = new VBox(); vb.setStyle("-fx-border-width:1px;-fx-border-color:red;"); vb.setPadding(new Insets(30)); Text lbl = TextBuilder.create().text(sb.toString()).wrappingWidth(150).build(); ScrollPane scroll = ScrollPaneBuilder.create().maxWidth(width).maxHeight(height).minWidth(width).minHeight(height) .content(StackPaneBuilder.create().alignment(Pos.TOP_LEFT).minHeight(400).children(lbl).build()).build(); // vb.getChildren().addAll(scroll); root.getChildren().add( GroupBuilder.create() .children(StackPaneBuilder.create().style("-fx-border-width:1px;-fx-border-color:red;").children(scroll).build()) .build()); // applySineWaveEffect(scroll); // applyCosWaveEffect(scroll); applyEffect(scroll); }
public TokenInputSearchFlowControl() { super(); this.content = this; setPadding(new Insets(3)); setSpacing(3); getStyleClass().add("tokenInput"); itemsFlowBox = new FlowPane(); itemsFlowBox.setVgap(6); itemsFlowBox.setPadding(new Insets(2,0,2,0)); StringBuilder sb = new StringBuilder("-fx-background-color:linear-gradient(from 0px -19px to 0px 0px , repeat, #EEEEEE 76% , #CCC9C1 79% , #FFF0C7 89% );"); sb.append("-fx-border-color:#CCC9C1;"); sb.append("-fx-border-width:0px 1.5px 0px 1.5px;"); sb.append("-fx-border-style: segments(62,14) phase 35;"); itemsFlowBox.setStyle(sb.toString()); getChildren().add(StackPaneBuilder.create().children(itemsFlowBox).style("-fx-background-color:#FFF0C7").padding(new Insets(0,10,3,10)).build()); configureSearchField(); }
@Override public void start(Stage stage) throws Exception { this.stage = stage; configureScene(); configureStage(); // Logic starts HBox hb = HBoxBuilder.create().padding(new Insets(15)).alignment(Pos.CENTER_LEFT).build(); SimpleVerticalScroller scroller = new SimpleVerticalScroller(); scroller.setMinHeight(300); scroller.setPrefHeight(300); hb.getChildren().add(scroller); for (int i = 0; i < 10; i++) { scroller.getItems().add(new SimpleVerticalScrollerItem(StackPaneBuilder.create().minHeight(20).maxHeight(20).style("-fx-background-color:black,yellow;-fx-background-insets:0,1;").build())); } root.setPadding(new Insets(15)); root.getChildren().add(hb); }
/** * 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; }
private void createPlus() { Path plus = PathBuilder.create() .elements(new MoveTo(5, 0), new LineTo(5, 5), new LineTo(0, 5), new LineTo(0, 10), new LineTo(5, 10), new LineTo(5, 15), new LineTo(10, 15), new LineTo(10, 10), new LineTo(15, 10), new LineTo(15, 5), new LineTo(10, 5), new LineTo(10, 0), new LineTo(5, 0)) .stroke(Color.web("#000000")) .fill(Color.web("#FFFFFF")) .strokeWidth(1) .rotate(45) .cursor(Cursor.HAND) .build(); Circle c = CircleBuilder.create().radius(13).style("-fx-fill:-fx-base;").build() ; StackPane sp = StackPaneBuilder.create() .maxHeight(26).maxWidth(26) .prefHeight(26).prefWidth(26) .children(c,plus).build(); root.getChildren().add(sp); }
@Override public void start(Stage stage) throws Exception { this.stage = stage; configureScene(); configureStage(); VBox vb = new VBox(); vb.setMaxWidth(700); StackPane header = StackPaneBuilder.create().style("-fx-background-color:orange;").prefHeight(50).build(); StackPane footer = StackPaneBuilder.create().style("-fx-background-color:orange;").children(new Label("Footer")).prefHeight(50).build(); WebView webView = new WebView(); webView.setMaxWidth(730); WebEngine webEngine = webView.getEngine(); final URL urlHello = getClass().getResource("AutoHeightCheck.html"); webEngine.load(urlHello.toExternalForm()); //webEngine.load("www.makemytrip.com"); //webEngine.loadContent(getReplacedContent("FX")); Text txt = new Text(getMainContent()); txt.setWrappingWidth(700); txt.setStyle("-fx-font-size:13px;-fx-font-family:verdana;"); StackPane txtP = new StackPane(); txtP.setPadding(new Insets(15)); txtP.getChildren().add(txt); StackPane container = new StackPane(); container.setAlignment(Pos.TOP_LEFT); container.getChildren().addAll(txtP,webView); vb.getChildren().addAll(header,container, footer); ScrollPane sp = new ScrollPane(); sp.setContent(vb); root.getChildren().add(sp); }
@Override public void start(Stage stage) throws Exception { createTrayIcon(stage); firstTime = true; Platform.setImplicitExit(false); Scene scene = new Scene(StackPaneBuilder.create().children(new TextField()).build(), 800, 600); stage.setScene(scene); stage.show(); }
private void configureScene() { root = StackPaneBuilder.create().style("-fx-border-width:0px;-fx-border-color:red;").alignment(Pos.TOP_LEFT).build(); BorderPane bp = new BorderPane(); bp.setCenter(root); bp.autosize(); this.scene = new Scene(bp, Color.TRANSPARENT); }
public CustomPopUp(StackPane parentWindow) { super(); this.parent = parentWindow; setMaxHeight(200); setMaxWidth(200); getChildren().add( StackPaneBuilder.create().style(style).minHeight(200).minWidth(200).alignment(Pos.TOP_RIGHT) .children(ButtonBuilder.create().text("Close").onAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent paramT) { parent.getChildren().remove(CustomPopUp.this); } }).build(), TextFieldBuilder.create().translateY(20).build()).build()); }
@SuppressWarnings("unchecked") private void configureTable(StackPane 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")); final TableView<MyDomain> table = new TableView<MyDomain>(); table.setManaged(true); TableColumn<MyDomain, String> titleColumn = new TableColumn<MyDomain, String>("Title"); titleColumn.setPrefWidth(125); titleColumn.setCellValueFactory(new PropertyValueFactory<MyDomain, String>("name")); titleColumn.sortTypeProperty().addListener(new ChangeListener<SortType>() { @Override public void changed(ObservableValue<? extends SortType> arg0, SortType arg1, SortType arg2) { System.out.println(arg2); } }); TableColumn<MyDomain, String> descCol = new TableColumn<MyDomain, String>("Description"); descCol.setPrefWidth(200); descCol.setCellValueFactory(new PropertyValueFactory<MyDomain, String>("description")); TableColumn<MyDomain, String> colorCol = new TableColumn<MyDomain, String>("Color"); colorCol.setPrefWidth(200); colorCol.setCellValueFactory(new PropertyValueFactory<MyDomain, String>("color")); table.getColumns().addAll(titleColumn, descCol, colorCol); table.itemsProperty().addListener(new ChangeListener<ObservableList<MyDomain>>() { @Override public void changed(ObservableValue<? extends ObservableList<MyDomain>> paramObservableValue, ObservableList<MyDomain> paramT1, ObservableList<MyDomain> paramT2) { table.setPrefHeight((table.getItems().size()*25) + 25); }}); table.setItems(data); VBox vb = new VBox(); vb.getChildren().addAll(StackPaneBuilder.create().prefHeight(100).style("-fx-background-color:red;").build(), table, StackPaneBuilder.create().prefHeight(100).style("-fx-background-color:blue;").build()); root.getChildren().add(vb); }
private void configureScene() { root = StackPaneBuilder.create().style("-fx-border-width:1px;-fx-border-color:red;").build(); BorderPane bp = new BorderPane(); bp.setCenter(root); bp.autosize(); this.scene = new Scene(bp, Color.TRANSPARENT); }
public CustomPopUp() { super(); getContent().add( StackPaneBuilder.create().style(style).minHeight(200).minWidth(200).alignment(Pos.TOP_RIGHT) .children(ButtonBuilder.create().text("Close").onAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent paramT) { CustomPopUp.this.hide(); } }).build(), TextFieldBuilder.create().translateY(20).build()).build()); }
private void configureScene() { root = StackPaneBuilder.create().style("-fx-border-width:1px;-fx-border-color:red;").alignment(Pos.TOP_LEFT).build(); BorderPane bp = new BorderPane(); bp.setCenter(root); bp.autosize(); this.scene = new Scene(bp, Color.TRANSPARENT); }
private void configureScene(){ root = new VBox(); root.setMaxWidth(100); root.setStyle("-fx-border-width:1px;-fx-border-color:red;"); this.scene = new Scene(StackPaneBuilder.create().padding(new Insets(200)).children(root).build(), Color.LEMONCHIFFON); scene.getStylesheets().add("styles/customTextArea.css"); }
private void openStage(Image image){ StackPane sp = new StackPane(); sp.setStyle("-fx-border-color:red;-fx-border-width:1px;"); sp.setMaxSize(100, 100); sp.getChildren().add(new ImageView(image)); Stage stg = new Stage(); stg.setWidth(440); stg.setHeight(470); stg.setScene(new Scene(StackPaneBuilder.create().children(sp).build())); stg.show(); }
@Override public void start(Stage stage) throws Exception { this.stage = stage; configureScene(); configureStage(); final Button btn = new Button("Show Pop Up"); btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { Popup popup = new Popup(); popup.setAutoHide(true); popup.setAutoFix(true); popup.setHideOnEscape(true); VBox listView = new VBox(); for (int i = 0; i < 20; i++) { listView.getChildren().add(StackPaneBuilder.create().prefHeight(40).children(new Label("Hello")).build()); } ScrollPane scrollPane = new ScrollPane(); scrollPane.setPrefHeight(200); scrollPane.setPrefWidth(200); scrollPane.setContent(listView); popup.getContent().add(scrollPane); Point2D d = FXTools.getAbsoluteStartPointOfNode(btn); popup.show(btn, d.getX(), d.getY()); } }); root.getChildren().add(btn); }
private StackPane getBox(String effectStr){ StackPane sp3 = StackPaneBuilder.create() .minHeight(200) .minWidth(200) .style("-fx-border-width:1px;"+ "-fx-border-color:red;"+effectStr).build(); return sp3; }
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); }
@Override public void start(Stage stage) throws Exception { this.stage = stage; configureScene(); configureStage(); // Logic starts StackPane dock = StackPaneBuilder.create().alignment(Pos.TOP_LEFT).build(); StackPane content = StackPaneBuilder.create().style("-fx-background-color:red;").build(); ResizablePane pane = new ResizablePane(dock,content); pane.setMaxSize(200, 200); dock.getChildren().add(pane); root.setPadding(new Insets(15)); root.getChildren().add(dock); }
private void configureSearchControl() { final List<String> allItems = Arrays.asList("2005 In Year Of Decision For Long length", "2006 In Year Of Decision short length", "2007 In Year Of Decision Vary", "2008 In Year Of", "2009 In Year Of In", "2010 In Year Of DFutheru lengh of the gate for me", "2011 In Year Of Diamond", "2012 In Year Of Gold hill for the", "2013 In Yea", "2014 In Year Of Decision chdil in the forui", "2015 In Year Of Decision"); final TokenInputSearchFlowControl<String> control = new TokenInputSearchFlowControl<String>(); EventHandler<ActionEvent> searchEvent = new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { ObservableList<String> selectedStr = control.getChosenItems(); Set<Integer> yearList = new HashSet<Integer>(); for (String str : selectedStr) { yearList.add(Integer.parseInt( str.substring(0,4))); } searchByYear(yearList); } }; control.setSearchEvent(searchEvent); control.inputText().addListener(new ChangeListener<String>() { public void changed(ObservableValue<? extends String> source, String oldValue, String newValue) { control.getAvailableItems().clear(); for (String item : allItems) { if (item.toLowerCase().contains(newValue)) { control.getAvailableItems().add(item); } } control.getAvailableItemsSelectionModel().selectFirst(); } }); root.getChildren().add(StackPaneBuilder.create().style("-fx-background-color:#85B5D9;-fx-background-radius:5 5 0 0;") .styleClass("drop-shadow") .padding(new Insets(6)) .children(control).build()); }
private void configureTable() { TableView<TokenInputData> tableView = new TableView<TokenInputData>(); tableView.setItems(tableData); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); TableColumn<TokenInputData, String> column1 = new TableColumn<TokenInputData, String>("Title"); column1.setCellValueFactory(new PropertyValueFactory<TokenInputData, String>("title")); TableColumn<TokenInputData, String> column2 = new TableColumn<TokenInputData, String>("Description"); column2.setCellValueFactory(new PropertyValueFactory<TokenInputData, String>("description")); TableColumn<TokenInputData, Integer> column3 = new TableColumn<TokenInputData, Integer>("Year"); column3.setCellValueFactory(new PropertyValueFactory<TokenInputData, Integer>("year")); tableView.getColumns().addAll(column1, column2, column3); root.getChildren().add(StackPaneBuilder.create().style("-fx-background-color:#FFFFFF;-fx-background-radius:0 0 5 5;") .padding(new Insets(20,8,8,8)) .children(tableView).build()); }
private void configure(){ setAlignment(Pos.TOP_LEFT); this.textArea =new TextArea(){ protected void layoutChildren() { super.layoutChildren(); if(content==null){ content = (Region)lookup(".content"); contentHeight.bind(content.heightProperty()); content.heightProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> paramObservableValue, Number paramT1, Number paramT2) { //System.out.println("Content View Height :"+paramT2.doubleValue()); } }); } }; }; this.textArea.setWrapText(true); this.label =new Text(); //this.label.prefWidthProperty().bind(this.textArea.widthProperty()); //this.label.textProperty().bind(this.textArea.textProperty()); label.textProperty().bind(new StringBinding() { { bind(textArea.textProperty()); } @Override protected String computeValue() { /*if(textArea.getText()!=null && textArea.getText().length()>0){ if(!((Character)textArea.getText().charAt(textArea.getText().length()-1)).equals(enterChar)){ System.out.println("enter added.."); return textArea.getText()+enterChar; } }*/ return textArea.getText(); } }); lblContainer = StackPaneBuilder.create() .alignment(Pos.TOP_LEFT) .padding(new Insets(4,14,7,7)) .children(label) .build(); lblContainer2 = StackPaneBuilder.create() .alignment(Pos.TOP_LEFT) .children(lblContainer) .build(); // Binding the container width to the TextArea width. //lblContainer.maxWidthProperty().bind(widthProperty()); lblContainer2.maxWidthProperty().bind(textArea.widthProperty()); lblContainer2.minWidthProperty().bind(textArea.widthProperty()); lblContainer2.prefWidthProperty().bind(textArea.widthProperty()); this.label.wrappingWidthProperty().bind(lblContainer2.widthProperty()); textArea.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> paramObservableValue, String paramT1, String value) { layoutForNewLine(textArea.getText()); } }); /*label.heightProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> paramObservableValue, Number paramT1, Number paramT2) { layoutForNewLine(textArea.getText()); } });*/ getChildren().addAll(lblContainer2,textArea); }
/** * 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; }