Hossein Margani
Hossein Margani

Reputation: 1056

setVisible in Java Applet not working

I am writing a Java applet, in my applet I simply call setVisible() to control the visibility of some panels.

For example:

pnlAddUser.setVisible(true);

but sometimes showing panel does not work. and when I just click on the border of Applet Viewer window, the panel appears.

I used:

but it doesn't work.

Edit: I should mention, I am using a JTree and when a TreeNode is selected, I show or hide some panels according to the type of the node.

Please help me, Thanks.

Upvotes: 0

Views: 1906

Answers (1)

Hossein Margani
Hossein Margani

Reputation: 1056

Solved. Not good but it works.

I added the code:

public void repaintAgain() {
    setSize(this.getWidth() - 1, this.getHeight() - 1);
    setSize(this.getWidth() + 1, this.getHeight() + 1);
}

whenever I want to repaint, use this.

Upvotes: 1

Related Questions