• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scrolling Problem

 
nabi bux
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
High e=very Body
I have the following code problem occure
The scrolling done only the size of monitor
means contrl that exeed the size of moniotor not
visible
please tell me
thank
suppose iHave program having 1000 text boxes how can i
visualize these all when i am trying to get them
only 14 are but no more
if i use build in scrooling it is not working
user defined layout which i used
please help me how can i use it
Thankd i have the foloowing code




import java.awt.*;
import javax.swing.*;
import java.net.*;
import java.awt.event.*;


class SDemo2
{
static JScrollBar sv;
static JPanel p;
static JViewport jvp;


public static void main(String a[])




{

JScrollPane j ;
jvp=new JViewport();
sv =new JScrollBar(JScrollBar.VERTICAL,0,0,0,600);
p=new JPanel();

p.setLayout(null);

JFrame f=new JFrame();
JButton b[]=new JButton[100];
//JTextField b[]=new JTextField[90];
int y=10;

for(int i=0; i<15; i++)
{
b[i]=new JButton("High");

b[i].setBounds(10,y,100,50);
y=y+40;

p.add(b[i]);
}



jvp.add(p);
f.getContentPane().add(jvp,BorderLayout.CENTER);
f.getContentPane().add(sv,BorderLayout.EAST);


f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.setVisible(true);
f.setSize(500,500);


sv.addAdjustmentListener(new AdjustmentListener()
{
public void adjustmentValueChanged( AdjustmentEvent e)
{

JScrollBar h=(JScrollBar)e.getSource();


Point pt=jvp.getViewPosition();
pt.y=e.getValue();

jvp.setViewPosition(pt);


}});



}




}




 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!