aspose file tools*
The moose likes Beginning Java and the fly likes help plz, some beginner questions ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help plz, some beginner questions ..." Watch "help plz, some beginner questions ..." New topic
Author

help plz, some beginner questions ...

Graaf Petrus
Greenhorn

Joined: Mar 30, 2003
Posts: 3
okay I have some question's, I hope you guy's can help me cuz I really start liking this language ...
1)
Is there a way to clear the screen of the applet ?
Or if not, a way to delete or hide a Textfield ?
2)
why is this not working, I have a textfield where a user can enter his password, after clicking on a button the password needs to be confirmed ...
I tried it with this :
if(evt.getSource() == Unlock && Unlock.getLabel() == "Unlock" && pass.getText() == "dude")
pass being my textfield where the problem is ...
I have defined the pass textfield like this :
Before any voids :
TextField pass;
In init void :
pass = new TextField("",35);
Or do I need to put it in some sort of group with the button like in html ??
3) Is it possible to make a java thing run on a computer without appletviewer in some sort of exetuable ? I mean like an .exe or .bat that starts a program interface, no browser ?

thx in advance m8s
Joel Larson
Greenhorn

Joined: Mar 29, 2003
Posts: 4
1)I'm pretty sure you can just set it invisible. I'm not sure if its the smartest way to go but it would look like this:
Textfield.setVisible(false)
2)For this I'm not quite sure. Being pretty new myself I would assume you may not have an action listener attached to each of the text fields.
3)I think this is possible but java sort of strives away from the .exe kind of things. You can although create a program that runs in a browser but looks like a standalone program. I would recommend checking out www.runescape.com its a great java program and will show you an idea on making a program that looks standalone.
Well that was my sad attempt. Hopefully helped a little.


Spin!
Graaf Petrus
Greenhorn

Joined: Mar 30, 2003
Posts: 3
thanks !
still have some questions do ...
1) what is a smarter way then ? clear the entire screen or lead it to another external class ?
2) didn't work, I added the actionlistener but still nothing
3) really trying to find away to make thiscompletely standalone, no browser or anything else needed

but thanks anyway, I learned the visibility trick, that's really nice ...
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
1) Please show the code that you claim doesn't work. Also, show the error messages or explain the behavior of the program. This will help us narrow down the reasons it doesn't work the way you expect.
2) Ditto! The code I would expect to see for this particular question includes the actionPerformed() method and the declarations and intializations for the TextField components.
3) Unfortuantely, Java programs are not completely stand alone. However, that doesn't mean you have to use appletviewer or a web browser, either. At the very least you need a Java Virtual Machine which knows how to deal with the .class files that the compiler creates. In fact, I hardly ever run my Java programs in a browser. Instead, I run them from the command line (or DOS window) with the "java" command. Also, writing such applications have some small differences from writing applets.
With that said, Joel is also correct that there are 3rd party tools that can convert your java applications into .exe files. However, they still have to be written as APPLICATIONS not APPLETS.
Another alternative is to package all your .class files into a JAR file. These are similar to ZIP files, but are created with the jar command that comes with the Java SDK. You should search java.sun.com or the messages boards here at Java Ranch for more details.
HTH
Layne


Java API Documentation
The Java Tutorial
Graaf Petrus
Greenhorn

Joined: Mar 30, 2003
Posts: 3
I don't get any error messages, if I click on the Unlock -button it just won't do anything ...
this is my code :and if I may ask, do you know a good tutorial for making applications, I find dozens for making applets, but none for making applications ...
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ March 30, 2003: Message edited by: Dirk Schreckmann ]
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Well, that's a lot of code, and I don't see anything wrong just from glancing at it. I suggest you add calls to System.out.println() in order to see the flow of execution occurs in your program. Be sure to run the applet with appletviewer when you do this. The prinln() method then displays messages in the command line window where you ran the appletviewer.
For example start by adding the following line of code to the beginning of actionPeformed():

You can also add similar calls inside the if statements to see if the block of code you expect to run is actually executed.
After all this rambling, I just realized that you may need to simply call this.repaint() in order to see the changes you have made.
HTH
Layne
p.s. Please use the CODE tags when you post code in the future. Also you can check http://java.sun.com/docs/books/tutorial/ for a list of tutorials at the official Java web site. You should start with "My First Cup of Java."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help plz, some beginner questions ...