please dont rip this site

Language Java Nosugar Graphics Draw Code Drawselector.java

// 
//	DrawSelector 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.applet.*;
import java.awt.*;
import DrawSelectorCanvas;

public class DrawSelector extends Applet
{
	//*******************************************************************
	// instance variables
	//*******************************************************************
	Label label;
	List list;
	Button go_button, stop_button;
	DrawSelectorCanvas draw_surface;
	
	
	//*******************************************************************
	// applet methods
	//*******************************************************************
	public void init()
	{
		Panel controls, buttons;
		
		// --------------------------------------
		// create the interface items to display
		// --------------------------------------
		label = new Label("Drawing functions");
		
		list = new List(10,  true);
		list.addItem("draw3DRect");
		list.addItem("drawArc");
		list.addItem("drawLine");
		list.addItem("drawOval");
		list.addItem("drawPolygon");
		list.addItem("drawRect");
		list.addItem("drawRoundRect");
		list.addItem("fill3DRect");
		list.addItem("fillArc");
		list.addItem("fillOval");
		list.addItem("fillPolygon");
		list.addItem("fillRect");
		list.addItem("fillRoundRect");
		list.setMultipleSelections(false);
		
		go_button = new Button("Go");
		stop_button = new Button("Stop");
		draw_surface = new DrawSelectorCanvas();
		draw_surface.set_clear_flag(false);
		
		//---add controls to a control panel.-------------
		buttons = new Panel();
		buttons.setLayout( new GridLayout(2,1));
		buttons.add(go_button);
		buttons.add(stop_button);
		
		
		//---------------add them ------------------------
		controls = new Panel();
		controls.setLayout(new BorderLayout());
		controls.add("North", label);
		controls.add("Center", list);
		controls.add("South", buttons);
		
		//------------------and now a border layout------------
		this.setLayout(new BorderLayout());
		this.add("West", controls);
		this.add("Center", draw_surface);
	}
	
	public boolean action(Event event, Object o)
	{
		String draw_mode;

		if (event.target == go_button)
		{
			 draw_mode =  list.getSelectedItem();
			 if (draw_mode != null)
			 {
			    draw_surface.stop();
			    draw_surface.draw_shapes(draw_mode);
			  }
		}
		else if (event.target == stop_button)
		{
			draw_surface.stop();
		}
		return (true);
	}

	public String getAppletInfo()
	{
		return "TEST APP VERSION 2";
	}
	
}


file: /Techref/language/JAVA/nosugar/graphics/draw/code/DrawSelector.java, 2KB, , updated: 1997/5/31 23:54, local time: 2024/12/29 07:35,
TOP NEW HELP FIND: 
3.12.147.12: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/graphics/draw/code/DrawSelector.java"> language JAVA nosugar graphics draw code DrawSelector</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!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .