Hey kindly correct my mistakes please... if you cannot...
can you please forward me to the person / forum that can guide me and help me!?
import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JPanel; import MyTrials.Pixel; public class MyFrame extends JFrame{ public static Pixel point = new Pixel(); public JPanel panel1; public JCheckBox face; public JCheckBox head; public JCheckBox tail; public JCheckBox body; public JPanel panel2; public JButton left; public JButton right; public JButton reset; public JButton load; public JButton save; public MyFrame(){ setTitle("FrameButtonTrials"); setSize(600, 250); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } public void addpanel1(){ panel1 = new JPanel(); getContentPane().add(panel1, "West"); panel1.setLayout(new GridLayout(5, 1)); face = new JCheckBox("String"); tail = new JCheckBox("Line"); head = new JCheckBox("Circle"); body = new JCheckBox("Rectangle"); panel1.add(face); panel1.add(tail); panel1.add(head); panel1.add(body); face.addItemListener(new CkeckBoxWatcher()); tail.addItemListener(new CkeckBoxWatcher()); head.addItemListener(new CkeckBoxWatcher()); body.addItemListener(new CkeckBoxWatcher()); } public void addpanel2(){ panel2 = new JPanel(); getContentPane().add(panel2, "South"); panel2.setLayout(new GridLayout(2, 3)); left = new JButton("<< Move left"); right = new JButton("Move right >>"); reset = new JButton("Reset coordinates"); load = new JButton("Load last saved coordinates"); save = new JButton("Save coordinates"); panel2.add(left); panel2.add(right); panel2.add(reset); panel2.add(load); panel2.add(save); left.addActionListener(new ButtonWatcher()); right.addActionListener(new ButtonWatcher()); save.addActionListener(new ButtonWatcher()); reset.addActionListener(new ButtonWatcher()); load.addActionListener(new ButtonWatcher()); } public void paint(Graphics g) { super.paint(g); g.drawRect(140, 40, 440, 140); g.setColor(Color.white); g.fill3DRect(140, 40, 440, 140, true); if (head.isSelected()) { g.drawOval(point.x + 92, 70, 60, 40); g.setColor(Color.red); g.fillOval(point.x + 92, 70, 60, 40); } if (tail.isSelected()) { g.drawLine(point.x, point.y, 150, 70); g.setColor(Color.red); } if (body.isSelected()) { g.drawRect(point.x - 5, 100, 100, 50); g.setColor(Color.red); g.fill3DRect(point.x - 5, 100, 100, 50, true); } if (face.isSelected()) { Font font = new Font("Sherif", Font.BOLD, 21); g.setFont(font); g.setColor(Color.black); g.drawString("* --", point.x + 111, 100); } } public class CkeckBoxWatcher implements ItemListener{ public void itemStateChanged(ItemEvent i){ repaint(); } } private class ButtonWatcher implements ActionListener{ public void actionPerformed(ActionEvent e){ Object select = e.getSource(); if (select.equals(left)){ point.x = point.x - 5; repaint(); } if (select.equals(right)){ point.x = point.x + 5; repaint(); } if (select.equals(reset)){ point.reset(); repaint(); } if (select.equals(save)){ point.savePos("D:/coordinates.txt"); repaint(); } if (select.equals(load)){ point.loadPos("D:/coordinates.txt"); repaint(); } } } public static void main(String[] args){ MyFrame f1 = new MyFrame(); f1.addpanel1(); f1.addpanel2(); } }