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 11:11, local time: 2024/4/28 23:44,
TOP NEW HELP FIND: 
3.137.157.45: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://www.piclist.com/techref/language/java/nosugar/ui/code/FrameDemo.java"> language java nosugar ui code FrameDemo</A>

Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .