开发者

How to ... with MigLayout

I am trying to create a layout that will looking like:

+---+--------+---+
|   |        |   |
|   |        |   |
+---+        +---+
|   |        |   |
|   |        |   |
+---+--------+---+

Central cell should be twice as wide as other. I am trying achieve this with such code:

    val panel = new JPanel(new MigLayout("debug", "grow","grow" ))
    panel.add(new JPanel)
    panel.add(new JPanel, "span 2 2")
    panel.add(new JPanel, "wrap")
    panel.add(new JPanel)
    panel.add(new JPanel)

开发者_如何学JAVABut as result all my cells have same width:

+----+----+----+
|    |    |    |
|    |    |    |
+----+    +----+
|    |    |    |
|    |    |    |
+----+----+----+

What I do wrong? I am using Scala but I don't think that problem is herein.

UPDATE Maybe someone can explain why this didn't work. Even if i try reproduce example from QuickStart guide it didn't work :

How to ... with MigLayout

My code:

    val panel = new JPanel(new MigLayout("debug", "grow","grow" ))
    wrapTab.add(new JPanel)
    wrapTab.add(new JPanel, "span 2 2")
    wrapTab.add(new JPanel, "wrap")
    wrapTab.add(new JPanel)
    wrapTab.add(new JPanel, "wrap")
    wrapTab.add(new JPanel)
    wrapTab.add(new JPanel)

And as result all cols has equal size.


val panel = new JPanel(new MigLayout("debug", 
              "[grow 25][grow 50][grow 25]","grow" ))
panel.add(new JPanel)
panel.add(new JPanel, "spany 2")
panel.add(new JPanel, "wrap")
panel.add(new JPanel)
panel.add(new JPanel)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜