Search in sources :

Example 41 with ScrollPane

use of javafx.scene.control.ScrollPane in project Gargoyle by callakrsos.

the class PolygonEx method start.

@Override
public void start(Stage stage) {
    Pane g = new Pane();
    ScrollPane convert = XY.convert(g);
    {
        //한 점의 좌표가 주어진경우
        double x = 150;
        double y = 150;
        //빗변의 길이
        double r = 100;
        double degree = Math.atan2(y, x);
        double x1 = x + (r / Math.tan(degree));
        double y1 = y;
        double x2 = x1;
        double y2 = y + y - r;
        Polygon polygon = new Polygon();
        polygon.setLayoutX(x);
        polygon.setLayoutY(x);
        polygon.getPoints().addAll(new Double[] { x, y, x1, y1, x2, y2 });
        g.getChildren().add(polygon);
        g.getChildren().add(new Line(1, 1, 10, 10));
    }
    {
        //한 점의 좌표가 주어진경우
        double x = 150;
        double y = 150;
        //빗변의 길이
        double r = 100;
        double degree = Math.atan2(y, x);
        double x1 = x + (r / Math.tan(degree));
        double y1 = y;
        double x2 = x1;
        double y2 = y + r;
        Polygon polygon = new Polygon();
        polygon.getPoints().addAll(new Double[] { x, y, x1, y1, x2, y2 });
        g.getChildren().add(polygon);
    }
    //		Line line = new Line();
    //		line.setStartX(x);
    //		line.setStartY(y);
    //		line.setEndX(x2);
    //		line.setEndY(y2);
    //
    //		Text text = new Text("x : " + x + " y : " + y);
    //		text.setX(x);
    //		text.setY(y - 20);
    //
    //		Text text1 = new Text("x1 : " + x1 + " y1 : " + y1);
    //		text1.setX(x1);
    //		text1.setY(y1 - 20);
    //
    //		Text text2 = new Text("x2 : " + x2 + " y2 : " + y2);
    //		text2.setX(x2);
    //		text2.setY(y2 - 20);
    //		g.getChildren().addAll(polygon, text, text1, text2);
    Scene scene = new Scene(convert, 1800, 900);
    stage.setScene(scene);
    stage.show();
}
Also used : Line(javafx.scene.shape.Line) ScrollPane(javafx.scene.control.ScrollPane) Polygon(javafx.scene.shape.Polygon) Scene(javafx.scene.Scene) ScrollPane(javafx.scene.control.ScrollPane) Pane(javafx.scene.layout.Pane)

Example 42 with ScrollPane

use of javafx.scene.control.ScrollPane in project bitsquare by bitsquare.

the class SettingsView method loadView.

private void loadView(Class<? extends View> viewClass) {
    final Tab tab;
    View view = viewLoader.load(viewClass);
    if (view instanceof PreferencesView)
        tab = preferencesTab;
    else if (view instanceof NetworkSettingsView)
        tab = networkSettingsTab;
    else if (view instanceof AboutView)
        tab = aboutTab;
    else
        throw new IllegalArgumentException("Navigation to " + viewClass + " is not supported");
    if (tab.getContent() != null && tab.getContent() instanceof ScrollPane) {
        ((ScrollPane) tab.getContent()).setContent(view.getRoot());
    } else {
        tab.setContent(view.getRoot());
    }
    root.getSelectionModel().select(tab);
}
Also used : PreferencesView(io.bitsquare.gui.main.settings.preferences.PreferencesView) Tab(javafx.scene.control.Tab) ScrollPane(javafx.scene.control.ScrollPane) NetworkSettingsView(io.bitsquare.gui.main.settings.network.NetworkSettingsView) AboutView(io.bitsquare.gui.main.settings.about.AboutView) MainView(io.bitsquare.gui.main.MainView) NetworkSettingsView(io.bitsquare.gui.main.settings.network.NetworkSettingsView) AboutView(io.bitsquare.gui.main.settings.about.AboutView) PreferencesView(io.bitsquare.gui.main.settings.preferences.PreferencesView)

Example 43 with ScrollPane

use of javafx.scene.control.ScrollPane in project latexdraw by arnobl.

the class TestLaTeXDraw method testMoveViewPort.

@Test
public void testMoveViewPort() {
    final ScrollPane pane = lookup("#scrollPane").query();
    final double hvalue = pane.getHvalue();
    final double vvalue = pane.getVvalue();
    drag("#canvas", MouseButton.MIDDLE).dropBy(100d, 200d);
    WaitForAsyncUtils.waitForFxEvents();
    assertThat(hvalue, Matchers.greaterThan(pane.getHvalue()));
    assertThat(vvalue, Matchers.greaterThan(pane.getVvalue()));
}
Also used : ScrollPane(javafx.scene.control.ScrollPane) ApplicationTest(org.testfx.framework.junit.ApplicationTest) Test(org.junit.Test)

Example 44 with ScrollPane

use of javafx.scene.control.ScrollPane in project blue by kunstmusik.

the class LineView method editPoints.

private void editPoints() {
    TableView<LinePoint> table = new TableView<>();
    TableColumn<LinePoint, Double> xCol = new TableColumn<>("x");
    TableColumn<LinePoint, Double> yCol = new TableColumn<>("y");
    table.getColumns().setAll(xCol, yCol);
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    table.setItems(getSelectedLine().getObservableList());
    table.setEditable(true);
    xCol.setCellValueFactory(new PropertyValueFactory<LinePoint, Double>("x"));
    xCol.setCellFactory(TextFieldTableCell.forTableColumn(new DoubleStringConverter()));
    xCol.setOnEditCommit(te -> {
        LinePoint lp = te.getRowValue();
        if (getSelectedLine().getLinePoint(0) == lp || getSelectedLine().getLinePoint(getSelectedLine().size() - 1) == lp) {
            return;
        }
        lp.setX(Utils.clamp(0.0, te.getNewValue(), 1.0));
    });
    xCol.setEditable(true);
    yCol.setCellValueFactory(new PropertyValueFactory<LinePoint, Double>("y"));
    yCol.setCellFactory(TextFieldTableCell.forTableColumn(new DoubleStringConverter()));
    yCol.setOnEditCommit(te -> {
        te.getRowValue().setY(Utils.clamp(getSelectedLine().getMin(), te.getNewValue(), getSelectedLine().getMax()));
    });
    yCol.setEditable(true);
    Dialog<ButtonType> d = new Dialog<>();
    d.initOwner(getScene().getWindow());
    d.initModality(Modality.APPLICATION_MODAL);
    d.getDialogPane().setContent(new ScrollPane(table));
    d.getDialogPane().getStylesheets().add(BlueFX.getBlueFxCss());
    d.getDialogPane().getButtonTypes().setAll(ButtonType.OK);
    d.setTitle("Edit Points");
    TableModelListener tml = tme -> {
        repaint();
    };
    getSelectedLine().addTableModelListener(tml);
    Optional<ButtonType> res = d.showAndWait();
    getSelectedLine().removeTableModelListener(tml);
}
Also used : DoubleStringConverter(javafx.util.converter.DoubleStringConverter) NumberUtilities(blue.utility.NumberUtilities) ButtonType(javafx.scene.control.ButtonType) LineList(blue.components.lines.LineList) Glow(javafx.scene.effect.Glow) MouseEvent(javafx.scene.input.MouseEvent) TextFieldTableCell(javafx.scene.control.cell.TextFieldTableCell) TableModelListener(javax.swing.event.TableModelListener) LinePoint(blue.components.lines.LinePoint) TableColumn(javafx.scene.control.TableColumn) DragDirection(blue.components.DragDirection) Utils(org.controlsfx.tools.Utils) BlueFX(blue.jfx.BlueFX) ScrollPane(javafx.scene.control.ScrollPane) ListChangeListener(javafx.collections.ListChangeListener) ContextMenu(javafx.scene.control.ContextMenu) TableView(javafx.scene.control.TableView) Color(javafx.scene.paint.Color) ObjectProperty(javafx.beans.property.ObjectProperty) Modality(javafx.stage.Modality) Dialog(javafx.scene.control.Dialog) MenuItem(javafx.scene.control.MenuItem) PropertyValueFactory(javafx.scene.control.cell.PropertyValueFactory) GraphicsContext(javafx.scene.canvas.GraphicsContext) Canvas(javafx.scene.canvas.Canvas) Line(blue.components.lines.Line) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Paint(javafx.scene.paint.Paint) Optional(java.util.Optional) DoubleStringConverter(javafx.util.converter.DoubleStringConverter) TableColumn(javafx.scene.control.TableColumn) LinePoint(blue.components.lines.LinePoint) Dialog(javafx.scene.control.Dialog) ScrollPane(javafx.scene.control.ScrollPane) TableModelListener(javax.swing.event.TableModelListener) ButtonType(javafx.scene.control.ButtonType) TableView(javafx.scene.control.TableView)

Example 45 with ScrollPane

use of javafx.scene.control.ScrollPane in project org.csstudio.display.builder by kasemir.

the class Palette method create.

/**
 * 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;
}
Also used : Pos(javafx.geometry.Pos) HashMap(java.util.HashMap) VBox(javafx.scene.layout.VBox) ArrayList(java.util.ArrayList) Insets(javafx.geometry.Insets) ScrollPane(javafx.scene.control.ScrollPane) DisplayEditor(org.csstudio.display.builder.editor.DisplayEditor) Map(java.util.Map) ClearingTextField(org.csstudio.javafx.ClearingTextField) Tooltip(javafx.scene.control.Tooltip) WidgetDescriptor(org.csstudio.display.builder.model.WidgetDescriptor) Pane(javafx.scene.layout.Pane) HBox(javafx.scene.layout.HBox) TextField(javafx.scene.control.TextField) TitledPane(javafx.scene.control.TitledPane) Collection(java.util.Collection) Node(javafx.scene.Node) Set(java.util.Set) Messages(org.csstudio.display.builder.editor.Messages) Collectors(java.util.stream.Collectors) Priority(javafx.scene.layout.Priority) List(java.util.List) ToggleButton(javafx.scene.control.ToggleButton) WidgetFactory(org.csstudio.display.builder.model.WidgetFactory) ScrollBarPolicy(javafx.scene.control.ScrollPane.ScrollBarPolicy) TilePane(javafx.scene.layout.TilePane) ImageView(javafx.scene.image.ImageView) WidgetCategory(org.csstudio.display.builder.model.WidgetCategory) BorderPane(javafx.scene.layout.BorderPane) WidgetTransfer(org.csstudio.display.builder.editor.util.WidgetTransfer) Preferences(org.csstudio.display.builder.editor.Preferences) WidgetIcons(org.csstudio.display.builder.editor.util.WidgetIcons) Image(javafx.scene.image.Image) ToggleButton(javafx.scene.control.ToggleButton) HBox(javafx.scene.layout.HBox) BorderPane(javafx.scene.layout.BorderPane) Insets(javafx.geometry.Insets) Tooltip(javafx.scene.control.Tooltip) Node(javafx.scene.Node) ArrayList(java.util.ArrayList) ClearingTextField(org.csstudio.javafx.ClearingTextField) ScrollPane(javafx.scene.control.ScrollPane) Pane(javafx.scene.layout.Pane) TitledPane(javafx.scene.control.TitledPane) TilePane(javafx.scene.layout.TilePane) BorderPane(javafx.scene.layout.BorderPane) ScrollPane(javafx.scene.control.ScrollPane) ClearingTextField(org.csstudio.javafx.ClearingTextField) TextField(javafx.scene.control.TextField) ArrayList(java.util.ArrayList) List(java.util.List) WidgetCategory(org.csstudio.display.builder.model.WidgetCategory) VBox(javafx.scene.layout.VBox)

Aggregations

ScrollPane (javafx.scene.control.ScrollPane)74 VBox (javafx.scene.layout.VBox)18 Text (javafx.scene.text.Text)15 Scene (javafx.scene.Scene)14 Label (javafx.scene.control.Label)13 Insets (javafx.geometry.Insets)11 Button (javafx.scene.control.Button)11 BorderPane (javafx.scene.layout.BorderPane)11 HBox (javafx.scene.layout.HBox)10 GridPane (javafx.scene.layout.GridPane)9 TextFlow (javafx.scene.text.TextFlow)8 FXCollections (javafx.collections.FXCollections)7 Node (javafx.scene.Node)7 TextArea (javafx.scene.control.TextArea)7 javafx.scene.layout (javafx.scene.layout)7 Pane (javafx.scene.layout.Pane)7 InvalidationListener (javafx.beans.InvalidationListener)6 Observable (javafx.beans.Observable)6 ObservableList (javafx.collections.ObservableList)6 Alert (javafx.scene.control.Alert)6