Hello,
New to the JavaFX. I have a Java Swing Application. I am trying to use the TreeViewer in JavaFX since it seems to be a bit better to use and less confusing.
Any help is appreciated.
Thanks
I have my Java app calling my treeviewer JavaFX as
-- Java Application --
public class EPMFrame extends JFrame {
Customer _custObj
....
private void categoryAction(ActionEvent e) // method called by Toolbar
{
ocsCategoryViewer ocsFX; //javaFX treeviewer
ocsFX = new ocsCategoryViewer(); // need to pass in the Customer Object to this Not seeing how to do it.
// tried ocsFX = new ocsCategoryViewer(_custObj) ; nothing happened even when set this as a string with a value
}
public class ocsCategoryViewer extends Application {
String _customer;
@Override
public void start(Stage primaryStage) {
TreeView <String> ocsTree;
TreeItem <String> root , subcat;
TreeItem <String> root = new TreeItem <String> ("/");
root.setExpanded(true);
ocsTree = new TreeView <String> (root);
buildTree(); // this uses the Customer Object.
StackPane stkp_root = new StackPane();
stkp_root.getChildren().add(btn);
stkp_root.getChildren().add(ocsTree);
Scene scene = new Scene(stkp_root, 300, 250);
primaryStage.setTitle("Tree Category Viewer");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
_customer = args[0]; // temporarily trying to pass in string.
launch(args);
}