Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

JavaFX and OSBot

Featured Replies

I'm trying to make a bot GUI with JavaFX instead of swing. Well you know, looks 10x sexier. Though I ran into a ton of problems.

 

First things first, is it even possible to properly use JavaFX in OSbot instead of Swing without going through hell?

 

I've called the GUI like this

Application.launch(Test.class);

Cause this doesn't even bother to work 

Test test = new Test(Script s);
test.launch(Test.class); // Tried with null - the same

// Getting cannot be launched more than once exception

Any idea how to pass GUI parameters between the interface and the bot code? Or shouldn't I even bother and write everything in Swing?

I think it only works on local not sure how Valkyr did it but I know when he put his script on the sdn i dont think it supported obfuscation or something

 

not sure but tldr; JavaFX isn't supported im assuming

  • Author

I think it only works on local not sure how Valkyr did it but I know when he put his script on the sdn i dont think it supported obfuscation or something

 

not sure but tldr; JavaFX isn't supported im assuming

 

Thanks. Maybe there's a post what Valkyr was doing and etc.?

I'm trying to make a bot GUI with JavaFX instead of swing. Well you know, looks 10x sexier. Though I ran into a ton of problems.

 

First things first, is it even possible to properly use JavaFX in OSbot instead of Swing without going through hell?

 

I've called the GUI like this

Application.launch(Test.class);

Cause this doesn't even bother to work 

Test test = new Test(Script s);
test.launch(Test.class); // Tried with null - the same

// Getting cannot be launched more than once exception

Any idea how to pass GUI parameters between the interface and the bot code? Or shouldn't I even bother and write everything in Swing?

 

This is how you integrate JavaFX into a Swing application: https://docs.oracle.com/javase/8/javafx/interoperability-tutorial/swing-fx-interoperability.htm

 

It's probably safer to just use Swing though

Edited by Explv

You can use JavaFX by wrapping it in swing using JFXPanel

Don't.

 

Some Linux systems s don't support JavaFX at all.

Like which? The only thing JavaFX doesn't support (that I know of) is Solaris

Edited by Thunderwaffe

Like which? I've never heard this before.

 

 

It's simply not supported by every JVM implementation, if a context (up to the OS scope) forces you to use a JVM that doesn't provide / isn't compatible with JFX runtimes, you're fucked. 

 

Arch, Bodhi, Gentoo, Slackware are some I remember causing troubles (maybe some of them support it now), I'm sure there are plenty of others. 

 

On top of this, part of the JavaFX architecture relies on OpenGL, not all operating systems have available drivers for this (I've heard horror stories about companies having to write their own... ew).

 

jfxar_dt_001_arch-diag.png

 

Honestly, writing desktop clients in Java is very much a thing of the past. 

Edited by Botre

It's simply not supported by every JVM implementation, if a context (up to the OS scope) forces you to use a JVM that doesn't provide / isn't compatible with JFX runtimes, you're fucked. 

 

Arch, Bodhi, Gentoo, Slackware are some I remember causing troubles (maybe some of them support it now), I'm sure there are plenty of others. 

 

On top of this, part of the JavaFX architecture relies on OpenGL, not all operating systems have available drivers for this (I've heard horror stories about companies having to write their own... ew).

 

jfxar_dt_001_arch-diag.png

 

Honestly, writing desktop clients in Java is very much a thing of the past. 

 

Well most of which that doesn't support JavaFX are server environments like Solaris, JavaFX is for Clients. I don't believe a lack of support for a couple Linux systems is a reason for him to disregard JavaFX altogether.

Edited by Thunderwaffe

Well most of which that doesn't support JavaFX are server environments like Solaris, JavaFX is for Clients. I don't believe a lack of support for a couple Linux systems is a reason for him to disregard JavaFX altogether.

 

Many people on this site use what you call server-oriented operating systems on their VPS.

 

Another case:

CentOS uses OpenJDK  which supports JFX but doesn't bundle it by default, this means he would have to ask those users to to install another JDK (if their VPS provider allows this at all)  or somehow install the runtimes manually.

 

If he wants to release his script publicly he should seriously reconsider the idea of JFX, if not then ofcourse none of what I said is really relevant :p

It is possible.

 

Here's my old code. Sorry there's a lot of unrelated junk. I cbf to clean it for you. Basically, like Villius said, you gotta wrap with JFXPanel.

 

Also, I dev-ed this on Linux. It is supported, if you're using Oracle JDK at least... Most Linux distros have a package for it. If not, they're probably using a less user-friendly distro, and I'd assume that means they're experienced enough to install it manually.

// Display the GUI
            JFXPanel panel = new JFXPanel();
            JFrame frame = new JFrame();
            try {
                panel.setScene(new SupremeFisherGUI().load(frame, this));
            } catch (Exception e) {
                e.printStackTrace();
            }
            frame.setUndecorated(true);
            frame.setSize(328, 240);
            frame.setContentPane(panel);
            frame.setVisible(true);
            frame.setBackground(new Color(0, 0, 0, 0));

and then I have this:

 

public Scene load(JFrame stage, Main script) throws Exception {
MainGUIController controller = new MainGUIController();

AnchorPane anchorPane = new AnchorPane();
anchorPane.setPrefSize(320.0, 174.0);
anchorPane.setStyle("-fx-background-color: #000");

Label welcomeLabel = new Label("Welcome to SupremeFisher!");
welcomeLabel.setTextFill(Paint.valueOf("#55acee"));
welcomeLabel.setFont(new Font("Cambria Bold", 18.0));
welcomeLabel.setLayoutX(16);
welcomeLabel.setLayoutY(6);
anchorPane.getChildren().add(welcomeLabel);

Label optionsLabel = new Label("Please configure your options below:");
optionsLabel.setFont(new Font("Cambria", 14.0));
optionsLabel.setTextFill(Paint.valueOf("#FFFFFF"));
optionsLabel.setLayoutX(18.0);
optionsLabel.setLayoutY(29.0);
anchorPane.getChildren().add(optionsLabel);

Label locationLabel = new Label("Location:");
locationLabel.setTextFill(Paint.valueOf("#55acee"));
locationLabel.setFont(new Font("Cambria", 14.0));
locationLabel.setLayoutX(18.0);
locationLabel.setLayoutY(59.0);
anchorPane.getChildren().add(locationLabel);

controller.locationBox = new ComboBox<>();
controller.locationBox.setLayoutX(87);
controller.locationBox.setLayoutY(56);
controller.locationBox.setPrefHeight(27.0);
controller.locationBox.setPrefWidth(215.0);
controller.locationBox.setPromptText("Select a Location");
controller.locationBox.setStyle("-fx-border-color: #55acee; -fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-border-radius: 10; -fx-padding: 0 0 0 4;");
anchorPane.getChildren().add(controller.locationBox);

controller.fishLabel = new Label();
controller.fishLabel.setLayoutX(18.0);
controller.fishLabel.setLayoutY(125);
controller.fishLabel.setFont(new Font("Cambria", 14.0));
controller.fishLabel.setTextFill(Paint.valueOf("#55acee"));
anchorPane.getChildren().add(controller.fishLabel);

controller.fishView = new ListView<>();
controller.fishView.setLayoutX(18.0);
controller.fishView.setLayoutY(152);
controller.fishView.setMaxHeight(100.0);
controller.fishView.setMinHeight(0.0);
controller.fishView.setPrefHeight(0.0);
controller.fishView.setPrefWidth(285);
controller.fishView.setStyle("-fx-background-color: #000000; -fx-border-color: #55acee;");
anchorPane.getChildren().add(controller.fishView);

controller.typeBox = new ComboBox<>();
controller.typeBox.setLayoutX(87);
controller.typeBox.setLayoutY(89);
controller.typeBox.setPrefHeight(27);
controller.typeBox.setPrefWidth(215.0);
controller.typeBox.setPromptText("Select a Type");
controller.typeBox.setStyle("-fx-border-color: #55acee; -fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-border-radius: 10; -fx-padding: 0 0 0 4;");
anchorPane.getChildren().add(controller.typeBox);

Label typeLabel = new Label("Type:");
typeLabel.setLayoutX(18.0);
typeLabel.setLayoutY(94.0);
typeLabel.setTextFill(Paint.valueOf("#55acee"));
typeLabel.setFont(new Font("Cambria", 14.0));
anchorPane.getChildren().add(typeLabel);

controller.imageView = new javafx.scene.image.ImageView();
controller.imageView.setFitWidth(285.0);
controller.imageView.setLayoutX(18.0);
controller.imageView.setLayoutY(158.0);
controller.imageView.setPickOnBounds(true);
controller.imageView.setPreserveRatio(true);
anchorPane.getChildren().addAll(controller.imageView);

controller.reducedAntiban = new CheckBox("Reduced antiban mode (not recommended)");
controller.reducedAntiban.setTextFill(Paint.valueOf("#55acee"));
controller.reducedAntiban.setFont(new Font("Cambria", 14.0));
controller.reducedAntiban.setLayoutX(18.0);
controller.reducedAntiban.setLayoutY(141);
anchorPane.getChildren().addAll(controller.reducedAntiban);

controller.startButton = new Button("START");
controller.startButton.setDisable(true);
controller.startButton.setLayoutX(12.0);
controller.startButton.setLayoutY(176);
controller.startButton.setMnemonicParsing(false);
controller.startButton.setPrefHeight(27.0);
controller.startButton.setPrefWidth(297.0);
controller.startButton.setStyle("-fx-background-color: #000000; -fx-border-color: #55acee; -fx-border-radius: 10;");
controller.startButton.setTextFill(Paint.valueOf("#FFFFFF"));
anchorPane.getChildren().add(controller.startButton);

controller.locationBox.setOnAction(new EventHandler<ActionEvent>() {
@[member='Override']
public void handle(ActionEvent event) {
controller.updateLocation(event);
}
});
controller.typeBox.setOnAction(new EventHandler<ActionEvent>() {
@[member='Override']
public void handle(ActionEvent event) {
controller.updateType(event);
}
});
controller.startButton.setOnAction(new EventHandler<ActionEvent>() {
@[member='Override']
public void handle(ActionEvent event) {
controller.start(event);
}
});
controller.fishView.setOnMousePressed(new EventHandler<MouseEvent>() {
@[member='Override']
public void handle(MouseEvent event) {
controller.updateFishView(event);
}
});

Scene scene = new Scene(anchorPane, Color.TRANSPARENT);

controller.registerStage(stage, script);

return scene;
}

Edited by Ericthecmh

 

It is possible.

 

Here's my old code. Sorry there's a lot of unrelated junk. I cbf to clean it for you. Basically, like Villius said, you gotta wrap with JFXPanel.

 

Also, I dev-ed this on Linux. It is supported, if you're using Oracle JDK at least... Most Linux distros have a package for it. If not, they're probably using a less user-friendly distro, and I'd assume that means they're experienced enough to install it manually.

// Display the GUI
            JFXPanel panel = new JFXPanel();
            JFrame frame = new JFrame();
            try {
                panel.setScene(new SupremeFisherGUI().load(frame, this));
            } catch (Exception e) {
                e.printStackTrace();
            }
            frame.setUndecorated(true);
            frame.setSize(328, 240);
            frame.setContentPane(panel);
            frame.setVisible(true);
            frame.setBackground(new Color(0, 0, 0, 0));

and then I have this:

 

public Scene load(JFrame stage, Main script) throws Exception {
MainGUIController controller = new MainGUIController();

AnchorPane anchorPane = new AnchorPane();
anchorPane.setPrefSize(320.0, 174.0);
anchorPane.setStyle("-fx-background-color: #000");

Label welcomeLabel = new Label("Welcome to SupremeFisher!");
welcomeLabel.setTextFill(Paint.valueOf("#55acee"));
welcomeLabel.setFont(new Font("Cambria Bold", 18.0));
welcomeLabel.setLayoutX(16);
welcomeLabel.setLayoutY(6);
anchorPane.getChildren().add(welcomeLabel);

Label optionsLabel = new Label("Please configure your options below:");
optionsLabel.setFont(new Font("Cambria", 14.0));
optionsLabel.setTextFill(Paint.valueOf("#FFFFFF"));
optionsLabel.setLayoutX(18.0);
optionsLabel.setLayoutY(29.0);
anchorPane.getChildren().add(optionsLabel);

Label locationLabel = new Label("Location:");
locationLabel.setTextFill(Paint.valueOf("#55acee"));
locationLabel.setFont(new Font("Cambria", 14.0));
locationLabel.setLayoutX(18.0);
locationLabel.setLayoutY(59.0);
anchorPane.getChildren().add(locationLabel);

controller.locationBox = new ComboBox<>();
controller.locationBox.setLayoutX(87);
controller.locationBox.setLayoutY(56);
controller.locationBox.setPrefHeight(27.0);
controller.locationBox.setPrefWidth(215.0);
controller.locationBox.setPromptText("Select a Location");
controller.locationBox.setStyle("-fx-border-color: #55acee; -fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-border-radius: 10; -fx-padding: 0 0 0 4;");
anchorPane.getChildren().add(controller.locationBox);

controller.fishLabel = new Label();
controller.fishLabel.setLayoutX(18.0);
controller.fishLabel.setLayoutY(125);
controller.fishLabel.setFont(new Font("Cambria", 14.0));
controller.fishLabel.setTextFill(Paint.valueOf("#55acee"));
anchorPane.getChildren().add(controller.fishLabel);

controller.fishView = new ListView<>();
controller.fishView.setLayoutX(18.0);
controller.fishView.setLayoutY(152);
controller.fishView.setMaxHeight(100.0);
controller.fishView.setMinHeight(0.0);
controller.fishView.setPrefHeight(0.0);
controller.fishView.setPrefWidth(285);
controller.fishView.setStyle("-fx-background-color: #000000; -fx-border-color: #55acee;");
anchorPane.getChildren().add(controller.fishView);

controller.typeBox = new ComboBox<>();
controller.typeBox.setLayoutX(87);
controller.typeBox.setLayoutY(89);
controller.typeBox.setPrefHeight(27);
controller.typeBox.setPrefWidth(215.0);
controller.typeBox.setPromptText("Select a Type");
controller.typeBox.setStyle("-fx-border-color: #55acee; -fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-border-radius: 10; -fx-padding: 0 0 0 4;");
anchorPane.getChildren().add(controller.typeBox);

Label typeLabel = new Label("Type:");
typeLabel.setLayoutX(18.0);
typeLabel.setLayoutY(94.0);
typeLabel.setTextFill(Paint.valueOf("#55acee"));
typeLabel.setFont(new Font("Cambria", 14.0));
anchorPane.getChildren().add(typeLabel);

controller.imageView = new javafx.scene.image.ImageView();
controller.imageView.setFitWidth(285.0);
controller.imageView.setLayoutX(18.0);
controller.imageView.setLayoutY(158.0);
controller.imageView.setPickOnBounds(true);
controller.imageView.setPreserveRatio(true);
anchorPane.getChildren().addAll(controller.imageView);

controller.reducedAntiban = new CheckBox("Reduced antiban mode (not recommended)");
controller.reducedAntiban.setTextFill(Paint.valueOf("#55acee"));
controller.reducedAntiban.setFont(new Font("Cambria", 14.0));
controller.reducedAntiban.setLayoutX(18.0);
controller.reducedAntiban.setLayoutY(141);
anchorPane.getChildren().addAll(controller.reducedAntiban);

controller.startButton = new Button("START");
controller.startButton.setDisable(true);
controller.startButton.setLayoutX(12.0);
controller.startButton.setLayoutY(176);
controller.startButton.setMnemonicParsing(false);
controller.startButton.setPrefHeight(27.0);
controller.startButton.setPrefWidth(297.0);
controller.startButton.setStyle("-fx-background-color: #000000; -fx-border-color: #55acee; -fx-border-radius: 10;");
controller.startButton.setTextFill(Paint.valueOf("#FFFFFF"));
anchorPane.getChildren().add(controller.startButton);

controller.locationBox.setOnAction(new EventHandler<ActionEvent>() {
@[member='Override']
public void handle(ActionEvent event) {
controller.updateLocation(event);
}
});
controller.typeBox.setOnAction(new EventHandler<ActionEvent>() {
@[member='Override']
public void handle(ActionEvent event) {
controller.updateType(event);
}
});
controller.startButton.setOnAction(new EventHandler<ActionEvent>() {
@[member='Override']
public void handle(ActionEvent event) {
controller.start(event);
}
});
controller.fishView.setOnMousePressed(new EventHandler<MouseEvent>() {
@[member='Override']
public void handle(MouseEvent event) {
controller.updateFishView(event);
}
});

Scene scene = new Scene(anchorPane, Color.TRANSPARENT);

controller.registerStage(stage, script);

return scene;
}

 +1 For showing a working example.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.