5     cytron package percent;
     5     cytron import java.awt.event.ActionEvent;
     5     cytron import java.awt.event.ActionListener;
     5     cytron 
     5     cytron import javax.swing.*;
     6    wooster // import javax.swing.event.ChangeEvent;
     6    wooster // import javax.swing.event.ChangeListener;
     6    wooster import javax.swing.border.EtchedBorder;
     6    wooster import javax.swing.border.TitledBorder;
     5     cytron 
     6    wooster public class Controller extends JPanel implements ActionListener
     6    wooster {
     6    wooster 	private PercentModel model;
     6    wooster 	private ViewAsSlider view1, view2, view3;
     6    wooster 	private ViewAsText view4;
     6    wooster 	private JButton button_reset;
     6    wooster 	private JButton button_min;
     6    wooster 	
     5     cytron 
     6    wooster 	public Controller(String s) 
     6    wooster 	{
     6    wooster 			this.add(new JLabel(s));
     6    wooster 	                // add other things you want to see here:
     6    wooster 			this.setBorder(new TitledBorder(new EtchedBorder(), "Color Control Slider"));
     6    wooster 			model = new PercentModel();
     6    wooster 			view1 = new ViewAsSlider(model, false);
     6    wooster 			view4 = new ViewAsText(model);
     6    wooster 			button_reset = new JButton("Reset");
     6    wooster 			button_min = new JButton("Min");	
     6    wooster 			add(view1);
     6    wooster 			add(view4);
     6    wooster 			add(button_reset);
     6    wooster 			add(button_min);
     6    wooster 			
     6    wooster 			button_reset.addActionListener(this);
     6    wooster 			button_min.addActionListener(this);
     6    wooster 		
     6    wooster 		
     5     cytron 	}
     5     cytron 
     5     cytron 	public PercentModel getModel() {
     5     cytron 		return model;
     5     cytron 	}
     6    wooster 	public JSlider getSlider()
     6    wooster 	{
     6    wooster 		return view1;
     6    wooster 	}
     5     cytron 	
     6    wooster 	
     5     cytron 	public static void main(String[] args) {
     6    wooster 		Controller panel = new Controller("WHAT'SUP CSE 132, You guys ROCK!");
     5     cytron 		//
     5     cytron 		// What you see below is what YOPS did for you
     5     cytron 		//
     5     cytron 		JFrame frame = new JFrame();
     5     cytron 		frame.add(panel);
     5     cytron 		frame.pack();
     5     cytron 		frame.setVisible(true);
     5     cytron 		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     5     cytron 	}
     6    wooster 	
     6    wooster 	public void actionPerformed(ActionEvent event)
     6    wooster 	{
     6    wooster 		if (event.getActionCommand().equals("Min"))
     6    wooster 			model.setValue(0);
     6    wooster 		else if (event.getActionCommand().equals("Reset"))
     6    wooster 			model.setValue(255);
     6    wooster 	}
     5     cytron 
     5     cytron 
     6    wooster }
     6    wooster