Problem with button addition when double clicking a command label
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? Anyon开发者_StackOverflowe 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
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.
精彩评论