A
Andreas Beresko
Hi,
I got followning problem: i have visible JPanel on the screen. When i click
on it, a contet menu appears, where I can coose "add another panel".
This calls a method paintNewPanel() and should add a new visible panel on my
panel. Code:
public void paintNewPanel(JPanel drawArea){ //is the JPanel which captures
the mouseclick an which should contain the new panel
JPanel panel = new JPanel();
panel.setBackground(Color.gray);
drawArea.add(panel);
panel.setBounds(0,0,100,100);
}
Problem: the new Panel isn't visible. I tried to call drawArea.repaint,
invalidate ... but nothing happens. Where's my fault?
best regarda Andreas
I got followning problem: i have visible JPanel on the screen. When i click
on it, a contet menu appears, where I can coose "add another panel".
This calls a method paintNewPanel() and should add a new visible panel on my
panel. Code:
public void paintNewPanel(JPanel drawArea){ //is the JPanel which captures
the mouseclick an which should contain the new panel
JPanel panel = new JPanel();
panel.setBackground(Color.gray);
drawArea.add(panel);
panel.setBounds(0,0,100,100);
}
Problem: the new Panel isn't visible. I tried to call drawArea.repaint,
invalidate ... but nothing happens. Where's my fault?
best regarda Andreas