I have a JPNLE that uses the flow layout I add JALL to several JLLs, to adjust their size Use setPreferedSize () to save them in the list, label_list Everything works fine then I want to resize them:
for (jlabel c: label_list) {c.setPreferedSize (new dimension (10,10)); } And it does not work.
c.setBackground (Color.red) and similar stuff works here Why can not I use the refined shape set here?
c.setbounds (1,1,10,10) and c.setSize (10,10) works, but after updating the UI (changing panel size) every size goes back to normal is.
Then I want to resize them:
(for JLable C: label_list) {c.setPreferedSize (new dimension (10,10)); }
And it does not work.
You need to call modify () on the parents of the label so that it is better to implement the layout and their preferred size. c.setbounds (1,1,10,10) and c.setSize (1010) Works, but after updating the UI (changing the panel size) every size normal Goes back to
Setting bound / size / location is the position of the layout manager's job status and size of the child components, manually with the Controller's Layout Manager.
Set the layout to null and set Setize-setLocation / setBounds, or use LayoutManager (recommended) and set the set never set / set the location Most, you can call fixed dispatch / setmaximum / set at standard size, but try to avoid this as it can cause cross L & F problems.
Comments
Post a Comment