painting the program

hey

When I run my program and I change the format of the screen, the program does nog repaint itself (you only see the two buttons, but not the text), but you have to hide it and then maximise it again first. Does anybody understand what I mean (I'm not great in English) and know what I've done wrong?

( the applic file)

publicclass DeclinatioApplicextends JFrame

{

DeclinatioApplic()

{this.setSize(800,600);

this.setTitle("DECLINATIO");

this.getContentPane().add(new DeclinatioApplet("Cambreur

College"));

}

publicstaticvoid main(String[] args)

{new DeclinatioApplic().setVisible(true);

}

}

(the applet file)

publicclass DeclinatioAppletextends JAppletimplements ActionListener, MouseListener

{

Button ok, info;

String eigenaar;

public DeclinatioApplet(String naamEigenaar)

{

eigenaar = naamEigenaar;

this.setBackground(Color.LIGHT_GRAY);

Container c = this.getContentPane();

c.setLayout(null);

ok =new Button("OK");

info =new Button("INFO");

ok.addActionListener(this);

info.addActionListener(this);

ok.setBackground(new Color(222,222,222));

info.setBackground(new Color(222,222,222));

ok.setBounds(300, 480, 50, 30);

info.setBounds(455, 480, 50, 30);

c.add(ok);

c.add(info);

c.addMouseListener(this)

}

publicvoid paint(Graphics g)

{

Graphics2D g2 = (Graphics2D) g;

Font titel =new Font("Arial", Font.BOLD, 40);

g2.setFont(titel);

g2.setColor(Color.GREEN.darker().darker());

g2.drawString("DECLINATIO", 280 , 80);

}

( and so on....)

[3027 byte] By [Leora] at [2007-10-2 6:08:30]
# 1
although you have instantiated your JApplet that you stuck in the JFrame, you have not called your JApplet's init() method... - MaxxDmg...- ' He who never sleeps... '
MaxxDmga at 2007-7-16 13:09:04 > top of Java-index,Java Essentials,Java Programming...
# 2

i just looked at your code, being that you have a constructor, might as well just extend JPanel instead of JApplet since this is going to be a standalone application... being the JApplet ( Applets ) when used in a web page don't use the constructor but the init() method to initialized itself...

- MaxxDmg...

- ' He who never sleeps... '

MaxxDmga at 2007-7-16 13:09:04 > top of Java-index,Java Essentials,Java Programming...
# 3
I've changed the JApplet to JPanel and it works again.thank you very much.
Leora at 2007-7-16 13:09:04 > top of Java-index,Java Essentials,Java Programming...