Forums Register Login

How to invoke a private class after clicking the button that work?

+Pie Number of slices to send: Send
Hi guys,

I have an applet with the following structure:

The question is how do I invoke the CoolStuff class that real works. It just compiled and did not work. I can't find any tutorial on the web about this.

And another question, can I invoke a java code snippet to run inside the CoolStuffs class.

Thanks in advance.
+Pie Number of slices to send: Send
What exactly didn't work? Did you receive an error? If you did, please post it. What results were you expecting?

John Price
+Pie Number of slices to send: Send
Sorry for it's taking so long to reply. It's kind of bit embarrassment. I'm new to java and didn't know if people have done this and I'm a laggard.
I'm trying to capture a screenshot with java applet but it didn't seem to work. I can't invoke the subclass set of java application to automate.
Bellow is my experimenting so far, would be greatly appreciated if you can point out where it went wrong:

+Pie Number of slices to send: Send


First of all, your comment is incorrect in that fragment from your post. You don't "invoke" a class in Java (except in that uncommon situation where you're running a class from the command line). What your code does is to create an instance of that class, nothing else. You apparently thought that "invoking" a class would call a method which happened to called "main". That's not the case either. If you want that method to be called, you're going to have to call it.

Although I wouldn't call it "main", that doesn't describe its function at all. I would call it "capture" or something like that. And I would get rid of the String-array parameter, since you don't use that anywhere in the method.
+Pie Number of slices to send: Send
Thank Paul,

Your comment is complicated to me. I don't understand it right now, because I'm new to this java thing. But I would try to understand it. Maybe I should start with the "call" method you mentioned. The "invoke" word was just borrowed from Oracle's tutorial website. I don't really understand what does it mean right now.
+Pie Number of slices to send: Send
New to Java? And you're writing an applet? I don't recommend that, you're going to get into all kinds of non-Java complexities if you do that. Start off by writing a plain old Java application first.
+Pie Number of slices to send: Send
Thanks for suggestions. I've learned basic java programing. But the application didn't serve my purpose. I jump to an applet thing. That is very helpful suggestion. I will do this.
knowledge is the difference between drudgery and strategic action -- tiny ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1618 times.
Similar Threads
newbie help with swing forms
Frames
trying to center buttons with fixed sizes
Switching between the frames
ActionListener and Event
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:49:32.