/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pixeltest;

import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;

/**
 *
 * @author user
 */

public class MyFrame extends JFrame {
    public static void main(String[] args) {
        // TODO code application logic here
MyFrame fd = new MyFrame("TMA");
fd.setVisible(true);
fd.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    }

    private JPanel buttonsPanel ;
    private JPanel checkBoxPanel ;
    private JCheckBox string;
    private JCheckBox circle;
    private JCheckBox line;
    private JCheckBox rectangle;
    private JButton [] keyPadButtons;
    private JButton moveLeft;
    private JButton moveRight;
    private JButton resetCoordinates;
    private JButton loadLastSavedCoordinates;
    private JButton saveCurrentCoordinates;
    
       public MyFrame(String title){
    setSize(600,250);
    setTitle(title);
    checkBoxPanel = new JPanel();
    string = new JCheckBox("String");
    circle = new JCheckBox("Circle");
    line = new JCheckBox("Line");
    rectangle = new JCheckBox("Rectangle");
    checkBoxPanel.add(string);
    checkBoxPanel.add(circle);
    checkBoxPanel.add(line);
    checkBoxPanel.add(rectangle);
        string.addActionListener(new checkBoxWatcher());
    circle.addActionListener(new checkBoxWatcher());
    line.addActionListener(new checkBoxWatcher());
    rectangle.addActionListener(new checkBoxWatcher());

    
    buttonsPanel = new JPanel();
    buttonsPanel.setLayout(new GridLayout(2,3));
    moveLeft = new JButton("<< Move left");
    moveRight = new JButton("Move right >>");
    resetCoordinates = new JButton("Reset coordinates");
    loadLastSavedCoordinates = new JButton("Load last saved coordinates");
    saveCurrentCoordinates = new JButton("save current coordinates");
    buttonsPanel.add(moveLeft);
    buttonsPanel.add(moveRight);
    buttonsPanel.add(resetCoordinates);
    buttonsPanel.add(loadLastSavedCoordinates);
    buttonsPanel.add(saveCurrentCoordinates);
    
}
private class checkBoxWatcher extends Pixel implements ActionListener { 
     @Override
     public void actionPerformed(ActionEvent a){
       public void paint(Graphics g){
         if (string.isSelected()){
             g.drawString("* --",x+c+d,y);
         }
         if (circle.isSelected()){
           g.fillOval(x+e,y,10,10);
         }
         if (line.isSelected()){
             g.drawline(x,y,b,c);
         }
         if(rectangle.isSelected()){
             g.fill3DRect(x + c, y + a, 15, 30, rootPaneCheckingEnabled);
         }

         
     }
