please dont rip this site

Language Java Nosugar Graphics Font Code Fontselector.java

// 
//	FontSelector 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 FontWobbler;

public class FontSelector extends Applet
{
	
	//*******************************************************************
	// instance variables
	//*******************************************************************
	Button go_button, stop_button;
	Choice lst_name, lst_style, lst_size;
	FontWobbler draw_surface;
	Rectangle rect = null;
	
	
	//*******************************************************************
	// applet methods
	//*******************************************************************
	public void init()
	{
		Label lbl_name, lbl_style, lbl_size;
		Panel control_panel, north_control_panel, south_control_panel;
		
		// --------------------------------------
		// create the interface items to display
		// --------------------------------------
		lbl_name = new Label("name");
		lst_name = new Choice();
		lst_name.addItem(FontWobbler.HELVETICA);
		lst_name.addItem(FontWobbler.TIMES);
		lst_name.addItem(FontWobbler.COURIER);
		lst_name.addItem(FontWobbler.DIALOG);
		lst_name.addItem(FontWobbler.DIALOGINPUT);
		lst_name.addItem(FontWobbler.ZAPFDINGBATS);
		
		lbl_style = new Label("Style");
		lst_style =  new Choice();
		lst_style.addItem(FontWobbler.PLAIN);
		lst_style.addItem(FontWobbler.ITALIC);
		lst_style.addItem(FontWobbler.BOLD);
		lst_style.addItem(FontWobbler.BOLDITALIC);
		
		lbl_size = new Label("Size");
		lst_size =  new Choice();
		lst_size.addItem("6");
		lst_size.addItem("8");
		lst_size.addItem("10");
		lst_size.addItem("12");
		lst_size.addItem("24");
		lst_size.addItem("36");
		
		go_button = new Button("Go");
		stop_button = new Button("Stop");
		draw_surface = new FontWobbler();
		
		// -------------add these things to a panel-------------
		north_control_panel = new Panel();
		north_control_panel.setLayout(new GridLayout(6,0));
		south_control_panel = new Panel();
		south_control_panel.setLayout(new GridLayout(2,0));
		
		north_control_panel.add(lbl_name);
		north_control_panel.add(lst_name);
		north_control_panel.add(lbl_style);
		north_control_panel.add(lst_style);
		north_control_panel.add(lbl_size);
		north_control_panel.add(lst_size);
		south_control_panel.add(go_button);
		south_control_panel.add(stop_button);
		
		control_panel = new Panel();
		control_panel.setLayout( new BorderLayout());
		control_panel.add("North", north_control_panel);
		control_panel.add("South", south_control_panel);
		
		//-------------------add to a borderlayout--------------
		this.setLayout( new BorderLayout());
		this.add("West", control_panel);
		this.add("Center", draw_surface);

	}
	
	public boolean action(Event event, Object o)
	{
		if (event.target == go_button)
		{
			draw_surface.wobbleFont( lst_name.getSelectedItem(), lst_style.getSelectedItem(), lst_size.getSelectedItem());
		}
		else if (event.target == stop_button)
		{
			draw_surface.stop();
		}
		return (true);
	}

	public String getAppletInfo()
	{
		return "Font selector";
	}
}


file: /Techref/language/java/nosugar/graphics/font/code/FontSelector.java, 3KB, , updated: 1997/6/1 20:30, local time: 2024/5/6 14:07,
TOP NEW HELP FIND: 
3.135.190.232: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/graphics/font/code/FontSelector.java"> language java nosugar graphics font code FontSelector</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!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .