Good morning
I have a problem by centering the scrollbar with a large label.
I made a Scrollbar with a label witch has a large text in it. With an menu
I try to set the position off the bar at the center off the text. (see the
example).
It seems that setPosition sets the postion off the beginning off the bar
and not really centered off the text.
Has anybody an idea how I can set the scrollbar centered?
Regards
Marcello
/**
* TestApplication for Scrollbar-Position
*/
public class ScrolBarApplication extends AbstractApplication {
private ULCScrollPane scrollPane;
private static final long serialVersionUID = -361433820639246090L;
public void start() {
ULCFrame frame = new ULCFrame("Scrollbar Position");
frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE
);
frame.setMenuBar(getMenuBar());
scrollPane = new ULCScrollPane();
scrollPane.setViewPortView(new ULCLabel(
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
END"));
frame.setSize(new Dimension(400, 300));
frame.add(scrollPane);
frame.setVisible(true);
}
private ULCMenuBar getMenuBar() {
ULCMenuBar menuBar = new ULCMenuBar();
ULCMenu menu = new ULCMenu("Position");
menu.add(getPositionMenuItem());
menuBar.add(menu);
return menuBar;
}
private ULCMenuItem getPositionMenuItem() {
ULCMenuItem menuItem = new ULCMenuItem("Position 0.5");
menuItem.addActionListener(new IActionListener() {
public void actionPerformed(ActionEvent event) {
scrollPane
.getHorizontalScrollBar().setPosition(0.5);
}
});
return menuItem;
}
public static void main(String[] args) {
DevelopmentRunner.setApplicationClass(ScrolBarApplication.
class);
DevelopmentRunner.main(args);
}
}
DV Bern AG
___________________________________________________________________
mailto:[EMAIL PROTECTED]
http://www.dvbern.ch
Nussbaumstr. 21, Postfach 106, CH-3000 Bern 22
Telefon: 031 378 24 24
Telefax: 031 378 24 74