0% found this document useful (0 votes)
7 views1 page

Java Swing ScrollPane Example

The document is a Java program that creates a JFrame with a FlowLayout containing a JButton inside a JScrollPane. The JScrollPane is set to always show both vertical and horizontal scrollbars. The main method initializes the JFrame and sets its size to 500x500 pixels before making it visible.

Uploaded by

shashank220906
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Java Swing ScrollPane Example

The document is a Java program that creates a JFrame with a FlowLayout containing a JButton inside a JScrollPane. The JScrollPane is set to always show both vertical and horizontal scrollbars. The main method initializes the JFrame and sets its size to 500x500 pixels before making it visible.

Uploaded by

shashank220906
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Input:

import [Link].*;
import [Link].*;
public class AJPPR62 extends JFrame
{
AJPPR62()
{
FlowLayout f = new FlowLayout();
setLayout(f);
JButton b1 = new JButton("This button is inside a
Scrollpane");
JScrollPane s = new
JScrollPane(b1,ScrollPaneConstants.VERTICAL_SCROLLBAR
_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWA
YS);
add(s);
}
public static void main(String args[])
{ AJPPR62 a = new AJPPR62();
[Link](500,500);
[Link](true);
}
}
Output:

You might also like