I think the way to get these working is to create a new class extending a panel & use methods inherited from Component such as doTick(), etc to do the bit where you animate/render you compoents using the ScrollPane.
Now to try…
Don’t know what I was on about above :// XD
I’ve been playing around with those scrollbars & have come up with the following so far:
public void createWin3() throws Exception
{
//F3 GUI
w3 = new net.puppygames.gui.Window("Scroll window");
w3.setLocation(70, 60);
w3.setSize(260, 360);
w3.setDraggable(true);
w3.open();
Panel scrollPanel = new Panel();
scrollPanel.setSize(250,230);
Panel textAreaPanel = new Panel();
TextArea text = new TextArea
("Here is some text which will scroll as the TextArea goes on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on & on.");
text.setSize(220, 150);
text.setFormat(TextLayout.WORD_WRAP);
textAreaPanel.pack();
textAreaPanel.addChild(text);
ScrollPane bars = new ScrollPane(ScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS, ScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
bars.setSize(220, 200); //x,y length of bars
bars.setLocation(10, 60);
bars.setView(scrollPanel);
scrollPanel.addChild(textAreaPanel);
w3.addChild(bars);
scrollPanel.pack();
bars.setViewLocation(10, scrollPanel.getHeight()-bars.getHeight());
CommandButton exitButton = new CommandButton("Exit");
exitButton.setSize(70, 20);
exitButton.setLocation(90, 10);
w3.addChild(exitButton);
exitButton.addCommandButtonListener(new CommandButtonListener() {
public boolean selected(CommandButton cb) {
try
{
w3.setVisible(false);
enablePlayMode();
}
catch (Exception e){}
return false;
}
});
w3.pack();
w3.centre();
w3.setVisible(false);
}
At the moment this stops the text scrolling off the window to the left and bottom, I can't quite see to contain it all.
I've put the Scrollbars on a panel and then put another panel on top for the scrollbars to move which contains the TextArea.