Skip to main content

Nested Layout Problem

1 reply [Last post]
danko
Offline
Joined: 2008-07-18
Points: 0

Hello,
if I put a container with FlowLayout into a BoxLayout I get on the left side of the components are different intervals between edge of boarder and display edge. http://666kb.com/i/b0m0l4udl1e89zglp.png

<br />
import javax.microedition.midlet.*;</p>
<p>import com.sun.lwuit.Command;<br />
import com.sun.lwuit.Container;<br />
import com.sun.lwuit.Display;<br />
import com.sun.lwuit.Form;<br />
import com.sun.lwuit.TextField;<br />
import com.sun.lwuit.Button;<br />
import com.sun.lwuit.events.ActionEvent;<br />
import com.sun.lwuit.events.ActionListener;<br />
import com.sun.lwuit.layouts.BoxLayout;<br />
import com.sun.lwuit.layouts.FlowLayout;<br />
import com.sun.lwuit.plaf.Border;</p>
<p>public class LwuitTestMidlet extends MIDlet implements ActionListener<br />
{<br />
    public void startApp()<br />
    {<br />
        Display.init(this);</p>
<p>        Form f = new Form("LWUIT TestMidlet");<br />
        f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));<br />
        TextField tf = new TextField("tf");<br />
        tf.getStyle().setBorder(Border.createEtchedLowered());<br />
        f.addComponent(tf);<br />
        Container line = new Container(new FlowLayout());<br />
        TextField lineTf = new TextField("lineTf");<br />
        lineTf.getStyle().setBorder(Border.createEtchedLowered());<br />
        line.addComponent(lineTf);<br />
        f.addComponent(line);<br />
        f.addComponent(new Button("button"));<br />
        Command exitCommand = new Command("exit");<br />
        f.addCommand(exitCommand);<br />
        f.setCommandListener(this);<br />
        f.show();<br />
    }</p>
<p>    public void pauseApp()<br />
    {<br />
    }</p>
<p>    public void destroyApp(boolean unconditional)<br />
    {<br />
    }</p>
<p>    public void actionPerformed(ActionEvent ae)<br />
    {<br />
        if (ae.getCommand().getCommandName().equals("exit"))<br />
        {<br />
            notifyDestroyed();<br />
        }<br />
    }<br />
}<br />

Adding

<br />
        line.getStyle().setBorder(null);<br />
        line.getStyle().setPadding(0,0,0,0);<br />
        line.getStyle().setMargin(0,0,0,0);<br />

has no effect.

Thanks a lot,
danko

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chen

Hi,
It looks like a bug in FlowLayout.

Thanks,
Chen

lwuit-users@mobileandembedded.org wrote:
> Hello,
> if I put a container with FlowLayout into a BoxLayout I get on the left side of the components are different intervals between edge of boarder and display edge. http://666kb.com/i/b0m0l4udl1e89zglp.png
>
> [code]
> import javax.microedition.midlet.*;
>
> import com.sun.lwuit.Command;
> import com.sun.lwuit.Container;
> import com.sun.lwuit.Display;
> import com.sun.lwuit.Form;
> import com.sun.lwuit.TextField;
> import com.sun.lwuit.Button;
> import com.sun.lwuit.events.ActionEvent;
> import com.sun.lwuit.events.ActionListener;
> import com.sun.lwuit.layouts.BoxLayout;
> import com.sun.lwuit.layouts.FlowLayout;
> import com.sun.lwuit.plaf.Border;
>
> public class LwuitTestMidlet extends MIDlet implements ActionListener
> {
> public void startApp()
> {
> Display.init(this);
>
> Form f = new Form("LWUIT TestMidlet");
> f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
> TextField tf = new TextField("tf");
> tf.getStyle().setBorder(Border.createEtchedLowered());
> f.addComponent(tf);
> Container line = new Container(new FlowLayout());
> TextField lineTf = new TextField("lineTf");
> lineTf.getStyle().setBorder(Border.createEtchedLowered());
> line.addComponent(lineTf);
> f.addComponent(line);
> f.addComponent(new Button("button"));
> Command exitCommand = new Command("exit");
> f.addCommand(exitCommand);
> f.setCommandListener(this);
> f.show();
> }
>
> public void pauseApp()
> {
> }
>
> public void destroyApp(boolean unconditional)
> {
> }
>
> public void actionPerformed(ActionEvent ae)
> {
> if (ae.getCommand().getCommandName().equals("exit"))
> {
> notifyDestroyed();
> }
> }
> }
> [/code]
>
> Adding
> [code]
> line.getStyle().setBorder(null);
> line.getStyle().setPadding(0,0,0,0);
> line.getStyle().setMargin(0,0,0,0);
> [/code]
> has no effect.
>
> Thanks a lot,
> danko
> [Message sent by forum member 'danko' (danko)]
>
> http://forums.java.net/jive/thread.jspa?messageID=288653
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net