scrollbar in JPanel
Scroll bar is not working when i am using the panel layout is null. If i change the panel layout to flow or grid its working. I have a great trouble in this please help me. Here my code.....
import java.awt.*;
import javax.swing.*;
class scroll
{
public static void main(String[] args)
{
Frame f = new Frame ("Demo");
JPanel p = new JPanel();
JButton b1 = new JButton("Button 1");
JButton b2 = new JButton("Button 2");
p.setLayout(null);
p.setBackground(Color.red);
b1.setBounds(100,500,150,20);
b2.setBounds(100,150,150,20);
p.add(b1);
p.add(b2);
JScrollPane s = new JScrollPane(p, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
f.add(s);
f.setSize(70,70);
f.setVisible(true);
}
}
View Answers
October 18, 2010 at 11:17 AM
Hi Friend,
import java.awt.*;
import javax.swing.*;
class scroll
{
public static void main(String[] args)
{
Frame f = new Frame ("Demo");
JPanel p = new JPanel();
JButton b1 = new JButton("Button 1");
JButton b2 = new JButton("Button 2");
p.setBackground(Color.red);
p.add(b1);
p.add(b2);
JScrollPane s = new JScrollPane(p);
f.add(s);
f.setSize(70,70);
f.setVisible(true);
}
}
Thanks
Related Tutorials/Questions & Answers:
scrollbar in JPanelscrollbar in JPanel Scroll bar is not working when i am using... f = new Frame ("Demo");
JPanel p = new
JPanel();JButton b1 = new..., JScrollPane.VERTICAL_
SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_
SCROLLBAR_ALWAYS);f.add(s
jpaneljpanel hello sir, i made one
jpanel inside the frame and made the button inside the panel.. wrote the only second panel code other class file.. so when click the button then open the second panel same place of first panel
Advertisements
jpaneljpanel hello sir, i made one
jpanel inside the frame and made the button inside the panel.. wrote the only second panel code other class file.. so when click the button then open the second panel same place of first panel
jpaneljpanel hello sir, i made one
jpanel inside the frame and made the button inside the panel.. wrote the only second panel code other class file.. so when click the button then open the second panel same place of first panel
jpaneljpanel hello sir, i made one
jpanel inside the frame and made the button inside the panel.. wrote the only second panel code other class file.. so when click the button then open the second panel same place of first panel
scrollbarscrollbar I add a
scrollbar to my Frame and its not working
Java Scrollbar Java
Scrollbar What is the difference between a
Scrollbar and a ScrollPane
Scrollbar
Scrollbar
A
scrollbar is represented by a "slider" widget. The characteristics of it are specified by integer values which are being set at the time of
scrollbar Scroll in JPanel static void main(String[] args)
{
Frame f = new Frame ("Demo");
JPanel p = new
JPanel();
JButton b1 = new JButton("Button 1");
JButton b2 = new JButton("Button 2
menu with scrollbarmenu with scrollbar I want to use MenuBar with
Scrollbar. I tried...);
bar.add(rate);
bar.add(setting);
bar.add(help);
JPanel panel=new
JPanel...{
private
JPanel panel;
public menu()
{
JMenuBar bar = new
Jpanel allignmentJpanel allignment i have two panels added one below anotehr. and i have a one button.
when i clicked button. the first panel ara should be overlapped with second panel. i mean second panel size should cover both paenls size
Horizontal ScrollbarHorizontal Scrollbar I am creating a JSF project that has a print("<af:table/>"); the table is too wide to display in the browser. I was wondering if there was anyway to implement a horizontal
scrollbar in this table so
java program:scrollbarjava program:scrollbar my program logic is that when i scrolling
scrollbar according to that the oval shap is changed by fetching the value of
scrollbar the oval is drawn please give me a proper code of this logic
CSS ScrollBar PropertiesCSS
ScrollBar Properties How can i set
ScrollBar properties in CSS?
I am using HTML, CSS and Div in my code.
Thanks!!
overflow: scroll;
overflow-y: scroll;
overflow-x: scroll;
overflow:-moz-scrollbars-vertical
scrollbar - applet - Appletscrollbar - applet Hi!!
It is the program for a vertical scroll bar and the output is (small vertical
scrollbar).
Suppose if I want a lengthy... ScrollbarDemo extends Applet {
public void init() {
Scrollbar sb = new
how to add scrollbar to JFramehow to add
scrollbar to JFrame hello friends
i am making a java... it shows the
scrollbar but do not show the scrolling tabs here is my code pls do help... java.awt.TextField.*;
public class try1 extends
JPanel implements ActionListener,ItemListener
how to add scrollbar to JFramehow to add
scrollbar to JFrame hello friends
i am making a java... it shows the
scrollbar but do not show the scrolling tabs here is my code pls do help... java.awt.TextField.*;
public class try1 extends
JPanel implements ActionListener,ItemListener
how to add scrollbar to JFramehow to add
scrollbar to JFrame hello friends
i am making a java... it shows the
scrollbar but do not show the scrolling tabs here is my code pls do help... java.awt.TextField.*;
public class try1 extends
JPanel implements ActionListener,ItemListener
how to add scrollbar to JFramehow to add
scrollbar to JFrame hello friends
i am making a java... it shows the
scrollbar but do not show the scrolling tabs here is my code pls do help... java.awt.TextField.*;
public class try1 extends
JPanel implements ActionListener,ItemListener
how to add scrollbar to JFramehow to add
scrollbar to JFrame hello friends
i am making a java... it shows the
scrollbar but do not show the scrolling tabs here is my code pls do help... java.awt.TextField.*;
public class try1 extends
JPanel implements ActionListener,ItemListener
Draw bufferimage in jpanel using netbeansDraw bufferimage in
jpanel using netbeans please i need urgent help. i have form which contains some fields generated in netbeans. how can i draw bufferimage in
Jpanel that is inside the form.
thanks
div to scrollbar - Java Beginners vertical
scrollbar. for this i am using a css for that div in which i tried to add... who replied my answer. hi,
div and
scrollbar
html... "";
}
function
scrollBar(ownerID, ownerContentID, upID, dnID) {
this.ownerID
How to save JPanel as gif or jpeg fileHow to save
JPanel as gif or jpeg file i draw polygons , rectangles, lines on
jpanel using draw line method drawpolygon methods etc, now i want save the data of
jpanel which is drawn by me(lines,polygons) as a gif or jpeg file
dropdown to vert. scrollbar - Java Beginnersdropdown to vert. scrollbar can u please help me how to change a dropdown into
scrollbar when we resize th window in java script Hi friend,
drop down example
var messages = new Array(6);
messages[0
How set the height of Thumb in Vertical scrollbar..?How set the height of Thumb in Vertical
scrollbar..? I have created a Vertical
scrollbar.
I have removed up arrow and down arrow. also i have changed the skin of thumb by including
an image to it. I want the size of thumb same
Flex scrollbar controlFlex
ScrollBar Control:-
If the user handles data that are displayed but data is too much and not fit
in the display area then the user use
ScrollBar... the button depends on the current state of the
ScrollBar controls. If user
Example
How to save JPanel as gif or jpeg fileHow to save
JPanel as gif or jpeg file i draw polygons , rectangles, lines on
jpanel using draw line method drawpolygon methods etc, now i want save the data of
jpanel which is drawn by me(lines,polygons) as a gif or jpeg file
Fix Scrollbar position in a checkboxList after postbackFix
Scrollbar position in a checkboxList after postback Hi,
I have a CheckBoxList in which have lot of items and i set AutoPostBack="True".I am using
Scrollbar on this list.Now when I am checking any item then after postback