all the examples in RHE and KM for the awt and Layout Manager are based on applets. there is just one complete working example based on application, rest are all applets. why have they chosen to give working examples based on applets and not java application GUI ? is it more cumbersome. i don't think so, but if you would know the real reason then let me know. may be there is more to it !!
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
posted
0
I may be wrong but I think the main reason is that you can run the applets in a browser. Browsers have an internal Java Virtual Machine so there is no need for you to download and install the JDK or the JRE in order to see what the applet is doing... Anyone else ? ------------------ Valentin Crettaz Sun Certified Programmer for Java 2 Platform
...no need for you to download and install the JDK or the JRE in order to see what the applet is doing...
But how would you compile the Applet? Also the applet is a container (Panel), so it makes things a little easier. Otherwise, you have to create a container, set the size, set it visible, add window closing code. The applet has all this built in. [This message has been edited by Jim Hall (edited December 21, 2001).]
mark stone
Ranch Hand
Joined: Dec 18, 2001
Posts: 417
posted
0
yes, u are correct. but would u know of any sample code, may be just a few lines where i could see a working example of a java application GUI via a frame. just to make this awt chapter more complete and better grasp. a few links or just a piece of working code would be more than enough for now. thanks
Originally posted by Jim Hall:
...no need for you to download and install the JDK or the JRE in order to see what the applet is doing...
But how would you compile the Applet? Also the applet is a container (Panel), so it makes things a little easier. Otherwise, you have to create a container, set the size, set it visible, add window closing code. The applet has all this built in. [This message has been edited by Jim Hall (edited December 21, 2001).]
Fei Ng
Ranch Hand
Joined: Aug 26, 2000
Posts: 1241
posted
0
maybe becuase browsers are everywhere so Applet is a good idea. You can look at the question anywhere that has a browsers. For me, i have 4 computers at home but not all of them have Java SE installed. For example my Mac, and i do use it to view the questions.
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
posted
0
But how would you compile the Applet? In this respect Jim's explanations makes more sense... But usually the compiled code presented in a book comes on a cd-rom or you can download it off the web. You can then easily run the applet in a browser without having any Java VM installed. And here is a link about Frames http://java.sun.com/docs/books/tutorial/uiswing/components/frame.html HIH ------------------ Valentin Crettaz Sun Certified Programmer for Java 2 Platform
mark stone
Ranch Hand
Joined: Dec 18, 2001
Posts: 417
posted
0
I have seen examples (just the cert books etc that i have) that show Panels put inside Applets and also Frames. but can we put Frame inside a Panel and or Applet as well here is the hierarcy diagram CONTAINER | ----------------------------- | | PANEL WINDOW | | APPLET FRAME books say that Panels can be put inside Frame so can we not put Frame inside a Panel and or Applet. I am asking because i have not yet seen an example that shows this.
Originally posted by Jim Hall:
...no need for you to download and install the JDK or the JRE in order to see what the applet is doing...
But how would you compile the Applet? Also the applet is a container (Panel), so it makes things a little easier. Otherwise, you have to create a container, set the size, set it visible, add window closing code. The applet has all this built in. [This message has been edited by Jim Hall (edited December 21, 2001).]