Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions tests/manual/monkey/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,27 @@ This is a testing tool developed to support manual ad-hoc testing of individual

## Prerequisites

JavaFX SDK is required to build the tool. You can use a JavaFX SDK that you build or you can download the JavaFX SDK.
The latest SDK can be found here:
JavaFX SDK 24+ and JDK 23+ are required to build and run the tool.
You can use a JavaFX SDK that you build or you can download the JavaFX SDK found here:

https://jdk.java.net/javafx21/
https://jdk.java.net/


## Build

The tool uses `ant` to build a non-modular JAR. You'll need to specify the path to JavaFX SDK 20+
(using absolute path, the script apparently does not understand ~ symbols):
The tool uses `ant` to build a non-modular JAR. You'll need to specify the path to JavaFX SDK
using absolute path:
```
ant -Djavafx.home=<JAVAFX>
```


## Run

The tool requires JDK 21+ and JavaFX 21+.

To launch, specify the path to the JavaFX SDK lib/ folder on the command line, example:

```
java -p <JAVAFX>/javafx-sdk-21/lib/ --add-modules ALL-MODULE-PATH -jar MonkeyTester.jar
java -p <JAVAFX>/javafx-sdk-24/lib/ --add-modules ALL-MODULE-PATH -jar MonkeyTester.jar
Copy link
Member

@jayathirthrao jayathirthrao Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the README to build and run this app.
Suggestion for future updates:
In this command we should not add "javafx-sdk-24" in the path.
JAVAFX already includes sdk folder we just need to use java -p <JAVAFX>/lib/ --add-modules ALL-MODULE-PATH -jar MonkeyTester.jar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, thanks!

Created https://bugs.openjdk.org/browse/JDK-8353743

```


Expand All @@ -42,5 +40,3 @@ having them fight over the preferences, one can redefine the `user.home` system
`-Duser.home=<DIR>`.

To disable loading and saving, specify `-Ddisable.settings=true` VM agrument.


9 changes: 5 additions & 4 deletions tests/manual/monkey/build.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This build requires javafx.home property, pointing to JavaFX SDK (21+) directory, e.g.:
This build requires javafx.home property, pointing to JavaFX SDK directory, e.g.:
ant -Djavafx.home=<DIR>
-->
<project default="build-all" basedir=".">
Expand All @@ -20,6 +20,7 @@ This build requires javafx.home property, pointing to JavaFX SDK (21+) directory

<target name="clean">
<delete includeEmptyDirs="true" dir="build" failonerror="false" />
<delete includeEmptyDirs="true" dir="dist" failonerror="false" />
</target>


Expand All @@ -40,12 +41,12 @@ This build requires javafx.home property, pointing to JavaFX SDK (21+) directory
fork="true"
nowarn="true"
optimize="false"
source="21"
target="21"
source="23"
target="23"
includeantruntime="false"
>
<compilerarg value="-Xlint:none"/>
<compilerarg line="--module-path ${javafx.home}/lib --add-modules javafx.base,javafx.graphics,javafx.controls,javafx.swing,javafx.web"/>
<compilerarg line="--module-path ${javafx.home}/lib --add-modules javafx.base,javafx.graphics,javafx.controls,javafx.media,javafx.swing,javafx.web"/>
<classpath refid="libs" />
</javac>
</target>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -45,11 +45,13 @@
import javafx.stage.Stage;
import com.oracle.tools.fx.monkey.pages.DemoPage;
import com.oracle.tools.fx.monkey.settings.FxSettings;
import com.oracle.tools.fx.monkey.sheets.PropertiesMonitor;
import com.oracle.tools.fx.monkey.tools.ClipboardViewer;
import com.oracle.tools.fx.monkey.tools.CssPlaygroundPane;
import com.oracle.tools.fx.monkey.tools.EmbeddedFxTextArea;
import com.oracle.tools.fx.monkey.tools.EmbeddedJTextAreaWindow;
import com.oracle.tools.fx.monkey.tools.KeyboardEventViewer;
import com.oracle.tools.fx.monkey.tools.ModalWindow;
import com.oracle.tools.fx.monkey.tools.Native2AsciiPane;
import com.oracle.tools.fx.monkey.tools.SystemInfoViewer;
import com.oracle.tools.fx.monkey.util.FX;
Expand Down Expand Up @@ -146,6 +148,7 @@ private MenuBar createMenu() {
FX.item(m, "JTextArea/JTextField Embedded in SwingNode", this::openJTextArea);
FX.item(m, "Keyboard Event Viewer", this::openKeyboardViewer);
FX.item(m, "Native to ASCII", this::openNative2Ascii);
FX.item(m, "Platform Preferences Monitor", this::openPlatformPreferencesMonitor);
FX.item(m, "System Info", this::openSystemInfo);
// Logs
FX.menu(m, "_Logging");
Expand Down Expand Up @@ -282,4 +285,8 @@ private void newSkin() {
s.newSkin();
}
}

private void openPlatformPreferencesMonitor() {
PropertiesMonitor.openPreferences(this);
}
}
22 changes: 14 additions & 8 deletions tests/manual/monkey/src/com/oracle/tools/fx/monkey/Pages.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -33,54 +33,60 @@ public class Pages {
public static DemoPage[] create() {
return new DemoPage[] {
new DemoPage("Accordion", AccordionPage::new),
new DemoPage("AnchorPane", AnchorPanePage::new),
new DemoPage("AreaChart", AreaChartPage::new),
new DemoPage("BarChart", BarChartPage::new),
new DemoPage("BorderPane", BorderPanePage::new),
new DemoPage("BubbleChart", BubbleChartPage::new),
new DemoPage("Button", ButtonPage::new),
// TODO ButtonBar
new DemoPage("ButtonBar", ButtonBarPage::new),
new DemoPage("Canvas", CanvasPage::new),
new DemoPage("CheckBox", CheckBoxPage::new),
new DemoPage("ChoiceBox", ChoiceBoxPage::new),
new DemoPage("ComboBox", ComboBoxPage::new),
new DemoPage("ColorPicker", ColorPickerPage::new),
new DemoPage("DatePicker", DatePickerPage::new),
// TODO DialogPane
new DemoPage("Drag and Drop", DnDPage::new),
new DemoPage("FlowPane", FlowPanePage::new),
new DemoPage("GridPane", GridPanePage::new),
new DemoPage("HBox", HBoxPage::new),
new DemoPage("HTMLEditor", HTMLEditor_Page::new),
new DemoPage("Hyperlink", HyperlinkPage::new),
// TODO InputField: DoubleField, IntegerField, WebColorField
new DemoPage("Label", LabelPage::new),
new DemoPage("LineChart", LineChartPage::new),
new DemoPage("ListView", ListViewPage::new),
new DemoPage("MediaPlayer", MediaPlayerPage::new),
new DemoPage("MenuBar", MenuBarPage::new),
new DemoPage("MenuButton", MenuButtonPage::new),
new DemoPage("Pagination", PaginationPage::new),
new DemoPage("PasswordField", PasswordFieldPage::new),
new DemoPage("PieChart", PieChartPage::new),
// TODO ProgressIndicator
new DemoPage("ProgressIndicator", ProgressIndicatorPage::new),
new DemoPage("RadioButton", RadioButtonPage::new),
new DemoPage("ScatterChart", ScatterChartPage::new),
new DemoPage("ScrollBar", ScrollBarPage::new),
new DemoPage("ScrollPane", ScrollPanePage::new),
// TODO Separator
new DemoPage("Separator", SeparatorPage::new),
new DemoPage("Shape", ShapePage::new),
// TODO Slider
new DemoPage("Slider", SliderPage::new),
new DemoPage("Spinner", SpinnerPage::new),
new DemoPage("SplitMenuButton", SplitMenuButtonPage::new),
// TODO SplitPane
new DemoPage("StackedAreaChart", StackedAreaChartPage::new),
new DemoPage("StackedBarChart", StackedBarChartPage::new),
new DemoPage("StackPane", StackPanePage::new),
new DemoPage("Stage", StagePage::new),
new DemoPage("TableView", TableViewPage::new),
new DemoPage("TabPane", TabPanePage::new),
new DemoPage("Text", TextPage::new),
new DemoPage("TextArea", TextAreaPage::new),
new DemoPage("TextField", TextFieldPage::new),
new DemoPage("TextFlow", TextFlowPage::new),
new DemoPage("TilePane", TilePanePage::new),
new DemoPage("TitledPane", TitledPanePage::new),
new DemoPage("ToggleButton", ToggleButtonPage::new),
new DemoPage("ToolBar", ToolBarPage::new),
new DemoPage("Tooltip", TooltipPage::new),
// TODO in tables: Cell, DateCell, IndexedCell* ?
new DemoPage("TreeTableView", TreeTableViewPage::new),
new DemoPage("TreeView", TreeViewPage::new),
new DemoPage("VBox", VBoxPage::new),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -48,6 +48,7 @@ public BorderOption(String name, ObjectProperty<Border> p) {
addChoice("Empty (100)", createBorder(Color.TRANSPARENT, 100, null));
addChoice("Red (1)", createBorder(Color.RED, 1, null));
addChoice("Green (20)", createBorder(Color.GREEN, 20, null));
addChoice("(T:11, B:22, L:33, R:44)", createBorder(Color.rgb(127, 127, 127, 0.5), 11, 44, 22, 33));
addChoice("Rounded", createBorder(Color.ORANGE, 1, 5.0));

selectInitialValue();
Expand All @@ -57,10 +58,12 @@ private static Border createBorder(Color color, double width, Double radius) {
BorderStrokeStyle style = BorderStrokeStyle.SOLID;
CornerRadii radii = radius == null ? null : new CornerRadii(radius);
BorderWidths widths = new BorderWidths(width);
return new Border(new BorderStroke(color, style, radii, widths));
}

BorderStroke[] strokes = {
new BorderStroke(color, style, radii, widths)
};
return new Border(strokes);
private static Border createBorder(Color color, double top, double right, double bottom, double left) {
BorderStrokeStyle style = BorderStrokeStyle.SOLID;
BorderWidths widths = new BorderWidths(top, right, bottom, left);
return new Border(new BorderStroke(color, style, null, widths));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -108,7 +108,7 @@ public void selectInitialValue() {
select(value, true);
}

private void select(Number value, boolean initial) {
public void select(Number value, boolean initial) {
List<Object> items = getItems();
int sz = items.size();
for (int i = 0; i < sz; i++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -52,6 +52,10 @@ public ObjectOption(String name, Property<T> p) {
property.set(v);
}
});

property.addListener((s,prev,v) -> {
selectValue(v);
});
}

public void clearChoices() {
Expand Down Expand Up @@ -91,6 +95,21 @@ public void selectInitialValue() {
select(sz);
}

/**
* Selects the specified value.
*/
public void selectValue(T value) {
List<NamedValue<T>> items = getItems();
int sz = items.size();
for (int i = 0; i < sz; i++) {
NamedValue<T> item = items.get(i);
if (Objects.equals(value, item.getValue())) {
select(i);
return;
}
}
}

/**
* Selects the given index. Does nothing if the index is outside of the valid range.
* @param ix
Expand Down
Loading