Write a program display a some text in the frame with help of the lebel. - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
Write a program display a some text in the frame with help of the lebel.

Write a program display a some text in the frame with help of the lebel.

import javax.swing.*;
import java.awt.*;

class FrameDemo2 extends JFrame
{
  JLabel lbl;
  FrameDemo2()
  {
    Container c=this.getContentPane();
c.setLayout(new FlowLayout());
c.setBackground(Color.pink);
lbl=new JLabel("Hello Learnner!");
lbl.setFont(new Font("Helvetica",Font.BOLD,34));
lbl.setForeground(Color.black);
c.add(lbl);
}
public static void main(String[]arg)
{
FrameDemo2 obj=new FrameDemo2();
obj.setTitle("MY SWING FRAME");
obj.setSize(300,300);
obj.setVisible(true);
obj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}


About EasyToCode

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.