/******************************************************************************************
 * Surface Plotter version 1.10                                               Oct 14 1996 *
 * Surface Plotter version 1.20                                               Nov  8 1996 *
 *                                                                                        *
 * PlusMinus.java: Plus-Minus buttons for InputField                                      *
 *                                                                                        *
 * Copyright (c) 1996 Yanto Suryono. All Rights Reserved.                                 *
 *                                                                                        *
 * Permission to use, copy, and distribute this software for NON-COMMERCIAL purposes      *
 * and without fee is hereby granted, provided that this copyright notice appears in all  *
 * copies and this software is not modified in any way                                    *
 *                                                                                        *
 * Please send bug reports and/or corrections/suggestions to                              *
 * Yanto Suryono <d0771@cranesv.egg.kushiro-ct.ac.jp>                                     *
 ******************************************************************************************/

//import java.awt.*;
import javax.swing.*;
import java.awt.Event;
import java.awt.GridLayout;
import java.awt.Font;
import java.awt.Dimension;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class PlusMinus extends JPanel {
    private InputField Parent;
    private static int WIDTH = 5;
    
    JButton plus_button = new JButton("+");
    JButton minus_button = new JButton("-");
    
    
    PlusMinus(InputField parent) {
	super(); 
	setFont(new Font("Helvetica", Font.PLAIN, 2));
	setLayout(new GridLayout(2,1));
	
	Dimension button_dim = new Dimension(48, 20);
	plus_button.setPreferredSize(button_dim);
	minus_button.setPreferredSize(button_dim);
	
	add(plus_button);
	add(minus_button);
	
	
	
	plus_button.addActionListener(new ActionListener() {
	    public void actionPerformed(ActionEvent e) {
		Parent.Increase();
	    }
	});
	
	minus_button.addActionListener(new ActionListener() {
	    public void actionPerformed(ActionEvent e) {
		Parent.Decrease();
	    }
	});
	
	plus_button.setAlignmentX(JComponent.CENTER_ALIGNMENT);
	minus_button.setAlignmentX(JComponent.CENTER_ALIGNMENT);
	
	Parent = parent; 
    }
    
    public Dimension PreferredSize() {
	return new Dimension(WIDTH,0);
    }
} // end of file
