Nested components

12 views
Skip to first unread message

WarnerJan Veldhuis

unread,
Dec 6, 2010, 3:48:44 AM12/6/10
to javabu...@googlegroups.com
Hello,

How do I make nested panels with all of them using a MigLayout? Here's what the YAML looks like:

JPanel:
  - JPanel(name=NodePanel134):
     - JLabel(name=startdate, text=Start 1294952940)
     - JLabel(name=enddate, text=End 1294968840)
     - JLabel(name=title, text=Ideo Saluto)
     - MigLayout:
       constraints:
         startdate
         enddate
         title
  - JPanel(name=NodePanel135):
     - JLabel(name=startdate, text=Start 1297226755)
     - JLabel(name=enddate, text=End 1297234675)
     - JLabel(name=title, text=Pagus Letalis Aptent Os Molior Importunus Abbas)
     - MigLayout:
       constraints:
         startdate
         enddate
         title
  - MigLayout:
    constraints:
       NodePanel134
       NodePanel135


So basically there are two panels inside one panel. The message I get says "Caused by: Unable to find setter method: javax.swing.JPanel.setMigLayout". Is nesting of panels and layouts even supported?

Cheers,

WarnerJan



SurfMan

unread,
Dec 6, 2010, 4:40:13 AM12/6/10
to JavaBuilders
Don't you just hate it, that after struggling for days, and then
finally posting to the group, you come up with a working solution in
the next hour??

To answer my own question: yes, it just works. It all comes down to
getting the syntax of YAML right. The example below works like a
charm!

JPanel:
- JPanel(name=NodePanel134):
- JLabel(name=startdate134, text=Start 1294952940)
- JLabel(name=enddate134, text=End 1294968840)
- JLabel(name=title134, text=Ideo Saluto)
- MigLayout: |
startdate134
enddate134
title134
- JPanel(name=NodePanel135):
- JLabel(name=startdate135, text=Start 1297226755)
- JLabel(name=enddate135, text=End 1297234675)
- JLabel(name=title135, text=Pagus Letalis Aptent Os Molior
Importunus Abbas)
- MigLayout: |
startdate135
enddate135
title135
- JPanel(name=NodePanel145):
- JLabel(name=startdate145, text=Start 1298049802)
- JLabel(name=enddate145, text=End 1298058622)
- JLabel(name=title145, text=Dignissim)
- MigLayout: |
startdate145
enddate145
title145
- MigLayout: |
NodePanel134
NodePanel135
NodePanel145

Jacek Furmankiewicz

unread,
Dec 6, 2010, 9:33:40 AM12/6/10
to JavaBuilders
Glad we could help :-)
Reply all
Reply to author
Forward
0 new messages