001    /*
002     * SimuCS - Simulator to use with Classifier Systems 
003     * MSc project - Oxford University 
004     * by Benoit Isaac - Summer 2005
005     */
006    
007    package simuLCS.graphics;
008    import java.awt.Color;
009    import java.awt.GridLayout;
010    import java.awt.Label;
011    
012    import javax.swing.JPanel;
013    
014    import simuLCS.Config;
015    
016    /**
017     * Handles the Status Bar, giving information to the user
018     * @author Benoit
019     * 
020     */
021    public class G_StatusBar  extends JPanel {
022            
023             //     Informations
024             /** Coordinates of the Cursor */
025             private Label coord;
026             /** Information message */
027             private Label info;
028    
029             /**
030              * Constructor of the Status Bar
031              */
032             public G_StatusBar()
033             {
034                     setBackground(Color.lightGray);
035                     setLayout(new GridLayout(1,2));
036                     add ( info = new Label("Info:") );
037                     add ( coord = new Label("x :   y :  "));
038             }
039             /**
040              * Print a message in the status bar
041              * @param message to print
042              */
043             public void printMessage(String message)
044             {
045                     info.setText(message);
046             }
047             /**
048              * Print the coordinates of the cursor
049              * @param x 
050              * @param y 
051              */
052             public void printCoord(int x, int y)
053             {
054                     coord.setText("x : " + x + " y : " + y);
055             }
056             
057            /**
058             * @param i
059             * @param j
060             */
061            public void printCoordCorrected(int i, int j) {
062                    int x = i - Config.SHIFT_ARENA - (Config.SIZE_ARENA / 2);
063                    int y = j - Config.SHIFT_ARENA - (Config.SIZE_ARENA / 2);
064                    printCoord(x,y);
065            }
066    }