codice:
import java.awt.*;
import javax.swing.*;
public class Finestra extends JFrame {
public Finestra() {
super ("Finestra");
getContentPane().add(new Grafico(), BorderLayout.CENTER);
setLocation(200,250);
setSize(400,400);
show();
}
public static void main(String[] arg) {
new Finestra();
System.out.println("Creata la finestra");
}
class Grafico extends JComponent {
public void paint(Graphics g) {
g.drawRect(20, 50, 150, 60);
}
}
}
io farei cosė la classe inner :sexpulp: :sexpulp: :sexpulp: :sexpulp: