import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class test extends JFrame {
JLabel la = new JLabel();
test(){
setTitle("No.1");
setLayout(new FlowLayout());
setSize(300,300);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setContentPane(new Panel());
la.addMouseListener(new ML());
}
class Panel extends JPanel{
Panel(){
setLayout(new FlowLayout());
la=new JLabel("여기요");
add(la);
}
}
class ML extends MouseAdapter{
public void mouseEntered(MouseEvent e){
la.setText("사랑");
}
public void mouseExited(MouseEvent e){
la.setText("Love");
}
public void mouseDragged(MouseEvent e){
setBackground(Color.BLUE);
}
}
public static void main(String[] args) {
new test();
}
}
원본코드고요. 드래그가 아예 안먹히는듯합니다;
백그라운드말고 text글씨바꾸는것도 안되는데 이유가 뭘까요??
알려주세요.. 고맙습니다