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);
}
}
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);
}
}
0 comments:
Post a Comment