Java Code Examples for javafx.scene.control.ScrollPane#setFitToWidth()

The following examples show how to use javafx.scene.control.ScrollPane#setFitToWidth() . 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: MaterialDesignIconDemo.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@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 2
Source File: DetailsTab.java    From scenic-view with GNU General Public License v3.0 6 votes vote down vote up
public DetailsTab(final ScenicViewGui view, final Consumer<String> loader) {
    super(TAB_NAME);
    this.scenicView = view;
    this.loader = loader;

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setFitToWidth(true);
    vbox = new VBox();
    vbox.setFillWidth(true);
    scrollPane.setContent(vbox);
    getStyleClass().add("all-details-pane");
    
    setGraphic(new ImageView(DisplayUtils.getUIImage("details.png")));
    setContent(scrollPane);
    setClosable(false);
}
 
Example 3
Source File: HistoryListPopup.java    From arma-dialog-creator with MIT License 6 votes vote down vote up
public HistoryListPopup(@Nullable String popupTitle, @NotNull HistoryListProvider provider) {
	super(ArmaDialogCreator.getPrimaryStage(), new VBox(5), popupTitle);
	this.provider = provider;

	myRootElement.setPadding(new Insets(10));
	final ScrollPane scrollPane = new ScrollPane(stackPaneWrapper);
	VBox.setVgrow(scrollPane, Priority.ALWAYS);
	scrollPane.setFitToHeight(true);
	scrollPane.setFitToWidth(true);
	scrollPane.setStyle("-fx-background-color:transparent");

	myRootElement.getChildren().addAll(scrollPane, new Separator(Orientation.HORIZONTAL), getBoundResponseFooter(false, true, false));

	gridPaneContent.setVgap(15);
	gridPaneContent.setHgap(5);
	ColumnConstraints constraints = new ColumnConstraints(-1, -1, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true);
	gridPaneContent.getColumnConstraints().addAll(constraints, constraints);

	myStage.setMinWidth(320);
	myStage.setMinHeight(320);
	myStage.setWidth(480);

	stackPaneWrapper.setPrefHeight(320);

	fillContent();
}
 
Example 4
Source File: FilterWindow.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public void show() {
    if (headLine == null)
        headLine = Res.get("filterWindow.headline");

    width = 968;

    createGridPane();

    scrollPane = new ScrollPane();
    scrollPane.setContent(gridPane);
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);
    scrollPane.setMaxHeight(1000);
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);

    addHeadLine();
    addContent();
    applyStyles();
    display();
}
 
Example 5
Source File: ProposalDisplay.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@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 6
Source File: KeywordsTab.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
KeywordsTab() {
    VBox content = new VBox();
    content.getStyleClass().add("info-props");
    setText(DefaultI18nContext.getInstance().i18n("Keywords"));
    setClosable(false);
    keywords.setWrapText(true);
    keywords.getStyleClass().add("info-property-value");
    content.getChildren().add(keywords);
    ScrollPane scroll = new ScrollPane(content);
    scroll.setFitToHeight(true);
    scroll.setFitToWidth(true);
    setContent(scroll);
    eventStudio().addAnnotatedListeners(this);
}
 
Example 7
Source File: LogWindow.java    From PDF4Teachers with Apache License 2.0 5 votes vote down vote up
public LogWindow(){

        Pane root = new Pane();
        Scene scene = new Scene(root, Main.SCREEN_BOUNDS.getWidth()-200 >= 1200 ? 1200 : Main.SCREEN_BOUNDS.getWidth()-200, Main.SCREEN_BOUNDS.getHeight()-200 >= 675 ? 675 : Main.SCREEN_BOUNDS.getHeight()-200);

        getIcons().add(new Image(getClass().getResource("/logo.png")+""));
        setResizable(true);
        setTitle(TR.tr("PDF4Teachers - Console"));
        setScene(scene);
        setOnCloseRequest(e -> {
            updater.stop();
            close();
        });
        new JMetro(scene, Style.DARK);

        Pane pane = new Pane();
        root.setStyle("-fx-background-color: black;");
        ScrollPane scrollPane = new ScrollPane(pane);
        scrollPane.setStyle("-fx-background-color: black;");
        scrollPane.setFitToHeight(true);
        scrollPane.setFitToWidth(true);
        scrollPane.prefWidthProperty().bind(scene.widthProperty());
        scrollPane.prefHeightProperty().bind(scene.heightProperty());
        pane.minHeightProperty().bind(text.heightProperty());
        root.getChildren().add(scrollPane);
        setupUi(pane);

        show();
    }
 
Example 8
Source File: DragPopup.java    From Recaf with MIT License 5 votes vote down vote up
/**
 * @param content
 * 		Popup content.
 * @param handle
 * 		Draggable header control.
 */
public DragPopup(ScrollPane content, Control handle) {
	this((Node) content, handle);
	content.getStyleClass().add("scroll-antiblur-hack");
	content.getStyleClass().add("drag-popup-scroll");
	content.getStyleClass().add("drag-popup");
	content.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
	content.setFitToWidth(true);
}
 
Example 9
Source File: DashboardItemPane.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
DashboardItemPane(DashboardItem item) {
    requireNotNullArg(item, "Dashboard item cannot be null");
    this.item = item;
    this.item.pane().getStyleClass().addAll(Style.DEAULT_CONTAINER.css());
    this.item.pane().getStyleClass().addAll(Style.CONTAINER.css());
    ScrollPane scroll = new ScrollPane(this.item.pane());
    scroll.getStyleClass().addAll(Style.DEAULT_CONTAINER.css());
    scroll.setFitToWidth(true);
    scroll.setHbarPolicy(ScrollBarPolicy.NEVER);
    scroll.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    setCenter(scroll);
    eventStudio().add(SetActiveModuleRequest.class, enableFooterListener, Integer.MAX_VALUE,
            ReferenceStrength.STRONG);
}
 
Example 10
Source File: TakeOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addScrollPane() {
    scrollPane = new ScrollPane();
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);
    AnchorPane.setLeftAnchor(scrollPane, 0d);
    AnchorPane.setTopAnchor(scrollPane, 0d);
    AnchorPane.setRightAnchor(scrollPane, 0d);
    AnchorPane.setBottomAnchor(scrollPane, 0d);
    root.getChildren().add(scrollPane);
}
 
Example 11
Source File: BrowserTab.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public Node getRoot() {
    basicPane = new FormPane("browser-config-basic", 3);
    advancedPane = new FormPane("browser-config-advanced", 3);
    addBrowserName();
    addWebDriverExeBrowse();
    addBrowserExeBrowse();
    addArguments();
    addWdArguments();
    addUseCleanSession();
    addUseTechnologyPreview();

    addVerbose();
    addIELogLevel();
    addSilent();
    addLogFileBrowse();
    addEnvironment();
    addExtensions();
    addPageLoadStrategy();
    addUnexpectedAlertBehavior();
    addAssumeUntrustedCertificateIssuer();
    addAcceptUntrustedCertificates();
    addAlwaysLoadNoFocusLib();
    addBrowserPreferences();

    ScrollPane sp1 = new ScrollPane(basicPane);
    sp1.setFitToWidth(true);
    TitledPane basicTitledPane = new TitledPane("Basic Settings", sp1);
    ScrollPane sp2 = new ScrollPane(advancedPane);
    sp2.setFitToWidth(true);
    TitledPane advancedTitledPane = new TitledPane("Advanced Settings", sp2);
    Accordion accordion = new Accordion(basicTitledPane, advancedTitledPane);
    accordion.setExpandedPane(basicTitledPane);
    return accordion;
}
 
Example 12
Source File: RegexConfigFragment.java    From mdict-java with GNU General Public License v3.0 5 votes vote down vote up
private Node getMainContent() {
	VBox content = new VBox(
		make_simple_switcher(bundle, this, regex_head, opt.GetRegexSearchEngineAutoAddHead())
		,make_simple_switcher(bundle, this, regex_case, opt.GetRegexSearchEngineCaseSensitive())
	);
	ScrollPane sv = new ScrollPane(content);
	sv.setFitToWidth(true);
	return sv;
}
 
Example 13
Source File: UnitsContainerClassic.java    From helloiot with GNU General Public License v3.0 5 votes vote down vote up
public UnitsContainerClassic(double maxwidth, double maxheight) {
    container = new VBox();
    container.getStyleClass().add("unitscontainer");
    container.setMaxSize(maxwidth, maxheight);
    scrollcontainer = new ScrollPane(container);
    scrollcontainer.setFitToWidth(true);
    scrollcontainer.setFocusTraversable(false);

    BorderPane.setAlignment(scrollcontainer, Pos.CENTER);            
}
 
Example 14
Source File: RegexConfigFragment.java    From mdict-java with GNU General Public License v3.0 5 votes vote down vote up
private Node getSubpageContent() {
	VBox content = new VBox(
			make_simple_switcher(bundle, this, page_regex_case, opt.GetPageSearchCaseSensitive())
			,make_simple_seperator()
			,make_simple_switcher(bundle, this, pagewutsp, opt.GetPageWithoutSpace())
			,make_simple_switcher(bundle, this, ps_separate, opt.GetPageSearchSeparateWord())
	);
	ScrollPane sv = new ScrollPane(content);
	sv.setFitToWidth(true);
	return sv;
}
 
Example 15
Source File: DiffDisplayDialog.java    From zest-writer with GNU General Public License v3.0 4 votes vote down vote up
public DiffDisplayDialog(File file, String newContent, String titleContent, String titleExtract) {
	super(Configuration.getBundle().getString("ui.dialog.download.compare.window.title"), Configuration.getBundle().getString("ui.dialog.download.compare.window.header"));
	this.file = file;
	this.newContent = newContent;
	this.titleContent = titleContent;
       this.titleExtract = titleExtract;
       try {
           if(this.file.exists()) {
               this.oldContent = IOUtils.toString(new FileInputStream(this.file), "UTF-8");
           }
       } catch (IOException e) {
           log.error(e.getMessage(), e);
       }
       ;

    // Set the button types.
    ButtonType validButtonType = new ButtonType(Configuration.getBundle().getString("ui.dialog.download.compare.button.confirm"), ButtonData.OK_DONE);
    this.getDialogPane().getButtonTypes().addAll(validButtonType, ButtonType.CANCEL);

	// Create the username and password labels and fields.
	GridPane grid = new GridPane();
	grid.setHgap(10);
	grid.setVgap(10);
	grid.setPadding(new Insets(20, 20, 10, 10));
       Label l01 = new Label(Configuration.getBundle().getString("ui.dialog.download.compare.content_name") + " : "+titleContent);
       Label l02 = new Label(Configuration.getBundle().getString("ui.dialog.download.compare.extract_name") + " : "+titleExtract);
	Label l1 = new Label(Configuration.getBundle().getString("ui.dialog.download.compare.old_content"));
       Label l2 = new Label(Configuration.getBundle().getString("ui.dialog.download.compare.new_content"));
	TextArea textArea1 = new TextArea();
	textArea1.setEditable(false);
       textArea1.setWrapText(true);
       textArea1.setPrefHeight(500);
       textArea1.setText(oldContent);
       ScrollPane scrollPane1 = new ScrollPane();
       scrollPane1.setContent(textArea1);
       scrollPane1.setFitToWidth(true);
	TextArea textArea2 = new TextArea();
       textArea2.setEditable(false);
       textArea2.setWrapText(true);
       textArea2.setPrefHeight(500);
       textArea2.setText(newContent);
       ScrollPane scrollPane2 = new ScrollPane();
       scrollPane2.setContent(textArea2);
       scrollPane2.setFitToWidth(true);


       grid.add(l01, 0, 0,2, 1);
       grid.add(l02, 0, 1, 2, 1);
	grid.add(l1, 0, 2);
    grid.add(l2, 1, 2);
       grid.add(scrollPane1, 0, 3);
       grid.add(scrollPane2, 1, 3);

    // Enable/Disable login button depending on whether a username was entered.
	this.getDialogPane().lookupButton(validButtonType);

	this.getDialogPane().setContent(grid);

	Platform.runLater(textArea1::requestFocus);

	this.setResultConverter(dialogButton -> {
		if(dialogButton == validButtonType) {
               return true;
		}
		return false;
	});
}
 
Example 16
Source File: ConsolidatedDialog.java    From constellation with Apache License 2.0 4 votes vote down vote up
/**
 * 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));
}
 
Example 17
Source File: Palette.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
/** Create UI elements
 *  @return Top-level Node of the UI
 */
@SuppressWarnings("unchecked")
public Node create()
{
    final VBox palette = new VBox();

    final Map<WidgetCategory, Pane> palette_groups = createWidgetCategoryPanes(palette);
    groups = palette_groups.values();
    createWidgetEntries(palette_groups);

    final ScrollPane palette_scroll = new ScrollPane(palette);
    palette_scroll.setHbarPolicy(ScrollBarPolicy.NEVER);
    palette_scroll.setFitToWidth(true);

    // TODO Determine the correct size for the main node
    // Using 2*PREFERRED_WIDTH was determined by trial and error
    palette_scroll.setMinWidth(PREFERRED_WIDTH + 12);
    palette_scroll.setPrefWidth(PREFERRED_WIDTH);

    // Copy the widgets, i.e. the children of each palette_group,
    // to the userData.
    // Actual children are now updated based on search by widget name
    palette_groups.values().forEach(group -> group.setUserData(new ArrayList<Node>(group.getChildren())));

    final TextField searchField = new ClearingTextField();
    searchField.setPromptText(Messages.SearchTextField);
    searchField.setTooltip(new Tooltip(Messages.WidgetFilterTT));
    searchField.setPrefColumnCount(9);
    searchField.textProperty().addListener( ( observable, oldValue, search_text ) ->
    {
        final String search = search_text.toLowerCase().trim();
        palette_groups.values().stream().forEach(group ->
        {
            group.getChildren().clear();
            final List<Node> all_widgets = (List<Node>)group.getUserData();
            if (search.isEmpty())
                group.getChildren().setAll(all_widgets);
            else
                group.getChildren().setAll(all_widgets.stream()
                                                      .filter(node ->
                                                      {
                                                         final String text = ((ToggleButton) node).getText().toLowerCase();
                                                         return text.contains(search);
                                                      })
                                                     .collect(Collectors.toList()));
        });
    });
    HBox.setHgrow(searchField, Priority.NEVER);

    final HBox toolsPane = new HBox(6);
    toolsPane.setAlignment(Pos.CENTER_RIGHT);
    toolsPane.setPadding(new Insets(6));
    toolsPane.getChildren().add(searchField);

    BorderPane paletteContainer = new BorderPane();
    paletteContainer.setTop(toolsPane);
    paletteContainer.setCenter(palette_scroll);

    return paletteContainer;
}
 
Example 18
Source File: DiagramTab.java    From JetUML with GNU General Public License v3.0 4 votes vote down vote up
/**
    * Constructs a diagram tab initialized with pDiagram.
    * @param pDiagram The initial diagram
 */
public DiagramTab(Diagram pDiagram)
{
	aDiagram = pDiagram;
	DiagramTabToolBar sideBar = new DiagramTabToolBar(pDiagram);
	UserPreferences.instance().addBooleanPreferenceChangeHandler(sideBar);
	aDiagramCanvas = new DiagramCanvas(pDiagram);
	UserPreferences.instance().addBooleanPreferenceChangeHandler(aDiagramCanvas);
	aDiagramCanvasController = new DiagramCanvasController(aDiagramCanvas, sideBar, this);
	aDiagramCanvas.setController(aDiagramCanvasController);
	aDiagramCanvas.paintPanel();
	
	BorderPane layout = new BorderPane();
	layout.setRight(sideBar);

	// We put the diagram in a fixed-size StackPane for the sole purpose of being able to
	// decorate it with CSS. The StackPane needs to have a fixed size so the border fits the 
	// canvas and not the parent container.
	StackPane pane = new StackPane(aDiagramCanvas);
	final int buffer = 12; // (border insets + border width + 1)*2
	pane.setMaxSize(aDiagramCanvas.getWidth() + buffer, aDiagramCanvas.getHeight() + buffer);
	final String cssDefault = "-fx-border-color: grey; -fx-border-insets: 4;"
			+ "-fx-border-width: 1; -fx-border-style: solid;";
	pane.setStyle(cssDefault);
	
	// We wrap pane within an additional, resizable StackPane that can grow to fit the parent
	// ScrollPane and thus center the decorated canvas.
	ScrollPane scroll = new ScrollPane(new StackPane(pane));
	
	// The call below is necessary to removes the focus highlight around the Canvas
	// See issue #250
	scroll.setStyle("-fx-focus-color: transparent; -fx-faint-focus-color: transparent;"); 

	scroll.setFitToWidth(true);
	scroll.setFitToHeight(true);
	layout.setCenter(scroll);
	
	setTitle();
	setContent(layout);

	setOnCloseRequest(pEvent -> 
	{
		pEvent.consume();
		EditorFrame editorFrame = (EditorFrame) getTabPane().getParent();
		editorFrame.close(this);
	});
}
 
Example 19
Source File: HTMLEditorSample.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
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: SelectSongsDialog.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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);
}