• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scrollbar not appearing  RSS feed

 
Meghna ks
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI people
Have a problem here. I have a Scrollpane and a panel inside it . I keep adding some basic swing components to the panel . I'm unable to scroll down to see the components since the scrollbar is not appearing.Could someone help me with this ?!!
Thanks
Meghna
 
Noah Carroll
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you post the code?
 
Meghna ks
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Noah & Cindy
I'm not sure which part of the code you're looking for ?!! I'm posting the GUI part in here. Please let me know if anything apart from the below code is needed. Basically, I'm using a mouseclicked event for the textfield to bring up the calendar.
I'm posting the code of the above written.
Thanks in advance
Meghna
//===============================================================
setLayout(new BorderLayout(0,0));
//setSize(290,115);
setSize(0,0);
JScrollPane1.setAutoscrolls(true);
JScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
JScrollPane1.setOpaque(true);
add(BorderLayout.CENTER,JScrollPane1);
JPanel1.setAutoscrolls(true);
JPanel1.setLayout(null);
JScrollPane1.getViewport().add(JPanel1);
JPanel1.setBounds(0,0,1,1);
//JScrollPane1.setBounds(0,0,430,200);
//JPanel1.setLayout(new GridLayout(0,2,5,5));
//JPanel1.setBounds(0,0,427,197);
//}}
//===============================================================
cclass SymMouse extends java.awt.event.MouseAdapter
{
public void mouseClicked(java.awt.event.MouseEvent event)
{
Object object = event.getSource();
if (object == cal)
cal_mouseClicked(event);
else if(object == mask1)
mask1_mouseClicked(event);
}
}
//===============================================================void cal_mouseClicked(java.awt.event.MouseEvent event)
{
// to do: code goes here.
String str = cal.getDate();
mask1.setText(str);
cal.setVisible(false);
}
//===============================================================void mask1_mouseClicked(java.awt.event.MouseEvent event)
{
if(mask1.isEditable() == true)
{
cal.setVisible(true);
cal.setSize(200, 150);
cal.setLocation(this.getX(), this.getY());
cal.repaint();
cal.validate();
}
else
return;
}
}//End Class
//===============================================================
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!