Forum Stats

  • 3,839,357 Users
  • 2,262,486 Discussions
  • 7,900,949 Comments

Discussions

ScrollPane positioned incorrectly

user13606303
user13606303 Member Posts: 10
edited May 29, 2011 1:04PM in JavaFX 2.0 and Later
Incorrectly positioned or missing something?
note ....

public class est extends Application {
  

    @Override
    public void start(Stage stage) {
   stage.setTitle("application");
    Group group=new Group();
    Scene scene=new Scene(group, 400, 400, Color.BLANCHEDALMOND);
    stage.setScene(scene);
    stage.setVisible(true);
    /**/
    TilePane tile = new TilePane();
    
    tile.setHgap(8);
    tile.setVgap(8);
    tile.setPrefColumns(4);
    group.getChildren().add(tile);
    
    /*ScrollPane*/
    ScrollPane scp=new ScrollPane();
    tile.getChildren().add(scp);
    
    scp.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
    
    
    for (int i = 0; i < 40; i++) {
        tile.getChildren().add(new Rectangle(110, 110, Color.ALICEBLUE));
 
    }
         }
    }

Answers

  • jojorabbit
    jojorabbit Member Posts: 59
    edited May 28, 2011 9:27PM
    Hi,
    That i cuz u added scp to tile not to root it displays in like 1st i tile i guess.
    I think u need to set pref size on scrollPane.
    Try to experimetn wih diff numbers in method :
    scrollPane.setPrefSize(100,100);

    and u did not set node that is in ScrollPane there is method : scrollPane.setNode(Node node)

    in rootGroup add scroolPane, and scp.setNode(tile)
    it should work.

    This is example from my project:
    scrollPane.setPrefSize(4 * 128 + 4 * 20 + 5 * 10 + 10, 3 * 128 + 3 * 20 + 3 * 10);
    scrollPane.setNode(grid);
    Hope i helped.

    Edited by: jojorabbit on May 29, 2011 3:26 AM
  • darrylburke
    darrylburke Member Posts: 18,007
    jojorabbit wrote:
    Hi,
    That i cuz u added scp to tile not to root it displays in like 1st i tile i guess.
    I think u need to set pref size on scrollPane.
    Please read this.

    db
  • user13606303
    user13606303 Member Posts: 10
    edited May 29, 2011 2:32AM
    thanks for the help above
    ...

    Darryl Burke
    Also thank you for the tip .... true that English is not my native language
    I understand most speak little English

    the following question ...
    ... still the error when you open the Desktop or webstart

    if I may ...
    personally would like to show what happens

    click to view in skip
    note that the webstart not read the scrollpane ...



    webstat

    thanks for help

    Edited by: user13606303 on 28/05/2011 23:31
  • hy, ok....


    also a small error
      Scene scene = new Scene (group, 650, 400, Color.BLANCHEDALMOND);
    thanks ... resolved
  • jojorabbit
    jojorabbit Member Posts: 59
    Hi,
    Darryl Burke quoted my text because i have written "cuz" and "u" words. I did not know that i can`t use them.
    Thanks for tip.
    user13606303 do not worry your English is pretty good. ;)

    I am glad that i helped a bit.
  • jojo ... I understand what you mean ...
    more on this my question your answer was correct ... helped me a lot ...

    changed the "scene" just to get a Scene "hight" propocional the "ScrollPane" ...
    you indicated

    thanks again
    =]
This discussion has been closed.