Basically at the moment, I can drag JLabels from one panel (selectpanel) to another Jlabel on another panel (storypanel).
What I’m wondering is, is it possible to create a JLabel on the storypanel, when I drag a JLabel from the selectpanel? For example if I had 5 JLabels on the select panel and I dragged each twice to the storypanel, I would get 10 Jlabels on the storypanel.
I hope that question is clear, please let me know if it is not.
Yes, it is possible. Dragging operation is a combination of actions of removing a label from one panel and adding it to the other panel immediately. During this process you are referring a
JLabelinstance which is changing its container panel.So track and debug your code for this logic, find out where the addition of label to story panel occurs. It should be something like
storyPanel.add(yourLabel);Just after this statement create a new JLabel object and add it to the story panel. Isn’t it easy?