• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with scroll pane!!!  RSS feed

 
Mahesh swami
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am facing a problem related to JScrollPane
I dont want the scrollpane to scroll on receiving the key events like UP key and down key.FOr this I override the method installKeyBoardAction() in BasicScrollBarUI() and gave an empty implementation. Now it works fine.But borders of the scrollbars are not displayed now.Can any one help me.I am pasting the sample code also.
import javax.swing.*;
import java.awt.*;
import javax.swing.plaf.basic.*;
public class Scroll extends JFrame{
public Scroll(){
setSize(300,400);
JPanel pan = new JPanel();
pan.setPreferredSize(new Dimension(500,500));
JScrollPane pane = new JScrollPane(pan);
MyUI ui = new MyUI();
MyUI ui1 = new MyUI();
pane.getHorizontalScrollBar().setUI(ui);
pane.getVerticalScrollBar().setUI(ui1);
getContentPane().add(pane);
show();
}
public static void main(String args[]){
new Scroll();
}
}
class MyUI extends BasicScrollBarUI{
protected void installKeyboardActions() {
}
}
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!