package paint;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
/**
* @author Administrator
*
*/
public class Tools extends JPanel implements MouseListener{
private JLabel lineLabel ;
private JLabel rectLabel ;
private JLabel polyLabel ;
private JLabel ovalLabel ;
private JLabel rrectLabel;
private JLabel emLabel;
private JLabel emrLabel;
private JLabel fullLabel;
private JLabel textLabel ;
Icon lineBug = new ImageIcon( getClass().getResource( "image/bug1.JPG" ) );
Icon rectBug = new ImageIcon( getClass().getResource( "image/bug2.JPG" ) );
Icon polyBug = new ImageIcon( getClass().getResource( "image/bug3.JPG" ) );
Icon ovalBug = new ImageIcon( getClass().getResource( "image/bug4.JPG" ) );
Icon rrectBug = new ImageIcon( getClass().getResource( "image/bug5.JPG") );
Icon textBug = new ImageIcon( getClass().getResource( "image/bug6.JPG" ) );
Icon emBug = new ImageIcon(getClass().getResource( "image/embug.JPG" ));
//Icon emrBug = new ImageIcon(getClass().getResource( "image/emrbug.JPG" ));
//Icon fullBug = new ImageIcon(getClass().getResource( "image/fullbug.JPG" ));
private Handle handle;
static Color color;
public Tools(Handle handle){
this.handle = handle;
handle.setTools(this);
//setLayout(null);
this.setBackground( Color.WHITE);
this.setBounds(0,4,61,500);
lineLabel= new JLabel(lineBug);
add(lineLabel);
lineLabel.setVisible(true);
rectLabel= new JLabel(rectBug);
add(rectLabel);
rectLabel.setVisible(true);
polyLabel= new JLabel(polyBug);
add(polyLabel);
polyLabel.setVisible(true);
ovalLabel = new JLabel();
ovalLabel.setIcon(ovalBug);
add(ovalLabel);
ovalLabel.addMouseListener(this);
ovalLabel.setVisible(true);
rrectLabel= new JLabel(rrectBug);
add(rrectLabel);
rrectLabel.setVisible(true);
textLabel= new JLabel(textBug);
add(textLabel);
textLabel.setVisible(true);
}
public void mouseClicked(MouseEvent e){
Object o = e.getSource();
if(o == lineLabel){
}
else if(o == rectLabel){
}
else if(o ==polyLabel){
}
else if(o == ovalLabel){
handle.getDrawJpanel().setLineTag(true);
emLabel= new JLabel(lineBug);
add(emLabel);
setLayout(null);
emLabel.setVisible(true);
}
else if(o == rrectLabel){
}
else if(o == textLabel){
}
}
public void mousePressed(MouseEvent e){
}
public void mouseReleased(MouseEvent e){
}
public void mouseEntered(MouseEvent e){
}
public void mouseExited(MouseEvent e){
}
}
请问为什么我点了那个椭圆的图标,没有反应呢,我本来想点击的时候再下面再显示一个图标。