Linden Garcia

Greenhorn
+ Follow
since May 30, 2021
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
5
Given in last 30 days
5
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Linden Garcia

Thanks for the replies everybody! I’ve been working through it the last few days and finally cracked it, your comments were really helpful; I think I’m getting to grips with it now.
1 week ago

Paul Clapham wrote:I moved the thread to the JavaFX forum in the hope that people who knew something about JavaFX would see it.

I'm not one of those people but I'm sure that having your Application implement EventHandler is the wrong thing to do. It's been the wrong thing to do in Swing for over 15 years now and JavaFX isn't that different. So I tracked down a tutorial about how to use an EventHandler for a JavaFX Button:

Using JavaFX UI Controls

There's "back" and "forward" buttons there which I expect go to pages which deal with other kinds of control.



Ah, I didn't notice the JavaFX board or I would've posted it in there - thanks!
And thanks for the link, I'll read through; hopefully it will add some more context.
2 weeks ago

Campbell Ritchie wrote:Welcome to the Ranch

Please post your code here; people are often reluctant to go to distant websites.

Linden Garcia wrote:. . . related to action events and possibly action listener . . .

No, it isn't. Action events and action listeners are used in AWT/Swing, not FX. You have obviously had the misfortune to find the wrong sort of tutorial. I hardly know any FX, but you usually pass a λ to a setOnXXX() method. Let's see your code please.





This is the GUI so far:

2 weeks ago

Hi,

I'm trying to create a small program that displays shapes on screen. The user types in both the shape they want and the colour, and then the program will display the shape in the centre of the screen.

I understand that it's related to action events and possibly action listener, but I'm getting really bogged down with how to actually implement it and can't see the wood for the trees, so to speak. I was running through it in my head and thought maybe an if statement related to the event handler might be the way to go? So if the user types in say, Rectangle and Blue, display the given shape on the screen.

Here is the code I have so far: Pastebin  I've followed some tutorials online so far as getting the class set up for event handling, but I don't even really understand what I did. The more I read the more I realise I don't know!

Here's what my GUI currently looks like when it runs: imgur

Can anyone give me any pointers on where to start?

Thanks!
2 weeks ago