Changing the Arrow Button in ScrollBar in Scrollpane

Hello,

I changed the width of the scollbars on scrollpane using the following code

scrollpane.getVerticalScrollBars.setPreferedSize(new Dimension (40, 17)));

but the size of the arrow button is not changing.

can u please tell me how to change the size of arrow button of scroll bars in scroll pane.

[329 byte] By [sirfmemona] at [2007-11-27 4:46:28]
# 1

something like this perhaps

import javax.swing.*;

import java.awt.*;

import javax.swing.plaf.basic.*;;

class Testing

{

public void buildGUI()

{

UIManager.put("ScrollBar.width", new Integer(75));

JTextArea ta = new JTextArea(20,10);

for(int x = 0; x < 101; x++) ta.append(x+"\n");

JScrollPane sp = new JScrollPane (ta);

sp.getVerticalScrollBar().setUI(new BazookaScrollBarButtonsUI());

JFrame f = new JFrame();

f.getContentPane().add(sp);

f.pack();

f.setLocationRelativeTo(null);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.setVisible(true);

}

class BazookaScrollBarButtonsUI extends BasicScrollBarUI

{

protected JButton createIncreaseButton(int orientation)

{

return new BasicArrowButton(orientation,

UIManager.getColor("ScrollBar.thumb"),

UIManager.getColor("ScrollBar.thumbShadow"),

UIManager.getColor("ScrollBar.thumbDarkShadow"),

UIManager.getColor("ScrollBar.thumbHighlight")){

public Dimension getPreferredSize(){

return new Dimension(75,75);

}

};

}

protected JButton createDecreaseButton(int orientation)

{

return new BasicArrowButton(orientation,

UIManager.getColor("ScrollBar.thumb"),

UIManager.getColor("ScrollBar.thumbShadow"),

UIManager.getColor("ScrollBar.thumbDarkShadow"),

UIManager.getColor("ScrollBar.thumbHighlight")){

public Dimension getPreferredSize(){

return new Dimension(75,75);

}

};

}

}

public static void main(String[] args)

{

SwingUtilities.invokeLater(new Runnable(){

public void run(){

new Testing().buildGUI();

}

});

}

}

Michael_Dunna at 2007-7-12 9:59:01 > top of Java-index,Desktop,Core GUI APIs...