This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I'm doing a homework assignment (not due until the 26th) and I've run into a problem with the display. The homework is to code an applet that uses the JOptionPane object showing the user some messages and allowing text input. There is also a number guessing game involved (the project reqs, http://www.isy.vcu.edu/~jmay/hw2). I know how to do everything this project asks, I'm just having an issue with the display. Just to let you all know, I really only have to use the JOptionPane object to do all of the given tasks, but our professor said if we do extra stuff with the homework we'll get really high grades (i.e., 110 out of 100). So I wanted to create a nice looking swing application containing objects for each aspect of the project (a label for the current amount of money in your account, a label showing the option screens as you encounter them, etc). The problem is I'm not able to view the JPanel code when I view it on my webspace. If I run my program in JBuilder, everything runs and shows up fine. When I run it in IE from my webspace, the login part runs fine but when it should show the panel, submit button, and such it doesn't. Can anyone please look over this and tell me why this happens? Here is my applet in current form: http://www.isy.vcu.edu/~cstewart/Hw2Casino.html - btw, the password is casino. Here is the code:
[ February 15, 2003: Message edited by: Chris Stewart ] [ February 15, 2003: Message edited by: Chris Stewart ]
Joined: Sep 14, 2002
Damn, I feel like a moron. When I compiled, it created two class files (Hw2Casino$1.class and Hw2Casino.class). When I uploaded to my webspace, I only uploaded Hw2Casino.class. After uploading the second one, everything works out fine.
It's usually a good idea to use a JAR file when delivering applets. That way, as long as you JAR'd all the classes, you only have one file to upload to the web server. Additionally, I would suggest using Java Web Start (JWS) instead of an applet. I realize this was a homework assignment and you were required to use an applet, but JWS apps are much more efficient and they perform better than applets. Let me know if you would like any additional information. BTW - I often post questions and realize I made a stupid mistake, luckily before anyone repsponds pointing out my idiotic mistake. So don't be too hard on yourself.
Thanks guys. I got a good ways into what I wanted to do today, but I ran into an issue. I need help capturing the events from the submit button. I really can't figure out how to handle that. I went ahead and started to code just the bare reqs of my homework (in case I don't get the "fluff" version finished). Could anyone help me understand how I can handle this? Bare req code: