Menu

#28 BoxLayout (VCENTER) doesnt work

open
nobody
rendering (5)
5
2009-09-02
2009-09-02
No

There is a bug related to the positioning of a panel inside a Container (BoxLayout).

example code:

Container con = new Container(new BoxLayout(BoxLayout.Y_AXIS));
con.setLayout(FireScreen.CENTER | FireScreen.VCENTER);

IconTextComponent txt = new IconTextComponent("Νεο Παιχνίδι", fireScreen.getWidth(), 0, image);
txt.setHightlightMode(IconTextComponent.HIGHLIGHT_MODE_FULL);
txt.setFont(f);
txt.setLayout(FireScreen.CENTER);
txt.setForegroundColor(0xffffff);
txt.setCommand(playCmd);
txt.setCommandListener(this);

IconTextComponent txt1 = new IconTextComponent("Βαθμολογία", fireScreen.getWidth(), 0, image);
txt1.setHightlightMode(IconTextComponent.HIGHLIGHT_MODE_FULL);
txt1.setFont(f);
txt1.setLayout(FireScreen.CENTER);
txt1.setForegroundColor(0xffffff);
txt1.setCommand(menuCmd);
txt1.setCommandListener(this);

Container gridCon = new Container(new BoxLayout(BoxLayout.Y_AXIS));
gridCon.add(txt);
gridCon.add(txt1);

int menuH = ((f.getHeight() +2 ) * gridCon.countComponents());

Panel p = new Panel(gridCon, Panel.VERTICAL_SCROLLBAR, false);
p.setPrefSize(fireScreen.getWidth(),menuH);

con.add(p);
con.setPrefSize(fireScreen.getWidth(),fireScreen.getHeight());
con.setLayout(FireScreen.VCENTER);
con.setCommandListener(this);
fireScreen.setCurrent(con);

Discussion


Log in to post a comment.

MongoDB Logo MongoDB