How to fix location error on java labels in GUI Application Used SWING? -
i used following code display multiple lables on java gui app. when used location method last label object, not worked properly. case effected last object of flow. follwoing code segment , screen shot of output window. please give me feedback solve this. thanks!
package gui.creating; /** * * @author dilan dinushka */ import javax.swing.*; public class guicreating { /** * @param args command line arguments */ public static void main(string[] args) { jframe frame1 = new jframe(); frame1.setsize(500,500); frame1.settitle("basic gui application"); frame1.setdefaultcloseoperation(jframe.exit_on_close); frame1.setvisible(true); jlabel lbl1 = new jlabel("welcome idm!"); lbl1.setbounds(100,100,200,50); frame1.add(lbl1); jlabel lbl3 = new jlabel("thank you"); lbl3.setbounds(100,200,200,50); frame1.add(lbl3); jlabel lbl2 = new jlabel("nuturing achievers"); lbl2.setbounds(100,150,200,50); frame1.add(lbl2); } }
location method deprecated think. in javadocs , check out post, may java swing - jlabel location
Comments
Post a Comment