java - JLabels in a JScrollPane -


i have scrollpane in want add multiple jlabel. code..

jpanel paneleast = new jpanel();     paneleast.setborder(new titledborder(null, "notifiche", titledborder.leading, titledborder.top, null, null));     paneleast.setpreferredsize(new dimension(250,120));     paneleast.setlayout(null);      jlabel lblnewlabel_3 = new jlabel("label1");     lblnewlabel_3.seticon(new imageicon(home.class.getresource("/it/polimi/icon/contact.png")));     lblnewlabel_3.setbounds(10, 81, 240, 52);     paneleast.add(lblnewlabel_3);      jlabel label_3 = new jlabel("label2");     label_3.seticon(new imageicon(home.class.getresource("/it/polimi/icon/verified.png")));     label_3.setbounds(new rectangle(4, 0, 0, 0));     label_3.setalignmenty(component.top_alignment);     label_3.setbounds(10, 30, 240, 52);     paneleast.add(label_3);      jlabel label_4 = new jlabel("label3");     label_4.seticon(new imageicon(home.class.getresource("/it/polimi/icon/verified.png")));     label_4.setbounds(new rectangle(4, 0, 0, 0));     label_4.setalignmenty(component.top_alignment);     label_4.setbounds(10, 131, 240, 52);     paneleast.add(label_4);      jscrollpane scrollpane = new jscrollpane(paneleast,jscrollpane.vertical_scrollbar_never,jscrollpane.horizontal_scrollbar_as_needed);     pan2.add(scrollpane,borderlayout.center); 

and not work, suggestion?

avoid using null layouts, pixel perfect layouts illusion within modern ui design. there many factors affect individual size of components, none of can control. swing designed work layout managers @ core, discarding these lead no end of issues , problems spend more , more time trying rectify

jscrollpane relies on layout manager api in order calculate preferred size of container showing , determine when view larger , should show scroll bars


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -