Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Problem with scroll pane!!!

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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() {
}
}
 
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic