Java Code Examples for javafx.scene.control.ScrollPane#setContent()
The following examples show how to use
javafx.scene.control.ScrollPane#setContent() .
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: LogsView.java From trex-stateless-gui with Apache License 2.0 | 6 votes |
private void buildUI() { contentWrapper = new ScrollPane(); contentWrapper.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); getChildren().add(contentWrapper); setTopAnchor(contentWrapper, 0d); setLeftAnchor(contentWrapper, 0d); setBottomAnchor(contentWrapper, 0d); setRightAnchor(contentWrapper, 0d); logsContent = new VBox(); logsContent.setId("logs_view"); logsContent.heightProperty().addListener((observable, oldValue, newValue) -> contentWrapper.setVvalue((Double) newValue)); logsContent.setSpacing(5); contentWrapper.setContent(logsContent); }
Example 2
Source File: MaterialDesignIconDemo.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
@Override public void start(Stage primaryStage) { ScrollPane scrollPane = new ScrollPane(); scrollPane.setFitToWidth(true); FlowPane flowPane = new FlowPane(); flowPane.setStyle("-fx-background-color: #ddd;"); flowPane.setHgap(2); flowPane.setVgap(2); List<MaterialDesignIcon> values = new ArrayList<>(Arrays.asList(MaterialDesignIcon.values())); values.sort(Comparator.comparing(Enum::name)); for (MaterialDesignIcon icon : values) { Button button = MaterialDesignIconFactory.get().createIconButton(icon, icon.name()); flowPane.getChildren().add(button); } scrollPane.setContent(flowPane); primaryStage.setScene(new Scene(scrollPane, 1200, 950)); primaryStage.show(); }
Example 3
Source File: ProposalDisplay.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
@SuppressWarnings("Duplicates") public ScrollPane getView() { ScrollPane scrollPane = new ScrollPane(); scrollPane.setFitToWidth(true); scrollPane.setFitToHeight(true); AnchorPane anchorPane = new AnchorPane(); scrollPane.setContent(anchorPane); gridPane.setHgap(5); gridPane.setVgap(5); ColumnConstraints columnConstraints1 = new ColumnConstraints(); columnConstraints1.setPercentWidth(100); gridPane.getColumnConstraints().addAll(columnConstraints1); AnchorPane.setBottomAnchor(gridPane, 10d); AnchorPane.setRightAnchor(gridPane, 10d); AnchorPane.setLeftAnchor(gridPane, 10d); AnchorPane.setTopAnchor(gridPane, 10d); anchorPane.getChildren().add(gridPane); return scrollPane; }
Example 4
Source File: AnamationSequencer.java From BowlerStudio with GNU General Public License v3.0 | 5 votes |
@Override public void initializeUI(BowlerAbstractDevice pm) { // TODO Auto-generated method stub gui.setConnection(pm); SwingNode sn = new SwingNode(); sn.setContent(gui); ScrollPane s1 = new ScrollPane(); s1.setContent(sn); setContent(s1); setText("Anamation Sequencer"); onTabReOpening(); }
Example 5
Source File: WebBrowserImpl.java From netbeans with Apache License 2.0 | 5 votes |
void _resize( final double width, final double height ) { if( !(container.getScene().getRoot() instanceof ScrollPane) ) { ScrollPane scroll = new ScrollPane(); scroll.setContent( browser ); container.getScene().setRoot( scroll ); } browser.setMaxWidth( width ); browser.setMaxHeight( height ); browser.setMinWidth( width ); browser.setMinHeight( height ); }
Example 6
Source File: BreakingNewsDemo.java From htm.java-examples with GNU Affero General Public License v3.0 | 5 votes |
public void configureView() { view = new BreakingNewsDemoView(); view.autoModeProperty().addListener((v, o, n) -> { this.mode = n; }); this.mode = view.autoModeProperty().get(); view.startActionProperty().addListener((v, o, n) -> { if(n) { if(mode == Mode.AUTO) cursor++; start(); }else{ stop(); } }); view.runOneProperty().addListener((v, o, n) -> { this.cursor += n.intValue(); runOne(jsonList.get(cursor), cursor); }); view.flipStateProperty().addListener((v, o, n) -> { view.flipPaneProperty().get().flip(); }); view.setPrefSize(1370, 1160); view.setMinSize(1370, 1160); mainViewScroll = new ScrollPane(); mainViewScroll.setViewportBounds(new BoundingBox(0, 0, 1370, 1160)); mainViewScroll.setHbarPolicy(ScrollBarPolicy.NEVER); mainViewScroll.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); mainViewScroll.setContent(view); mainViewScroll.viewportBoundsProperty().addListener((v, o, n) -> { view.setPrefSize(Math.max(1370, n.getMaxX()), Math.max(1160, n.getMaxY()));//1370, 1160); }); createDataStream(); createAlgorithm(); }
Example 7
Source File: Story.java From mars-sim with GNU General Public License v3.0 | 5 votes |
/** @return content wrapped in a vertical, pannable scroll pane. */ private ScrollPane makeScrollable(final Control content) { final ScrollPane scroll = new ScrollPane(); scroll.setContent(content); scroll.setPannable(true); scroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scroll.viewportBoundsProperty().addListener(new ChangeListener<Bounds>() { @Override public void changed(ObservableValue<? extends Bounds> observableValue, Bounds oldBounds, Bounds newBounds) { content.setPrefWidth(newBounds.getWidth() - 10); } }); return scroll; }
Example 8
Source File: ChatBoxTimed.java From mars-sim with GNU General Public License v3.0 | 5 votes |
@Override public void start(Stage primaryStage) { final Clock clock = new Clock(Duration.seconds(1), true); final BorderPane root = new BorderPane(); final HBox controls = new HBox(5); controls.setAlignment(Pos.CENTER); controls.setPadding(new Insets(10)); final TextField itemField = new TextField(); itemField.setTooltip(new Tooltip("Type an item and press Enter")); controls.getChildren().add(itemField); final VBox items = new VBox(5); itemField.setOnAction(event -> { String text = itemField.getText(); Label label = new Label(); label.textProperty().bind(Bindings.format("%s (%s)", text, clock.getElapsedStringBinding())); items.getChildren().add(label); itemField.setText(""); }); final ScrollPane scroller = new ScrollPane(); scroller.setContent(items); final Label currentTimeLabel = new Label(); currentTimeLabel.textProperty().bind(Bindings.format("Current time: %s", clock.getTimeStringBinding())); root.setTop(controls); root.setCenter(scroller); root.setBottom(currentTimeLabel); Scene scene = new Scene(root, 600, 400); primaryStage.setTitle("Timed item display"); primaryStage.setScene(scene); primaryStage.show(); }
Example 9
Source File: PannableView.java From mars-sim with GNU General Public License v3.0 | 5 votes |
/** @return a ScrollPane which scrolls the layout. */ private ScrollPane createScrollPane(Pane layout) { ScrollPane scroll = new ScrollPane(); scroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scroll.setPannable(true); scroll.setPrefSize(800, 600); scroll.setContent(layout); return scroll; }
Example 10
Source File: CImageDisplay.java From Open-Lowcode with Eclipse Public License 2.0 | 4 votes |
@Override public void forceUpdateData(DataElt dataelt) { if (dataelt == null) throw new RuntimeException(String.format("data element is null")); if (!dataelt.getType().printType().equals(inlineactiondataref.getType())) throw new RuntimeException( String.format("inline data with name = %s does not have expected %s type, actually found %s", inlineactiondataref.getName(), inlineactiondataref.getType(), dataelt.getType())); LargeBinaryDataElt largefileelt = (LargeBinaryDataElt) dataelt; largefile = largefileelt.getPayload(); if (!largefile.isEmpty()) { final Stage imagepopup = new Stage(); imagepopup.initModality(Modality.APPLICATION_MODAL); imagepopup.initOwner(actionmanager.getClientSession().getMainFrame().getPrimaryStage()); Image image = new Image(new ByteArrayInputStream(largefile.getContent())); ImageView imageview = new ImageView(image); imageview.setFitWidth(image.getWidth()); imageview.setFitHeight(image.getHeight()); imageview.setOnMousePressed(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent arg0) { FileChooser filechooser = new FileChooser(); filechooser.setTitle("Save image to file"); filechooser.setInitialFileName(largefile.getFileName()); filechooser.getExtensionFilters() .add(new FileChooser.ExtensionFilter("PNG files (*.PNG)", "*.PNG")); File file = filechooser.showSaveDialog(imagepopup); if (file != null) { try { FileOutputStream fos = new FileOutputStream(file, false); fos.write(largefile.getContent()); fos.close(); imagepopup.close(); } catch (IOException e) { logger.warning("Error writing file " + e.getMessage()); for (int i = 0; i < e.getStackTrace().length; i++) logger.warning(" " + e.getStackTrace()[i]); } } } }); ScrollPane scrollpane = new ScrollPane(); scrollpane.setContent(imageview); Scene dialogscene = new Scene(scrollpane); imagepopup.setScene(dialogscene); imagepopup.show(); imageview.requestFocus(); } }
Example 11
Source File: TradeStepView.java From bisq with GNU Affero General Public License v3.0 | 4 votes |
protected TradeStepView(PendingTradesViewModel model) { this.model = model; preferences = model.dataModel.preferences; trade = model.dataModel.getTrade(); checkNotNull(trade, "Trade must not be null at TradeStepView"); ScrollPane scrollPane = new ScrollPane(); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); scrollPane.setFitToHeight(true); scrollPane.setFitToWidth(true); AnchorPane.setLeftAnchor(scrollPane, 10d); AnchorPane.setRightAnchor(scrollPane, 10d); AnchorPane.setTopAnchor(scrollPane, 10d); AnchorPane.setBottomAnchor(scrollPane, 0d); getChildren().add(scrollPane); gridPane = new GridPane(); gridPane.setHgap(Layout.GRID_GAP); gridPane.setVgap(Layout.GRID_GAP); ColumnConstraints columnConstraints1 = new ColumnConstraints(); columnConstraints1.setHgrow(Priority.ALWAYS); ColumnConstraints columnConstraints2 = new ColumnConstraints(); columnConstraints2.setHgrow(Priority.ALWAYS); gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2); scrollPane.setContent(gridPane); AnchorPane.setLeftAnchor(this, 0d); AnchorPane.setRightAnchor(this, 0d); AnchorPane.setTopAnchor(this, -10d); AnchorPane.setBottomAnchor(this, 0d); addContent(); errorMessageListener = (observable, oldValue, newValue) -> { if (newValue != null) new Popup().error(newValue).show(); }; clockListener = new ClockWatcher.Listener() { @Override public void onSecondTick() { } @Override public void onMinuteTick() { updateTimeLeft(); } }; }
Example 12
Source File: OnlyPopupOverFrame.java From oim-fx with MIT License | 4 votes |
private void init() { this.setTitle("测试"); this.setWidth(380); this.setHeight(300); this.setRadius(10); this.setCenter(rootVBox); topBox.setPrefHeight(20); rootVBox.setStyle("-fx-background-color:rgba(255, 255, 255, 1)"); rootVBox.getChildren().add(topBox); rootVBox.getChildren().add(centerBox); button.setPrefHeight(70); button.setPrefWidth(200); button.setLayoutX(20); button.setLayoutY(140); centerBox.getChildren().add(button); // po.setDetached(false); // po.setDetachable(false); po.setArrowLocation(OnlyPopupOver.ArrowLocation.TOP_CENTER); po.setContentNode(createContent()); po.setArrowSize(0); StackPane sp = new StackPane(); // autoCheckBox.setFocusTraversable(true); ScrollPane scrollPane = new ScrollPane(); scrollPane.setBackground(Background.EMPTY); scrollPane.setMinWidth(150); scrollPane.setPrefWidth(250); scrollPane.setPrefHeight(360); scrollPane.setContent(sp); // scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.widthProperty().addListener((Observable observable) -> { // sp.setPrefWidth(scrollPane.getWidth()-20); }); }
Example 13
Source File: VertexGraphLabelsEditorFactory.java From constellation with Apache License 2.0 | 4 votes |
@Override protected Node createEditorControls() { // get all vertex attributes currently in the graph final ReadableGraph rg = GraphManager.getDefault().getActiveGraph().getReadableGraph(); try { for (int i = 0; i < rg.getAttributeCount(GraphElementType.VERTEX); i++) { attributeNames.add(rg.getAttributeName(rg.getAttribute(GraphElementType.VERTEX, i))); } } finally { rg.release(); } attributeNames.sort(String::compareTo); HBox labelTitles = new HBox(); final Label attrLabel = new Label("Attribute"); attrLabel.setAlignment(Pos.CENTER); attrLabel.setPrefWidth(150); final Label colorLabel = new Label("Colour"); colorLabel.setPrefWidth(40); colorLabel.setAlignment(Pos.CENTER); final Label sizeLabel = new Label("Size"); sizeLabel.setPrefWidth(50); sizeLabel.setAlignment(Pos.CENTER); final Label positionLabel = new Label("Position"); positionLabel.setPrefWidth(115); positionLabel.setAlignment(Pos.CENTER); labelTitles.getChildren().addAll(attrLabel, colorLabel, sizeLabel, positionLabel); labelPaneContent.setPadding(new Insets(5)); labelPaneContent.getChildren().addAll(labelTitles, labelEntries); final ScrollPane labelsScrollPane = new ScrollPane(); labelsScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); labelsScrollPane.setPrefHeight(200); labelsScrollPane.setPrefWidth(400); labelsScrollPane.setContent(labelPaneContent); addButton.setOnAction(e -> { new LabelEntry(labels, labelEntries, attributeNames.isEmpty() ? "" : attributeNames.get(0), ConstellationColor.LIGHT_BLUE, 1); addButton.setDisable(labels.size() == GraphLabels.MAX_LABELS); update(); }); final Label addButtonLabel = new Label("Add Label"); final FlowPane addPane = new FlowPane(); addPane.setHgap(10); addPane.setAlignment(Pos.CENTER_RIGHT); addPane.getChildren().addAll(addButtonLabel, addButton); final VBox controls = new VBox(10); controls.setPrefWidth(400); controls.getChildren().addAll(labelsScrollPane, addPane); return controls; }
Example 14
Source File: SelectSongsDialog.java From Quelea with GNU General Public License v3.0 | 4 votes |
/** * Create a new imported songs dialog. * <p/> * @param text a list of lines to be shown in the dialog. * @param acceptText text to place on the accpet button. * @param checkboxText text to place in the column header for the * checkboxes. */ public SelectSongsDialog(String[] text, String acceptText, String checkboxText) { initModality(Modality.APPLICATION_MODAL); setTitle(LabelGrabber.INSTANCE.getLabel("select.songs.title")); checkBoxes = new ArrayList<>(); selectAllCheckBox = new CheckBox(); selectAllCheckBox.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) { for(CheckBox checkBox : checkBoxes) { checkBox.setSelected(t1); } } }); VBox mainPanel = new VBox(5); VBox textBox = new VBox(); for(String str : text) { textBox.getChildren().add(new Label(str)); } VBox.setMargin(textBox, new Insets(10)); mainPanel.getChildren().add(textBox); gridPane = new GridPane(); gridPane.setHgap(5); gridPane.setVgap(5); gridScroll = new ScrollPane(); VBox.setVgrow(gridScroll, Priority.ALWAYS); VBox scrollContent = new VBox(10); HBox topBox = new HBox(5); Label checkAllLabel = new Label(LabelGrabber.INSTANCE.getLabel("check.uncheck.all.text")); checkAllLabel.setStyle("-fx-font-weight: bold;"); topBox.getChildren().add(selectAllCheckBox); topBox.getChildren().add(checkAllLabel); scrollContent.getChildren().add(topBox); scrollContent.getChildren().add(gridPane); StackPane intermediatePane = new StackPane(); StackPane.setMargin(scrollContent, new Insets(10)); intermediatePane.getChildren().add(scrollContent); gridScroll.setContent(intermediatePane); gridScroll.setFitToWidth(true); gridScroll.setFitToHeight(true); mainPanel.getChildren().add(gridScroll); addButton = new Button(acceptText, new ImageView(new Image("file:icons/tick.png"))); StackPane stackAdd = new StackPane(); stackAdd.getChildren().add(addButton); VBox.setMargin(stackAdd, new Insets(10)); mainPanel.getChildren().add(stackAdd); Scene scene = new Scene(mainPanel, 800, 600); if (QueleaProperties.get().getUseDarkTheme()) { scene.getStylesheets().add("org/modena_dark.css"); } setScene(scene); }
Example 15
Source File: FilterChunksDialog.java From mcaselector with MIT License | 4 votes |
public FilterChunksDialog(Stage primaryStage) { titleProperty().bind(Translation.DIALOG_FILTER_CHUNKS_TITLE.getProperty()); initStyle(StageStyle.UTILITY); getDialogPane().getStyleClass().add("filter-dialog-pane"); setResultConverter(p -> p == ButtonType.OK ? new Result(value, getHandleType(), selectionOnly.isSelected(), radius) : null); //apply same stylesheets to this dialog getDialogPane().getStylesheets().addAll(primaryStage.getScene().getStylesheets()); getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL); select.setTooltip(UIFactory.tooltip(Translation.DIALOG_FILTER_CHUNKS_SELECT_TOOLTIP)); export.setTooltip(UIFactory.tooltip(Translation.DIALOG_FILTER_CHUNKS_EXPORT_TOOLTIP)); delete.setTooltip(UIFactory.tooltip(Translation.DIALOG_FILTER_CHUNKS_DELETE_TOOLTIP)); toggleGroup.getToggles().addAll(select, export, delete); toggleGroup.selectedToggleProperty().addListener(l -> { selectionOnly.setDisable(select.isSelected()); selectionOnlyLabel.setDisable(select.isSelected()); selectionRadius.setDisable(!select.isSelected()); selectionRadiusLabel.setDisable(!select.isSelected()); }); select.fire(); setResizable(true); ScrollPane scrollPane = new ScrollPane(); scrollPane.setContent(groupFilterBox); groupFilterBox.prefWidthProperty().bind(scrollPane.prefWidthProperty()); groupFilterBox.setOnUpdate(f -> { getDialogPane().lookupButton(ButtonType.OK).setDisable(!value.isValid()); if (value.isValid()) { filterQuery.setText(value.toString()); } }); filterQuery.setText(gf.toString()); filterQuery.setOnAction(e -> { FilterParser fp = new FilterParser(filterQuery.getText()); try { gf = fp.parse(); gf = FilterParser.unwrap(gf); Debug.dumpf("parsed filter query from: %s, to: ", filterQuery.getText(), gf); value = gf; groupFilterBox.setFilter(gf); } catch (ParseException ex) { Debug.dumpf("failed to parse filter query from: %s, error: %s", filterQuery.getText(), ex.getMessage()); } }); selectionRadius.textProperty().addListener((a, o, n) -> onSelectionRadiusInput(o, n)); VBox actionBox = new VBox(); actionBox.getChildren().addAll(select, export, delete); GridPane optionBox = new GridPane(); optionBox.getStyleClass().add("filter-dialog-option-box"); optionBox.add(selectionOnlyLabel, 0, 0, 1, 1); optionBox.add(withStackPane(selectionOnly), 1, 0, 1, 1); optionBox.add(selectionRadiusLabel, 0, 1, 1, 1); optionBox.add(withStackPane(selectionRadius), 1, 1, 1, 1); HBox selectionBox = new HBox(); selectionBox.getChildren().addAll(actionBox, optionBox); VBox box = new VBox(); box.getChildren().addAll(scrollPane, new Separator(), filterQuery, new Separator(), selectionBox); getDialogPane().setContent(box); }
Example 16
Source File: ConsoleView.java From ARMStrong with Mozilla Public License 2.0 | 4 votes |
/** * Creates a new instance of a console and redirect the java output to it */ public ConsoleView() { try { mainPane = FXMLLoader.load(getClass().getResource("/resources/ConsoleView.fxml")); } catch (IOException e) { e.printStackTrace(); } this.dockNode = new DockNode(mainPane, "Console", new ImageView(dockImage)); this.dockNode.setPrefSize(1000, 1500); this.dockNode.setClosable(false); dockNode.setMaxHeight(300); //mmm this.mainPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); this.dockNode.getStylesheets().add("/resources/style.css"); ScrollPane scrollPane = (ScrollPane) mainPane.lookup("#scrollPane"); this.textField = new TextField(); this.textField.setId("consoleInput"); this.mainPane.getChildren().add(this.textField); AnchorPane.setBottomAnchor(this.textField, (double)0); AnchorPane.setLeftAnchor(this.textField, (double)23); AnchorPane.setRightAnchor(this.textField, (double)0); this.textFlow = new TextFlow(); this.textFlow.setPadding(new Insets(5)); this.textFlow.setId("textConsole"); scrollPane.setContent(this.textFlow); output = new OutputStream() { private ConcurrentLinkedQueue<Character> consoleBuffer = new ConcurrentLinkedQueue<>(); @Override public void write(int b) throws IOException { this.consoleBuffer.add((char)b); if (b == '\n') { ArrayList<Byte> list = new ArrayList<>(); while (!this.consoleBuffer.peek().equals('\n')) { list.add((byte) (char) this.consoleBuffer.poll()); } list.add((byte) (char) this.consoleBuffer.poll()); String currentLine = new String(Bytes.toArray(list), "ASCII"); Platform.runLater(() -> { textFlow.getChildren().add(new Text(currentLine)); scrollPane.setVvalue(scrollPane.getHmax()); if (textFlow.getChildren().size() > 100) { textFlow.getChildren().clear(); } }); } } }; }
Example 17
Source File: MainLayout.java From redtorch with MIT License | 4 votes |
private void createLayout() { vBox.getChildren().add(crearteMainMenuBar()); // 左右切分布局------------------------ SplitPane horizontalSplitPane = new SplitPane(); horizontalSplitPane.setDividerPositions(0.5); vBox.getChildren().add(horizontalSplitPane); VBox.setVgrow(horizontalSplitPane, Priority.ALWAYS); // 左右切分布局----左侧上下切分布局--------- SplitPane leftVerticalSplitPane = new SplitPane(); leftVerticalSplitPane.setDividerPositions(0.4); horizontalSplitPane.getItems().add(leftVerticalSplitPane); leftVerticalSplitPane.setOrientation(Orientation.VERTICAL); // 左右切分布局----左侧上下切分布局----上布局----- SplitPane leftTopHorizontalSplitPane = new SplitPane(); leftVerticalSplitPane.getItems().add(leftTopHorizontalSplitPane); HBox leftTopRithtPane = new HBox(); Node orderPanelLayoutNode = orderPanelLayout.getNode(); HBox.setHgrow(orderPanelLayoutNode, Priority.ALWAYS); ScrollPane marketDetailsScrollPane = new ScrollPane(); Node marketDetailsNode = marketDetailsLayout.getNode(); marketDetailsScrollPane.setContent(marketDetailsNode); marketDetailsScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); marketDetailsScrollPane.setPrefWidth(253); marketDetailsScrollPane.setMinWidth(253); marketDetailsScrollPane.setMaxWidth(253); leftTopRithtPane.getChildren().addAll(marketDetailsScrollPane, orderPanelLayoutNode); leftTopRithtPane.setMaxWidth(680); leftTopRithtPane.setPrefWidth(680); leftTopHorizontalSplitPane.getItems().addAll(tickLayout.getNode(), leftTopRithtPane); SplitPane.setResizableWithParent(leftTopRithtPane, false); // 左右切分布局----左侧上下切分布局----下布局----- TabPane leftBootomTabPane = new TabPane(); leftVerticalSplitPane.getItems().add(leftBootomTabPane); Tab orderTab = new Tab("定单"); leftBootomTabPane.getTabs().add(orderTab); orderTab.setClosable(false); orderTab.setContent(orderLayout.getNode()); Tab tradeTab = new Tab("成交"); leftBootomTabPane.getTabs().add(tradeTab); tradeTab.setClosable(false); tradeTab.setContent(tradeLayout.getNode()); // 左右切分布局----右侧TAB布局------------- TabPane rightTabPane = new TabPane(); horizontalSplitPane.getItems().add(rightTabPane); Tab portfolioInvestmentTab = new Tab("投资组合"); rightTabPane.getTabs().add(portfolioInvestmentTab); portfolioInvestmentTab.setClosable(false); SplitPane portfolioVerticalSplitPane = new SplitPane(); portfolioInvestmentTab.setContent(portfolioVerticalSplitPane); portfolioVerticalSplitPane.setOrientation(Orientation.VERTICAL); VBox.setVgrow(portfolioVerticalSplitPane, Priority.ALWAYS); VBox portfolioVBox = new VBox(); portfolioVBox.getChildren().add(combinationLayout.getNode()); portfolioVBox.getChildren().add(accountLayout.getNode()); VBox.setVgrow(accountLayout.getNode(), Priority.ALWAYS); portfolioVerticalSplitPane.getItems().add(portfolioVBox); portfolioVerticalSplitPane.getItems().add(positionLayout.getNode()); Tab allContractTab = new Tab("全部合约"); allContractTab.setContent(contractLayout.getNode()); rightTabPane.getTabs().add(allContractTab); allContractTab.setClosable(false); // 状态栏------------------------------ vBox.getChildren().add(createStatusBar()); }
Example 18
Source File: HTMLEditorSample.java From marathonv5 with Apache License 2.0 | 4 votes |
public HTMLEditorSample() { VBox vRoot = new VBox(); vRoot.setPadding(new Insets(8, 8, 8, 8)); vRoot.setSpacing(5); htmlEditor = new HTMLEditor(); htmlEditor.setPrefSize(500, 245); htmlEditor.setHtmlText(INITIAL_TEXT); vRoot.getChildren().add(htmlEditor); final Label htmlLabel = new Label(); htmlLabel.setMaxWidth(500); htmlLabel.setWrapText(true); ScrollPane scrollPane = new ScrollPane(); scrollPane.getStyleClass().add("noborder-scroll-pane"); scrollPane.setContent(htmlLabel); scrollPane.setFitToWidth(true); scrollPane.setPrefHeight(180); Button showHTMLButton = new Button("Show the HTML below"); vRoot.setAlignment(Pos.CENTER); showHTMLButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { htmlLabel.setText(htmlEditor.getHtmlText()); } }); vRoot.getChildren().addAll(showHTMLButton, scrollPane); getChildren().addAll(vRoot); // REMOVE ME // Workaround for RT-16781 - HTML editor in full screen has wrong border javafx.scene.layout.GridPane grid = (javafx.scene.layout.GridPane)htmlEditor.lookup(".html-editor"); for(javafx.scene.Node child: grid.getChildren()) { javafx.scene.layout.GridPane.setHgrow(child, javafx.scene.layout.Priority.ALWAYS); } // END REMOVE ME }
Example 19
Source File: HTMLEditorSample.java From marathonv5 with Apache License 2.0 | 4 votes |
public HTMLEditorSample() { VBox vRoot = new VBox(); vRoot.setPadding(new Insets(8, 8, 8, 8)); vRoot.setSpacing(5); htmlEditor = new HTMLEditor(); htmlEditor.setPrefSize(500, 245); htmlEditor.setHtmlText(INITIAL_TEXT); vRoot.getChildren().add(htmlEditor); final Label htmlLabel = new Label(); htmlLabel.setMaxWidth(500); htmlLabel.setWrapText(true); ScrollPane scrollPane = new ScrollPane(); scrollPane.getStyleClass().add("noborder-scroll-pane"); scrollPane.setContent(htmlLabel); scrollPane.setFitToWidth(true); scrollPane.setPrefHeight(180); Button showHTMLButton = new Button("Show the HTML below"); vRoot.setAlignment(Pos.CENTER); showHTMLButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { htmlLabel.setText(htmlEditor.getHtmlText()); } }); vRoot.getChildren().addAll(showHTMLButton, scrollPane); getChildren().addAll(vRoot); // REMOVE ME // Workaround for RT-16781 - HTML editor in full screen has wrong border javafx.scene.layout.GridPane grid = (javafx.scene.layout.GridPane)htmlEditor.lookup(".html-editor"); for(javafx.scene.Node child: grid.getChildren()) { javafx.scene.layout.GridPane.setHgrow(child, javafx.scene.layout.Priority.ALWAYS); } // END REMOVE ME }
Example 20
Source File: ConsolidatedDialog.java From constellation with Apache License 2.0 | 4 votes |
/** * A generic multiple matches dialog which can be used to display a * collection of ObservableList items * * @param title The title of the dialog * @param observableMap The map of {@code ObservableList} objects * @param message The (help) message that will be displayed at the top of * the dialog window * @param listItemHeight The height of each list item. If you have a single * row of text then set this to 24. */ public ConsolidatedDialog(String title, Map<String, ObservableList<Container<K, V>>> observableMap, String message, int listItemHeight) { final BorderPane root = new BorderPane(); root.setStyle("-fx-background-color: #DDDDDD;-fx-border-color: #3a3e43;-fx-border-width: 4px;"); // add a title final Label titleLabel = new Label(); titleLabel.setText(title); titleLabel.setStyle("-fx-font-size: 11pt;-fx-font-weight: bold;"); titleLabel.setAlignment(Pos.CENTER); titleLabel.setPadding(new Insets(5)); root.setTop(titleLabel); final Accordion accordion = new Accordion(); for (String identifier : observableMap.keySet()) { final ObservableList<Container<K, V>> objects = observableMap.get(identifier); ListView<Container<K, V>> listView = new ListView<>(objects); listView.setEditable(false); listView.setPrefHeight((listItemHeight * objects.size())); listView.getSelectionModel().selectedItemProperty().addListener(event -> { listView.getItems().get(0).getKey(); final Container<K, V> container = listView.getSelectionModel().getSelectedItem(); if (container != null) { selectedObjects.add(new Pair<>(container.getKey(), container.getValue())); } else { // the object was unselected so go through the selected objects and remove them all because we don't know which one was unselected for (Container<K, V> object : listView.getItems()) { selectedObjects.remove(new Pair<>(object.getKey(), object.getValue())); } } }); final TitledPane titledPane = new TitledPane(identifier, listView); accordion.getPanes().add(titledPane); } final HBox help = new HBox(); help.getChildren().add(helpMessage); help.getChildren().add(new ImageView(UserInterfaceIconProvider.HELP.buildImage(16, ConstellationColor.AZURE.getJavaColor()))); help.setPadding(new Insets(10, 0, 10, 0)); helpMessage.setText(message + "\n\nNote: To deselect hold Ctrl when you click."); helpMessage.setStyle("-fx-font-size: 11pt;"); helpMessage.setWrapText(true); helpMessage.setPadding(new Insets(5)); final VBox box = new VBox(); box.getChildren().add(help); // add the multiple matching accordion box.getChildren().add(accordion); final ScrollPane scroll = new ScrollPane(); scroll.setContent(box); scroll.setFitToWidth(true); scroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); root.setCenter(scroll); final FlowPane buttonPane = new FlowPane(); buttonPane.setAlignment(Pos.BOTTOM_RIGHT); buttonPane.setPadding(new Insets(5)); buttonPane.setHgap(5); root.setBottom(buttonPane); useButton = new Button("Continue"); buttonPane.getChildren().add(useButton); accordion.expandedPaneProperty().set(null); final Scene scene = new Scene(root); fxPanel.setScene(scene); fxPanel.setPreferredSize(new Dimension(500, 500)); }