Frame Scrollbar

import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
public class ScrollBarDemo2 extends JFrame {
	JPanel p1;
	JButton b1[];
	JScrollPane sp;
	public ScrollBarDemo2() {
		super("Win");
		setSize(500, 500);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		p1 = new JPanel();
		sp = new JScrollPane(p1);
		getContentPane().add(p1);
		p1.setLayout(new FlowLayout());
		b1 = new JButton[100];
		for (int i = 0; i < b1.length; i++) {
			p1.add(b1[i] = new JButton("Button " + i));
		}
		setVisible(true);
	}
	public static void main(String[] args) {
		new ScrollBarDemo2();
	}
}

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