-
some question's plz help ...
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
-
This is just way too many random questions in one single post. I suggest you submit them a question at a time. However, quickly:
1. I think you mean 'clear the screen of CONTROLS' (as opposed to lines etc. that you've drawn. You can simply loop through all of the controls calling .setVisible(false) on each one.
2. You haven't actually said what the PROBLEM is! This should be fine.
3. Sort of. What are you actually trying to achieve? Check the site for other postings on this topic...there have been a few ;-). Calling your Java application from a batch file is a piece of cake:
java MyJavaProgram
ArchAngel.
ArchAngel.
O:-)
-
1) oke thanks, but isn't there also a way to clear everything on my screen ??
2) the problem is, if I click the button it won't respond, I can't get the password right ...
3) I really mean like an actual program with it's own screen, where you don't need a browser, don't need to go in dos, just execute a .exe or .bat and you get it to work, is this possible ??
thanks !
-
1. Not simply. Investigate CardLayout Layout Manager. You could use a 'blank' card.
2. heh heh....here's your mistake:
.... pass.getText() == "dude") ......
You can't compare strings using the '==' operator (well, you can, but you'll get incorrect answers). You code should read:
.... pass.getText().equals("dude")) ......
3. Yeah - it's easily done. You create a Swing application, create a JAR and then associated it with 'javaw'. Have a look on the forum - I wrote a little HOW-TO.
ArchAngel.
ArchAngel.
O:-)
-
yeah what he said.
strings are stored as integer values. the integer value stored is a memory address where the actual string is stored
so when you compare strings using == you are just comparing the values of the memory addresses where the strings are located....
in essence asking, "are these two strings the exact same string." not just do they have the same letters, but the actual exact same string.
I'm surprised more of you people don't get hit by cars.
-
Sorry, picky point. REFERENCES to Strings (in fact, any object) are held as integers.
so when you compare strings using == you are just comparing the values of the REFERENCES. The value of the REFERENCES are the memory addresses where the strings are located....
Small point.
ArchAngel.
O:-)
-
Great ! thanks you guy's, still got the javascript feeling where everything is easily done with just some =='s, got to get that out of my sytem now 
still a question on working with .exe though, maybe not to ask, but ya, maybe you guy's now, if I use a program or like you said a shortcut, my dosscreen always closes really fast and does nothing else, is this something wrong in my dos/win xp or is it that the action cannot be performed ...
-
are the files you are executing on a remote drive? or local on your computer.
I'm surprised more of you people don't get hit by cars.
-
uhm there on my D-drive, C is my standard drive ...
D is the second partition on my only HD, C being the first ...
Could that be it ??
-
no. that's not it. I've seen sometimes that when using the textPad package, if you try to execute a file from a remote drive it will do that, but I'm not sure what your problem is.
I'm surprised more of you people don't get hit by cars.
-
re: executable.
Is your program a text-only program? In that case you don't invoke the JAR with 'javaw', it needs to be invoked with 'java'. In my tutorial I explain how to do this.
ArchAngel.
O:-)
-
hehe... you guys have this thing for javaw, don't you? i gotta try this out. honestly i haven't tried it yet coz jar exes suit me fine.
-
*sigh*
If you just mean that in Windows, you double-click on a JAR and it runs, then Windows has associated JAR files with javaw. This is fine until you have a console application....
ArchAngel.
O:-)
-
hey no big deal about that, and i'm not really familiar with javaw. maybe that's what the OS does, but i've run java apps in jar exes in both windows and linux. they pretty much do the same. i guess they both have something to suppress consoles. console apps are of course another thing...we don't want any suppression on that
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks