Will Isom

Greenhorn
+ Follow
since Feb 28, 2019
Merit badge: grant badges
For More
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Will Isom

I'm trying to access a field 'path' from outside of a thread however from outside of the thread it appears to be empty but within the thread it is not empty? I've tried setting all fields modified to volatile but this hasn't worked. Has anyone got any ideas on how to get the correct value of the 'path' array? Thanks
The while loop is always true btw .

4 years ago

Knute Snortum wrote:I don't think I'm understanding.  Why don't you make this a method in the Main class?  Or, if you want separate objects, why would instantiating an object be a problem?  I think I need to see a chunk on your Main class where you're trying to call the method of a new object.

Remember, all the UI is called from one thread, so if you need to do something that won't hang the UI, it can't be done on the UI thread.



I added the relevant snippets . Yeah idk why it doesnt work when I make a new object of the class then call the  method
4 years ago
I have a javafx app which generates mazes using a binary tree algorithm . However, I want to move alot of the methods outside of the main class and then just call them from the main class to make the code more readable . I have tried using interfaces to try and simulate multiple inheritance to access the methods but this didnt work because interfaces have no body. I then tried making instances of the other classes then calling the method but this just hung the ui because the new instance made a new object . Below is one of the methods I want to move into another class called 'delNode' it works by taking in start and end coordinates of the line then removing it from the pane. Anyway basically to keep it simple is there a way of calling non static methods from another class('s) without having to make an instance of the class? **making a new instance also causes nullpointer exception


4 years ago

Fred Kleinschmidt wrote:What is "p"? What does setTranslateX() do? You call setTranslateX with an argument of p.getX())+5,
but do you ever set the value of x to that ?


Yeah so as I undertsand it 'setTranslateX()' sets the x value to the given value and get(x) returns the x value at the moment in time.
5 years ago
Im trying to translate a square 'p' 5 units left or right depending on what key has been pressed . The problem is that when 'right' or 'left' is pressed it will translate 5 units in that direction but when I press again I can't move and I have to press 'left' to move right again so I never get anywhere.
Does anyone know why this is?
Here's the snippet

       
5 years ago