// file: ButtonPanel.java
//

// import java libraries
//
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;

public class ButtonPanel extends JPanel {
    
    // ---------------------------------------------------
    //
    // declare class member data
    //
    // ---------------------------------------------------

    // array of buttons for use here
    //
    public JButton buttons[] = null;

    // ---------------------------------------------------
    //
    // declare class constructors
    //
    // ---------------------------------------------------

    // method: ButtonPanel
    //
    // arguments: none
    // returns  : none
    //
    // default class constructor
    //
    public ButtonPanel(BugPanel bugPanel) {

	// set the layout of the panel to a grid layout
	// one row, 6 columns, hgap =5 , vgap = 5
	//
	this.setLayout(new GridLayout( 1 , 6 , 5 , 5 ));

	// create the array of buttons to be placed on the scree
	//
	buttons = new JButton[6];
	for (int i = 0; i < 6; i++) {
	    buttons[i] = new JButton(getButtonsNames(i));
	    this.add(buttons[i]);
	    buttons[i].addActionListener(bugPanel);
	    buttons[i].setFont(bugPanel.newFont);
	}
	
	// set the preferred size of this block
	//
	this.setPreferredSize(new Dimension(620, 30));
    }
 
    private String getButtonsNames( int index ) {
	
	// create a string for returning
	//
	String return_value = null;


	// create strings to add to the buttons
	//
	switch ( index ) {
	    
	case 0:  
	    return_value = new String("Modify");
	    break;
	    
	case 1:  
	    return_value = new String("Resolve");
	    break; 
		
	case 2:  
	    return_value = new String("Close");
	    break; 
	    
	case 3:  
	    return_value = new String("Assign");
	    break; 
	    
	case 4:  
	    return_value = new String("Refresh");
	    break;
	    
	case 5: 
	    return_value = new String("Save");
	    break;  
	}

	// return the value that shall become the name of the wanted button
	//
	return return_value;
	
    }
}


