FileDocCategorySizeDatePackage
FilterGUIDemo2.javaAPI DocExample1127Mon May 31 22:51:38 BST 2004regress.filtergui

FilterGUIDemo2

public class FilterGUIDemo2 extends Object
A simple demo of FilterGUI

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] av)
"main program" method - construct and show


		/** Inner class to represent real MyFilter implementations */
		class BasicFilter extends MyFilter {
			String title;
			BasicFilter(String s) {
				title = s;
			}
			public String toString() {
				return title;
			}
			public void write(byte[] data) throws MyFilterException {
				next.write(data);
			}
		}

		MyFilter[] filters = { 
			new BasicFilter("Basic Copy"),
			new BasicFilter("Noise Reduction"),
			new BasicFilter("RLE")
		};

		int DEFAULT_FILTER = 1;	// i.e., filters[DEFAULT_FILTER] is default

		// create a this object, tell it to show up
		final JFrame f = new JFrame("Filter FilterGUI");
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		FilterGUI comp = new FilterGUI(filters, DEFAULT_FILTER);
		f.getContentPane().add(comp);
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.pack();
		f.setLocation(200, 200);
		f.setVisible(true);