Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  
 

scrollbar in JPanel

Ads

 
 

Share on Google+Share on Google+

FaizalArafath
scrollbar in JPanel
1 Answer(s)      6 years and 10 months ago
Posted in : Swing AWT
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);
}
}
Ads
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

Ads









Related Tutorials/Questions & Answers:
scrollbar in JPanel
scrollbar 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
scrollbar
scrollbar  I add a scrollbar to my Frame and its not working
Advertisements
Java Scrollbar
Java Scrollbar   What is the difference between a Scrollbar and a ScrollPane
vertical scrollbar but without a horizontal scrollbar
vertical scrollbar but without a horizontal scrollbar  How do I make a frame with a vertical scrollbar but without a horizontal scrollbar
Horizontal Scrollbar
Horizontal Scrollbar  How can I implement a horizontal 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
Jpanel allignment
Jpanel 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
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
menu with scrollbar
menu with scrollbar  I want to use MenuBar with Scrollbar. I tried...); bar.add(setting); bar.add(help); JPanel panel=new JPanel(); JButton b1=new...*; public class menu extends JFrame{ private JPanel panel; public menu
frame with a vertical scrollbar but without a horizontal scrollbar.
frame with a vertical scrollbar but without a horizontal scrollbar.  How do I make a frame with a vertical scrollbar but without a horizontal scrollbar
Horizontal Scrollbar
Horizontal 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
How to add JTable in JPanel
How to add JTable in JPanel  How to add JTable in JPanel
java program:scrollbar
java 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 Properties
CSS 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 - Applet
scrollbar - 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
Scrollbar problem with struts <layout:collection>
Scrollbar problem with struts   How activate the vertical scrollbar in struts in mozilla firefox
how to add scrollbar to JFrame
how 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 JFrame
how 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 JFrame
how 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 JFrame
how 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 JFrame
how 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 netbeans
Draw 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
Draw a line in a JPanel with button click in Java
Draw a line in a JPanel with button click in Java  Draw a line in a JPanel with button click in Java
How to draw in jPanel? swing/graphics Java
How to draw in jPanel? swing/graphics Java  How to draw in jPanel? (swing/graphics Java
How to save JPanel as gif or jpeg file
How 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
Visibal Certical scrollbar with struts collection layout.
Visibal Certical scrollbar with struts collection layout.  how to Visibal Vertical scroll bar with struts collection layout
Display Multiple Images in jscrollpane using Java Jpanel
Display Multiple Images in jscrollpane using Java Jpanel  Browse and Display multiple images in vertical view of java jscrollpane using jpanel
dropdown to vert. scrollbar - Java Beginners
dropdown 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
Scrollbar click in safari browser not Collapsing opened dropdowns
Scrollbar click in safari browser not Collapsing opened dropdowns  When im clicking on the scrollbar in safari browser the click not collapsing the opened dropdowns....i mean if iam scrolling the scrollbars after content is being
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