APPLETS ARE A FINE IDEA. It's nice to be able to put a complete program in a rectangle on a Web page. But more serious, large-scale programs have to run in their own windows, independently of a Web browser. In Java, a program can open an independent window by creating an object of type Frame. A Frame has a title, displayed in the title bar at the top of the window. It can have a menu bar containing one or more pull-down menus. A Frame is a Container, which means that it can hold other GUI components. The default layout manager for a Frame is a BorderLayout. A common way to design a frame is to add a single GUI component, such as a Panel or Canvas, in the layout's Center position so that it will fill the entire frame.It is possible for an applet to create a frame. The frame will be a separate window from the Web browser window in which the applet is running. Any frame created by an applet includes a warning message such as 'Warning: Insecure Applet Window.' The warning is there so that you can always recognize windows created by applets. This is just one of the security restrictions on applets, which, after all, are programs that can be downloaded automatically from Web sites that you happen to stumble across without knowing anything about them.Here is an applet that displays just one small button on the page. When you click the 'Launch ShapeDraw' button, a window will be opened. This is another version of the ShapeDraw program that you've seen several times already. This version has a pull-down menu named 'Add Shape', which contains commands that you can use to add shapes to the window. (Note for Macintosh users: The menus for the frame might just be added to the list of menus at the top of the screen. Look there for the 'Add Shape' menu if you don't see it at the top of the window.) Once a shape is in the window, you can drag it around. The color that will be used for newly created shapes is controlled by another pull-down menu named 'Color'. There is also a pop-up menu that appears when you click on a shape in the appropriate, platform-dependent way. - Study24x7
Social learning Network
20 Jan 2021 12:28 PM study24x7 study24x7

APPLETS ARE A FINE IDEA. It's nice to be able to put a complete program in a rectangle on a Web page. But more serious, large-scale programs have to run in their own windows, independently of a Web browser. In Java, a program can open an independent window by creating an object o...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles