plz tell me where i am stuck.how could i solve this
package drawing;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.*;
import javax.swing.event.*;
/**
*
* @author
*/
public class RunProgram extends JPanel implements ActionListener, ChangeListener, MouseListener {
private JPanel phasePanel;
static JPanel contentPane;
private static JMenuBar bar;
private JPanel picture1;
private JPanel picture2;
private Component toolBar;
/** Creates <strong class="highlight">a</strong> new instance of RunProgram */
public RunProgram() {
setLayout(new BorderLayout());
//Create <strong class="highlight">a</strong> panel and make it the content pane.
contentPane = new JPanel(new BorderLayout());
contentPane.setBorder(BorderFactory.createRaisedBevelBorder());
//create panel <strong class="highlight">to</strong> show original pictures
picture1 = new JPanel();
picture1.addMouseListener((MouseListener) this);
// picture1.setBackground(Color.BLUE);
picture1.setBorder(BorderFactory.createLoweredBevelBorder());
picture1.setPreferredSize(new Dimension(450, 1000));
picture2 = new JPanel();
picture2.addMouseListener(this);
//picture2.setBackground(Color.GREEN);
picture2.setBorder(BorderFactory.createLoweredBevelBorder());
picture2.setPreferredSize(new Dimension(450, 1000));
JPanel controlPanel = new JPanel();
//controlPanel.setBackground(Color.GRAY);
controlPanel.setBorder(BorderFactory.createLoweredBevelBorder());
controlPanel.setPreferredSize(new Dimension(800, 50));
controlPanel.setLayout(new FlowLayout());
contentPane.add(phasePanel, BorderLayout.SOUTH);
contentPane.add(toolBar, BorderLayout.NORTH);
contentPane.add(picture1, BorderLayout.WEST);
contentPane.add(picture2, BorderLayout.EAST);
contentPane.add(bar, BorderLayout.NORTH);
contentPane.add(toolBar, BorderLayout.CENTER);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
JFrame frame = new JFrame("ImageViewer");
frame.add(new RunProgram());
frame.setSize(1100, 900);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setJMenuBar(bar);
frame.setContentPane(contentPane);
frame.setVisible(true);
}
public void mouseClicked(MouseEvent e) {
x = e.getX();
y = e.getY();
System.out.println("x = " + x + "y = " + y);
drawCircle(e.getX()-(radius/2), e.getY()-(radius/2));
repaint();
}
public void drawCircle(int x, int y) {
Graphics g = getGraphics();
g.drawOval(x - radius, y - radius, 2 * radius, 2 * radius);
g.setColor(Color.BLACK);
g.fillOval(x - radius, y - radius, 2 * radius, 2 * radius);
}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
int x, y;
int radius = 20;
@Override
public void stateChanged(ChangeEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}
}