Java: How to Create a Label

A label is used to write text in an application, display title and interactive text. To make it, I will use the Swing method name “JLabel”. It’s easy to make and similar to a button. Start with the same syntax as a button:

JLabel label = new JLabel(“My first JLabel!”);
label.setBounds(0, 0, 200, 30);

frame.add(label);

You can Run your application and see the result!

Other Tutorial for your Level:
Java: How To Create an Organize New Project
Java: How to Create Button
Java: Create a Basic Application

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s