How to Create JLabel With Text

This tutorial will show you  How to Create JLabel With Text  and add it to a JFrame  . JLabel  is a simple Graphical User Interface compo...

Create JLabel With Text Example Code.
This tutorial will show you  How to Create JLabel With Text  and add it to a JFrame .JLabel  is a simple Graphical User Interface component that is only used to show  a text  message.

Common JLabel Constructors

  • JLabel(String s)-creates a JLabel with a text.
  • JLabel(Icon icon)-creates a JLabel with ImageIcon.
  • JLabel(Icon icon,String s)-creates a JLabel with both icon and text.

Create JLabel With Text Example Code.

[
import javax.swing.JLabel;

import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JFrame;
public class JLabelExample  extends JFrame{
    public JLabel user,pass;

    public JPasswordField password;
    public JTextField username;

    JLabelExample()
    {
        super("JLabel Example");
        user=new JLabel("Username");
        pass=new JLabel("Password");
        password=new JPasswordField();
        username=new JTextField();
        user.setBounds(10, 10, 200, 20);
        username.setBounds(100, 10, 200, 20);
        pass.setBounds(10, 50, 200, 20);
        password.setBounds(100,50 , 200, 20);
        add(user);
        add(username);
        add(pass);
        add(password);
        setLayout(null);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(400,300);
        setVisible(true);

    }
    public static void main(String args[])
    {
        new JLabelExample();
    }

}
]

COMMENTS

Name

android arrays cnna1 graphics java java control statements java.swing JButton JFrame JLabel JTextField laravel node.js OPP questions swing technology
false
ltr
item
Code WHIZZ: How to Create JLabel With Text
How to Create JLabel With Text
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXCTiYoyypoN4qQwsAAh70ieXxET6-cAZB4eVty1V063Tp13AuGPPzkpIxUYiRXd-ysaQMlMvZ04_URu8Z2bcCLtL1WGPbfAKAkMKwQGoUqGevQc95o-z0EWNG53dDFf_ajbk0_O9nQfIV/s200/JLabel-example-min.PNG
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXCTiYoyypoN4qQwsAAh70ieXxET6-cAZB4eVty1V063Tp13AuGPPzkpIxUYiRXd-ysaQMlMvZ04_URu8Z2bcCLtL1WGPbfAKAkMKwQGoUqGevQc95o-z0EWNG53dDFf_ajbk0_O9nQfIV/s72-c/JLabel-example-min.PNG
Code WHIZZ
https://code-whizz.blogspot.com/2017/04/how-to-create-jlabel-with-text.html
https://code-whizz.blogspot.com/
http://code-whizz.blogspot.com/
http://code-whizz.blogspot.com/2017/04/how-to-create-jlabel-with-text.html
true
5534598864497432585
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy