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();
}
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);
}
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()));
}
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);
}
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;
}
Aggregations