some question's plz help ...


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 14 of 14

Thread: some question's plz help ...

  1. #1
    Join Date
    Mar 2003
    Posts
    7

    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

  2. #2
    Join Date
    Mar 2003
    Posts
    834
    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:-)

  3. #3
    Join Date
    Mar 2003
    Posts
    7
    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 !

  4. #4
    Join Date
    Mar 2003
    Posts
    834
    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:-)

  5. #5
    Join Date
    Mar 2003
    Posts
    84
    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.

  6. #6
    Join Date
    Mar 2003
    Posts
    834
    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:-)

  7. #7
    Join Date
    Mar 2003
    Posts
    7
    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 ...


  8. #8
    Join Date
    Mar 2003
    Posts
    84
    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.

  9. #9
    Join Date
    Mar 2003
    Posts
    7
    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 ??

  10. #10
    Join Date
    Mar 2003
    Posts
    84
    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.

  11. #11
    Join Date
    Mar 2003
    Posts
    834
    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:-)

  12. #12
    Join Date
    Nov 2002
    Posts
    138

    Cool

    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.

  13. #13
    Join Date
    Mar 2003
    Posts
    834
    *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:-)

  14. #14
    Join Date
    Nov 2002
    Posts
    138
    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center