I have the following code (in Scala, but there's nothing specific to Scala here):
new JFrame {
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
this.setLocation(100, 100)
this.setSize(1000, 1000)
val mainPanel = new JPanel()
myFoos.foreach {
myFoo =>
val jpanel = fooPanel(myFoo)
mainPanel.add(jpanel)
}
val scrollPane = new JScrollPane(mainPanel)
this.add(scrollPane)
this.setVisible(true)
}
The result of running this is a blank JFrame
, but when I resize the window, the innermost JPanel
s render as expected. Also, if I initialize scrollPane
with one of the fooPanel
s directly, skipping mainPanel
, it renders without having to resize the outer JFrame
. What am I missing?