Add Object to JPanel after button click
问题 I have created a JScrollPane with a JPanel inside it and I want to add JPanel/JLabel/Other objects after pressing the button. For example after three button presses I want to get something like this: I tried myJPane.add(testLabel) with testlabel.setBounds() but no result, I don't want to use GridLayout because of the unchangeable sizes. I would like it if the added objects had different sizes - adjusted to the text content. What should I use for it and how? Thanks in advance. Best regards,