Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

Ian Cockcroft

Ranch Hand
+ Follow
since Apr 05, 2001
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ian Cockcroft

I am totally ashamed for asking, but I just dont have the time or skill to do this. Can anyone do it?
Create a class called FileWatcher that can be given several filenames that may or may not exist. The class should start a thread for each filename. Each threadwill periodically check for existance of its file. If the file appers, the thread will write a message to the consol and then end. Put all the treads within a new ThreadGroup object created by the FileWatcher class.
Anyone???
Thanks alot
Ian
16 years ago
I havent got this far yet, but how would you guys generate a dynamic number of threads, hold them in an array and work on them as you wish?
Can you hold a thread in an array?
cheers
Ian
16 years ago
Hi all, I have a little GUI with 5 buttons down the left and a text area on the right, it does not display the text area unless i instantiate it with some text, and even then, its only 1 line big. How can i get it to show when i run my app on the entire right hand side of my GUI?
Also, how do I set the size of my GUI, I want it to start in a position centered in my screen and at least double the sixe it is at the moment.
My code is attached.
Many thanks
Ian
16 years ago
This is great, thanks alot guys. Its actually for varsity, but I think I have learnt more on here than in any book. Thanks alot Guys
Warm Regards
Ian
16 years ago
Hi Charles,
It works great now, thanks.
My entire code follows.
Is there anywhere you can see that I should be doing differently?
Also, when I run it, the window is a little box in the top left hand side of the screen. how can i set the size and disable maximize button.
thanks alot
ian
my code:
16 years ago
Thanks, now i'm getting an error at runtime
java.lang.NullPointerException at SquareRoots$ButtonListener.<init>(SquareRoots.java:75) at SquareRoots.<init>(SquareRoots.java:32) at SquareRoots.main(SquareRoots.java:87) Process Exit...
my code looks like this:

am i using the Action Listener correctly?
cheers
Ian
16 years ago
Thats great, thanks guys.
my little function looks like this

i just need to change the string into a double???
How do i do this? Is there somewhere i can down load a spec of all the classes and there functions? there is one on the web, but i need one on my majine?
thanks guys.
ian
16 years ago
Hi all, I have a little piece of code that returns a double from a function and then puts it into a text box

How do I change a doooouble into a string, and is this the best way to do it?
Thanks
Ian
16 years ago
hahaha, Touch´┐Ż.
Thanks for your help guys.
16 years ago
Thanks, that works fine, need to study up on static methods, do you know any good books?
16 years ago
I am using a little function to return the squre root of an int:
[code]
public double calcSquare(int x)
{
return sqrt(x);

}
[code/]
i get an error,
SquareRoots.java:62: cannot resolve symbol
symbol : method sqrt (int)
location: class SquareRoots
return sqrt(x);
even when i import java.lang.Math;
why?
thanks
Ian
16 years ago
I have developed a little GUI the calculates square root of a number. The GUI has a text field for the entry number and a text field for the answer. It then has 2 buttons one for "calculate" and an "Exit" button. All it does is takes a number in the 1st text field, calculates the square root and displays it in the 2nd text box when calculate button is pressed. How do i do this ? My code so far is below.

16 years ago
Hi all,
I am quiet new to swing and GUI development. I need to design a GUI with 4 buttons down the right side and a text area on the left, a label above the text area, and another at the top. I have some code, but it doesnt look like i'm getting it right.
Should i be using JPanle, JPane, JInternalFrame, JDesktopPane? Or what? And how do they fit into each other.
Also, when i run it, i want to be able to set the windows(JFrame) width and heighht and position.
Any help would be great, thanks.
The code:
16 years ago
Hi Michael,
Thanks for that.
I am going to get started, it might take me a few days. Can I get the threads running and then add the GUI later?
Thanks again
Ian
17 years ago
I have to do a project for varsity, I have no idea where to start. I dont want anyone to do it for me, just push me in the right direction and maybe help with certain things.
I have no idea where to even start.
The question follows:
Write a program ControlThreads that allows a user to control a group
of threads. An example of the interface is shown in the figure below.
ControlThreads should provide the
user with the ability to:
1. Launch new threads (threads
start off in a deactivated state -
indicated as `Asleep').
2. Kill current threads.
3. See the status of current threads.
4. Activate certain threads and
deactivate others.
Each thread should be given a number, and should do the following
continuously when activated:
1. Write its number to the standard output stream when awake, and then
2. wait for a certain time.

The GUI is just a form with 4 buttons on the left and a text box/pad on the right telling the user whats going on.
Would anybody be keen to help me?
Thanks so much
Regards
Ian
17 years ago