PDA

View Full Version : Button Icon - wrong position



egotec
29 Jul 2010, 2:49 AM
Hello.

I have two ContentPanels in an AccordionLayout.
When I create a Button (width 100%) with an image in the first panel, the image is correctly on the left:
http://download.egotec.com/files/tmp/correct.png

But, when I create a Button (width 100%) with an image in the SECOND panel, the image is NOT correctly on the left, but directly before the button-text.
http://download.egotec.com/files/tmp/wrong.png

That's the whole source code:


ContentPanel cntntpnlMeineKalender = new ContentPanel();
cntntpnlMeineKalender.setHeading("Meine Kalender");
cntntpnlMeineKalender.setLayout(new AccordionLayout());

cntntpnlStandardkalender = new ContentPanel();
cntntpnlStandardkalender.setHeading("Standardkalender");
cntntpnlStandardkalender.setCollapsible(true);

cntntpnlWeitereUrlaubskalender = new ContentPanel();
cntntpnlWeitereUrlaubskalender.setHeading("Weitere Urlaubskalender");
cntntpnlWeitereUrlaubskalender.setCollapsible(true);

btnFirmenkalender = new Button("Firmenkalender");
btnFirmenkalender.setWidth("100%");
btnFirmenkalender.setIcon(IconHelper.create("/img/calendar.png"));

cntntpnlStandardkalender.add(btnFirmenkalender);

cntntpnlMeineKalender.add(cntntpnlStandardkalender);
cntntpnlMeineKalender.add(cntntpnlWeitereUrlaubskalender);

initComponent(cntntpnlMeineKalender);
cntntpnlMeineKalender.setSize("100%", "400px");

Can you please help me? Maybe a workaround..?

Thanks,
Jonas Gehring

micgala
2 Aug 2010, 12:51 AM
Try not using 100% in the width, but use the layout system instead...

egotec
2 Aug 2010, 11:05 PM
thanks.

FillLayout - vertical, whould work, but then the buttons' height is too big...

I have to use RowLayout, and the buttons need fixed width...

micgala
2 Aug 2010, 11:34 PM
Try using 1 as the width when adding the button to the RowLayout (inside RowLayoutData).
Probably that will work, the button will take the whole row width.

Regards,
Michel.