Me podeis decir porque sale transparente el jframe de este codigo:
Graciassss
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class swing2jframe extends JFrame{
int ratonx,ratony;
swing2jframe ventana;
public static void main(String[] args) {
swing2jframe ventana=new swing2jframe();
ventana.setVisible(true);
ventana.setSize(500, 500);
ventana.setBackground(Color.BLUE);
ventana.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
EventosRaton eventosraton=new EventosRaton(ventana);
ventana.addMouseListener(eventosraton);
}
public void paint(Graphics g){
g.drawString(ratonx+","+ratony, ratonx, ratony);
}
}
class EventosRaton extends MouseAdapter{
swing2jframe laventana;
EventosRaton(swing2jframe ventana){
laventana=ventana;
}
public void mouseClicked(MouseEvent e){
laventana.ratonx=e.getX();
laventana.ratony=e.getY();
laventana.repaint();
}
}