Frame with Panel

import javax.swing.*;
public class FrameDemo5 extends JFrame 
{
	//Panel1 p1;
	public FrameDemo5()
	{
		super("techmyguru.com");
		setSize(500,600);
		getContentPane().add(new Panel1());
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setVisible(true);
	}
	public static void main(String[] args) 
	{
	new FrameDemo5();
	}
}

Download

Panel1.java

import java.awt.Color;
import java.awt.Font;
import javax.swing.*;
public class Panel1 extends JPanel {
	JLabel l1, l2;

	public Panel1() {
		super();
		l1 = new JLabel("This is label 1");
		l1.setForeground(Color.blue);
		setBackground(Color.gray);
		l1.setFont(new Font("Vardena", Font.BOLD, 20));
		l1.setToolTipText("This is label one");
		add(l1);
		add(l2 = new JLabel("This is label 2"));
	}
}

Download

Frame in Swing

Simple Frame
Frame with Panel
Frame Menu Event ans Color Chooser
Frame with Panel and Button
TextField and TextArea
Combobox in Frame
Change Icon of Frame
Scrollbar in Frame
Scrollbar in Frame
Add picture in Frame
Label in Frame
Toggle Buttons in frame
Radio Buttons in Frame


Write your Comment

Name :
Email Id : [ We will not publish your email id ]
Your Comment : [ Maximum 200 chars ]
Enter Security code