pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger L. Whitcomb" <Roger.Whitc...@actian.com>
Subject RE: ScrollPane does not work in the java code
Date Fri, 16 Dec 2011 19:18:52 GMT
Hello,
	First of all, thanks for trying out Pivot!
	To (hopefully) answer your question:
1) In order to use a ScrollPane, you don't need a separate ScrollBar -- it will show or hide
scrollbars as needed.
2) The right way to add a "scrollable" element to a ScrollPane is to set the "view" property
of ScrollPane.
3) There can only be one "view" element of a ScrollPane, so you would need to put all your
Label elements into a container of some kind, such as a BoxPane.
4) Setting "preferredSize" should be all that's needed to get the component sized correctly
(without setting "size" directly).

So, the final code would look something like this (haven't tested this, so it might need some
tweaking):
Window window = new Window();
ScrollPane myScroll = new ScrollPane(ScrollBarPolicy.AUTO,ScrollBarPolicy.AUTO);
myScroll.setPreferredSize(1000, 1000);
BoxPane bp = new BoxPane(Orientation.VERTICAL);
for (int i=0; i < 20; i++) {
    Label lbl = new Label();
    lbl.setText("Label: "+i);
    lbl.setPreferredSize(100, 100);
    bp.add(lbl);
}
myScroll.setView(bp);
And the rest should be okay as you have it.

Roger Whitcomb | Architect, Engineering | Roger.Whitcomb@actian.com| Actian Corp. | 500
Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA  | +1 650-587-5596 | fax:
+1 650-587-5550


-----Original Message-----
From: Yura [mailto:YuraBadoo@yahoo.com] 
Sent: Wednesday, December 14, 2011 2:29 PM
To: user@pivot.apache.org
Subject: ScrollPane does not work in the java code

Hello,

I try to use Apache Pivot by means of simple java (not high bmpeix or
whatever like bxml - very high solution).

So, when I try to construct a very simple hierarhy of conainers it simply
did not work - empty window (or overlapped labels). I tried diff variants -
all the same. Is there any human way to use Apache Pivot without  high bxml? 
The simple as a door java code of startup() here below:

        window = new Window();
        ScrollBar scrlBar = new ScrollBar();
        scrlBar.setSize(2000, 15);
        scrlBar.setPreferredSize(2000, 15);
        
        ScrollPane myScroll = new
ScrollPane(ScrollBarPolicy.AUTO,ScrollBarPolicy.AUTO);
        myScroll.setSize(1000,1000);
        myScroll.setPreferredSize(1000, 1000);
        
        myScroll.add(scrlBar);
        
        for (int i = 0; i < 20; i++) {
        	Label lbl= new Label();
        	lbl.setText("Label: "+i);
        	lbl.setSize(100, 100);
        	myScroll.add(lbl);
		}
        
        
        TabPane myTabPane = new TabPane();
        myTabPane.setSize(1000,1000);
        myTabPane.setPreferredSize(1000, 1000);
        
        
        myTabPane.add(myScroll);
        window.setContent(new Border(myTabPane));
        //window.setContent(new Border(myCalendarPane.getBgTablePane()));
        //window.setContent(new Calendar());
        window.setTitle("Hello World!");
        window.setMaximized(true);

=>No scrollbars or when they are show up they just does not respond.
Is there any pecularities of using ScrollPane in java code not in high ...?
What classes it can normally include? Which classes (containers) may
normally include it? ETC

Thank you!


--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/ScrollPane-does-not-work-in-the-java-code-tp3586952p3586952.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Mime
View raw message