Jlabel resizing java -


i creating jlabel inside jtextpane background color , time tried resize code setsize , setprefferedsize , revalidate both of them didnt work. want width of jlabel to 130 , height of 20.

is there way doing it?

here code

final jlabel jl = new jlabel(rs2.getstring("username"));             final string username = rs2.getstring("username");             border d = borderfactory.createemptyborder(1,10,1,10);             border d2 = borderfactory.createlineborder(color.black);             border d3 = borderfactory.createcompoundborder(d2,d);             jl.setpreferredsize(new dimension(130,20));             jl.setfont(new font("calibri",font.bold,16));             jl.setborder(d3);               jl.setopaque(true);             jl.setbackground(color.orange);               cursor c = new cursor(cursor.hand_cursor);             jl.setcursor(c);             jl.revalidate();             jtp.insertcomponent(jl);              sd.insertstring(sd.getlength(), "\n", subpanel1.sas); 

enter image description here


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -