please dont rip this site

Language Java Nosugar UI Code Framedemo.java

// 
//	FrameDemo class
//	part of the set of documents known as Java no sugar.
//	Copyright (c) 1996 Sunil Gupta, sunil@magnetic.demon.co.uk
//	placed into the public domain by the author
//
import java.awt.*;
import java.applet.*;
import SimpleFrame;

public class FrameDemo extends Applet
{
	//*******************************************************************
	// globals
	//*******************************************************************
	static final String DIALOG = "DIALOG";
	static final String FRAME = "FRAME";
	static final String MENUBAR = "MENUBAR";
	static final String MENUITEMS = "MENUITEMS";
	static final String CHECKMENU = "CHECKMENU";
	
	//*******************************************************************
	// instance variables
	//*******************************************************************
	Button btn_frame, btn_dialog, btn_menubar, btn_menuitem, btn_checkmenu;
		
	//*******************************************************************
	// applet methods
	//*******************************************************************
	public void init()
	{
		String style;
		
		style = getParameter("STYLE");
		
		if	(style == null)	
			System.exit(1);
		else
		{
			this.setLayout( new FlowLayout());
			
			if (style.equals(FRAME))
			{
				btn_frame = new Button("click on me to get a frame");
				this.add(btn_frame);
			}
			else if (style.equals(DIALOG))
			{
				btn_dialog = new Button("click on me to get a dialog");
				this.add(btn_dialog);
			}
			else if (style.equals(MENUBAR))
			{
				btn_menubar = new Button("Show me a frame with a menubar");
				this.add(btn_menubar);
			}
			else if (style.equals(MENUITEMS))
			{
				btn_menuitem = new Button("show me a frame with menuitems");
				this.add(btn_menuitem);
			}
			else if (style.equals(CHECKMENU))
			{
				btn_checkmenu = new Button("show me checked menu items");
				this.add(btn_checkmenu);
			}
		}
	}

		public boolean action(Event event, Object arg)
		{
		Frame frame;
			
			if (event.target == btn_frame)
			{
			frame = new SimpleFrame("example frame");
			frame.pack();
			frame.show();
			return (true);
		}
			if (event.target == btn_dialog)
			{
			frame = new SimpleFrame("dialog from a frame", SimpleFrame.DIALOG);
			frame.pack();
			frame.show();
			return (true);
		}
			if (event.target == btn_menubar)
			{
			frame = new SimpleFrame("example frame with menubar", SimpleFrame.MENUBAR);
			frame.pack();
			frame.show();
			return (true);
		}
			if (event.target == btn_menuitem)
			{
			frame = new SimpleFrame("example menuitems",  SimpleFrame.MENUITEMS);
			frame.pack();
			frame.show();
			return (true);
		}
			if (event.target == btn_checkmenu)
			{
			frame = new SimpleFrame("example checked menu items",SimpleFrame.CHECKMENU);
			frame.pack();
			frame.show();
			return (true);
		}
		
		return(false);
   }
}


file: /Techref/language/JAVA/nosugar/ui/code/FrameDemo.java, 2KB, , updated: 1996/10/10 10:11, local time: 2024/11/13 19:28,
TOP NEW HELP FIND: 
18.218.103.200:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/Techref/language/JAVA/nosugar/ui/code/FrameDemo.java"> language JAVA nosugar ui code FrameDemo</A>

Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .