Search code examples
gwt

GWT ScrollPanel, bottom scrollbar is not scrollable


If I create a ScrollPanel like this:

public class BoardPanel extends ScrollPanel {

    public BoardPanel(Game game) {

        AbsolutePanel abs = new AbsolutePanel();

        setHeight("100px");
        setWidth("100px");
        setAlwaysShowScrollBars(true);
        abs.add(new Image(game.getMap().getImageUrl()));
        add(abs);  
    }
}

I got my picture with a scrollbar on the right, which is scrollable. The bottom one is only shown, if I use setAlwaysShowScrollBars(true); My question is, how can I get the bottom one scrollable? It is just grey.


Solution

  • public class BoardPanel extends ScrollPanel {
    AbsolutePanel abs = new AbsolutePanel();
    
    private GameCtrl gameCtrl;
    
    public BoardPanel(Game game) {
        setSize("100px", "100px");
        abs.add(new Image(game.getMap().getImageUrl()));
        abs.setPixelSize(768,576);
        add(abs);
        for (Player player : game.getPlayerList()) {
            drawRobot(player);
        }
    }
    

    I have fixed it, your hint was right, because he thinks that the whole image is displayed. If I set the size of the AbsolutePanel, the bottom scrollbar appears and it looks like it should.