swing - \n Not Working For Linebreak -- Java -


i using following code:

import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jtextfield;   import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.net.uri;  import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jtextfield;  public class finder extends jframe {        jpanel jp = new jpanel();        jlabel jl = new jlabel("credits: andrew / jellybellyfred");        jtextfield jt = new jtextfield("enter player name, press 'find skin'!", 30);        jbutton jb = new jbutton("find skin");        jlabel lnbreak = new jlabel("\n");         public finder()        {               settitle("minecraft skin finder");               setvisible(true);               setsize(500, 200);               setdefaultcloseoperation(exit_on_close);               setresizable(false);                jp.add(jt);               jp.add(lnbreak);               jp.add(jb);               jb.addactionlistener(new actionlistener()               {                       public void actionperformed(actionevent e)                       {                              string input = jt.gettext();                              jl.settext("http://minecraft.aggenkeech.com/player/" + input);                       }               });                jp.add(jl);               add(jp);         }          public static void main(string[] args)        {              finder t = new finder();        } } 

to try new window this:

[input box]

[button]

--text--

but reason turns out this:

[input box] [button]

--text--

i'm not sure if following works in gui. there no harm in trying out.

system.getproperty("line.separator") 

use above code in place of "\n". in labels, have tried few html tags worked charm. try 1 , provide feedback.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -