Groovy SwingBuilder : button to change the color of a panel
Why does this code fail ? I want to change the color of one panel in a series of several panels, dynamically constructed (total number of panels not known beforehand). For some reason, this code works when referencing the name of a particular panel (for example 'panel2'), but not when I refer to it dynamically ('panelID'). import groovy.swing.SwingBuilder import javax.swing.WindowConstants as WC import javax.swing.JOptionPane import javax.swing.BoxLayout as BXL swing = new SwingBuilder() frame = swing.frame(title:'test', defaultCloseOperation:WC.DISPOSE_ON_CLOSE) { panel(id:'mainPanel'){ def