views:

21

answers:

1

Hy,

I got an intersting problem which I stumbled upon. When I double-click a JLabel in a JSplitPane I want to add another jbutton in a JPanel, its a shorter way to make a dragg and drop. The problem is that the button doesn't appears only if i'll position the mouse on the area the button should appear. Why does it happens this way? Anyone got a clue? Are there some thread related issues involved? Sorry, I forgot to mention that the jlabel which I want to double-click it's in another Jpanel from which I want to dispaly the jbutton, perhaps is relevant. Thanks in advance

A: 

When you add (remove) a component to a visible GUI then you should do:

panel.add( component );
panel.revalidate();
panel.repaint();

If you need more help post your SSCCE showing the problem.

camickr
thank you ...I reminded myself that there exists repaint just a few minutes ago...silly me
mistique
Well then mark the question as answered.
camickr