public class Optiuni extends JPanel implements ActionListener,MouseListener {
	public 	JButton buton1;
	public	JButton buton2;
	public	JButton buton3;
	public	JButton buton4;
	public	JButton buton5;
	public	JButton buton6;
	public	JButton buton7;
	public  JButton buton8;
	public  JButton buton9;
		 	Proiect parent;
	
	Optiuni(Proiect proiect) {
		parent = proiect;
		 
		 buton1 = new JButton("Floyd-Warshall");
		 buton2 = new JButton("Johnson");
		 buton3 = new JButton("New Graph");
		 buton4 = new JButton("Example");
		 buton5 = new JButton("Increase");
	 	 buton6 = new JButton("Decrease");
		 buton7 = new JButton("Finish");
		 buton8 = new JButton("Next Path");
		 buton9 = new JButton("Show Path");
	
	
		setLayout(new GridLayout(10, 1, 0, 10));
  
        add(buton1);
        add(buton2);
        add(buton3);
        add(buton4);
        add(buton5);
        add(buton6);
        add(buton7);
        add(buton8);
        add(buton9);

		buton5.setVisible(false);       
		buton6.setVisible(false);       
		buton7.setVisible(false);       
		buton8.setVisible(false);       
		buton9.setVisible(false);
		       
        buton1.setEnabled(false);       
		buton2.setEnabled(false);       
        
	
        buton1.addActionListener(this); 
        buton2.addActionListener(this);buton2.setActionCommand("Johnson");
        buton3.addActionListener(this);
		buton4.addActionListener(this);        
		buton5.addActionListener(this); buton5.setActionCommand("Increase");   
		buton5.addMouseListener(this); 
		buton6.addActionListener(this); buton6.setActionCommand("Decrease");
		buton7.addActionListener(this); buton7.setActionCommand("Finish");       
        buton8.addActionListener(this);
        buton9.addActionListener(this);
    }
    
    public void actionPerformed(ActionEvent e) {
    	
    		if (e.getActionCommand().equals("Increase")) parent.suprafata.increaseWeight();
    	   	if (e.getActionCommand().equals("Decrease")) parent.suprafata.decreaseWeight();
    		if (e.getActionCommand().equals("Finish")) {
    							  parent.suprafata.finish();
    						   
								}
     		if (e.getActionCommand().equals("Floyd-Warshall")) {
     									parent.suprafata.FloydWarshall();
     									buton8.setVisible(true);
     									buton9.setVisible(true);
     								}
     		if (e.getActionCommand().equals("Example")) { 
     						parent.suprafata.Example();
     						parent.info.infodoc.showLine("string2");
     						buton1.setEnabled(true);
     						buton2.setEnabled(true);
     						buton8.setVisible(false);
     						buton9.setVisible(false);
     							}
       		if (e.getActionCommand().equals("New Graph")) {
       							parent.suprafata.init();
       							buton1.setEnabled(true);
     							buton2.setEnabled(true);
     							buton8.setVisible(false);
     							buton9.setVisible(false);
       							}
     		if (e.getActionCommand().equals("Show Path") && parent.suprafata.nr_noduri_sel == 2) {
   					parent.suprafata.nr_elem = 0;  			
   					parent.suprafata.PrintAllPairs(parent.suprafata.Pi,parent.suprafata.nodstart+1,parent.suprafata.nodend+1);
   					parent.suprafata.repaint();
  						}
   			if(e.getActionCommand().equals("Next Path")) parent.suprafata.reinit();
   			if(e.getActionCommand().equals("Johnson") && !parent.suprafata.johnson && !parent.suprafata.fw) {
   						 parent.suprafata.Johnson(); 
   						 buton8.setVisible(true);
     					 buton9.setVisible(true);
     					}
   															
   }
   
   public void enable() {
   		buton5.setVisible(true);
		buton6.setVisible(true);
		buton7.setVisible(true);
	}
	
	public void mouseClicked(MouseEvent e) {}
	public void mouseEntered(MouseEvent e) {}
	public void mouseExited(MouseEvent e) {}
	public void mousePressed(MouseEvent e) {}
	public void mouseReleased(MouseEvent e) {}
	
    
	

}