Jump to content

Request for GUI tutorial


Clayplug

Recommended Posts

Hi,

I've been looking at other GUI tutorials on the forums and some of them don't even use layout managers or can't stay open during script execution.

I'm looking for something that can help with having a GUI box follow the chatbox, and resize accordingly. Every time I try to do it, it doesn't give the right size, doesn't show the tabbed panes (which I want over the chat tabs), and is dozens of pixels above the chatbox. It would also be nice to know how to customize the graphics in the GUI and have it be openable and closeable. Also, how do I make a GUI that doesn't need to be closed for the script behaviors to start?

I've been working on this for a couple of months but honestly haven't gotten far. An updated GUI tutorial would be really helpful, especially one that is comprehensive and starts from the basics of Swing and how to use it in an object-oriented and even reactive way.

Thanks for anyone who responds to this or helps with writing this.

Link to comment
Share on other sites

7 minutes ago, Khaleesi said:

Like onPaint says in it's name => paint =? you draw images/lines/text.

This has nothing to do with Swing or JFrames, JDialogs, ...
What are you trying to do exactly?

Oh I see, are you saying it should be running on a thread in onLoop or something like that?

Essentially, let's say I have a fishing bot. I want a collapsible GUI that hovers over the chatbox (to obscure the account name if a botter would like to take a screenshot or stream) that shows the full tabbed JDialog (or just GUI if JDialogs are not appropriate here) where a botter can click on a dropdown to change the fish or location and also see other information by clicking different tabs such as info about the botmaker (me in this case) or current exp/exp to level up. Does that make sense?

Edit: I also want to note that I have the tabbed JDialog and everything working in the sense that it pops up, but it has the issue where it has to close to start the script, and then if I put it in onPaint, of couse it will paint it every loop so I get a lot of popups of the same dialog

Edited by Clayplug
Link to comment
Share on other sites

The onPaint is actually just to draw things to the canvas as an overlay, not really the same as trying to put a Jdialog on top of the client.
I have never tried that and I never had the use for it.

Why exactly do you want this Dialog to be on top of the chatbox?
You can simply hide the name by drawing a small box over the name in the chatbox and have the dialog somewhere else
 

Link to comment
Share on other sites

2 minutes ago, Khaleesi said:

The onPaint is actually just to draw things to the canvas as an overlay, not really the same as trying to put a Jdialog on top of the client.
I have never tried that and I never had the use for it.

Why exactly do you want this Dialog to be on top of the chatbox?
You can simply hide the name by drawing a small box over the name in the chatbox and have the dialog somewhere else
 

Thanks for the advice! I was thinking having it over the chatbox would just be nice UX but practicality beats idealism here. Is there a way to anchor the JDialog to the client so a botter can change options and settings? Perhaps putting it into the OSB JFrame itself?

I appreciate you taking the time to respond to this. I'm a long time fan. I consider your time very valuable and would love to hire you as a botting consultant if you'd be open to that. Professionally, I'm into climate tech and want to get good at Java and have found botting as the most fun way to learn advanced Java more quickly, but could definitely use some mentorship.

Link to comment
Share on other sites

41 minutes ago, Clayplug said:

Thanks for the advice! I was thinking having it over the chatbox would just be nice UX but practicality beats idealism here. Is there a way to anchor the JDialog to the client so a botter can change options and settings? Perhaps putting it into the OSB JFrame itself?

I appreciate you taking the time to respond to this. I'm a long time fan. I consider your time very valuable and would love to hire you as a botting consultant if you'd be open to that. Professionally, I'm into climate tech and want to get good at Java and have found botting as the most fun way to learn advanced Java more quickly, but could definitely use some mentorship.

Uhm I'm not sure if there is a good way to deal with this, What I have done before Is painted everything and added a mouselistener to see where a user clicked to enabled/disable setitngs.
But if you are going to want a dropdown it's not going to be easy to do it in the paint itself.

Maybe you can try to get the position of osbots Jframe and move the Jdialog based on that.

You could get the OSBot Frame by doing this I guess:

for (Frame frame : Frame.getFrames()) {
            if (frame.isVisible() && frame.getTitle().startsWith("OSBot")) {
                //Access to Frame X and Y
            }
        }

 

Link to comment
Share on other sites

  • 2 weeks later...
On 12/7/2022 at 11:47 AM, Gunman said:

I mean, you could build out your own Classes for it to make an interactive overlay. Also @Apaec has an overlay you can move around, so he may have an idea on this if he's willing to help

Thanks for tagging @Apaec@Gunman. Any advice would be really useful

Right now, I'm just planning on studying Swing on O'Reilly. But man, there's like 3000 pages of books here lmao the main one is 1200 pages. Didn't realize how big of a system it was

Do you know if there's any plans to integrate JavaFX with OSB? I know somewhere it said you can't have scripts with JFX on the SDN.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...