0

I basically want to fill my MainFrame with a SplitPanel that would take all space available in the MainFrame. I read that a way to do that is to add a BorderPanel to the MainFrame, and add the SplitPane to the center of the BorderPanel.

object SwingApp extends SimpleSwingApplication {

  def top = new MainFrame {

    peer.setUndecorated(true) //with this hack it works but I don't feel like it's the purpose of the function

    object splitPane extends SplitPane(Orientation.Vertical, new Button(), new Button())

    contents = new BorderPanel {
      import BorderPanel.Position._

      val center = splitPane
      layout(center)  = Center
    }
  }
}

My problem is that the BorderPanel seems to take as minimum size as possible (here 0) when I want it to in fact fill the whole Frame.

I found a solution by setting inside the MainFrame

peer.setUndecorate(true)

but It feels dirty and by reading the doc I have no idea why it works. Isn't there a nicer way ?

Atol
  • 569
  • 4
  • 12

1 Answers1

0

You can add border using BorderFactory and specify thickness (10 here).

panel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 10));
joey rohan
  • 3,505
  • 5
  • 33
  • 70