0

I get in trouble with the fact of after clicking on a button : I would like my table is set at bottom of my button but it's not that

I've managed to get it without after clicking a button but without, I've tested many things and nothing.

Here is the code :

contents = new BoxPanel(Orientation.Horizontal) {
      contents += Button("Top 10 most commun runways latitude") {
        val headers = Array.tabulate(10) {"Col-" + _}.toSeq
        val rowData = Array.tabulate[Any](10, 10) {"" + _ + ":" + _}
        contents += new ScrollPane(new Table(rowData, headers))
      }
      contents += Button("10 highest and lowest number of countries") {
        }

      contents += Button("Type of runways per country") {}
  }

What I get What I get

What I would like What I would like

Kev74
  • 103
  • 7
  • 2
    The default layout manager of the JFrame should do the job. Add a panel with your buttons to the BorderLayout.PAGE_START. Add the scroll pane with your table to the BorderLayout.CENTER. Read the Swing tutorial on [Layout Managers](https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html) for more information and working examples of using each layout manager. – camickr Jan 03 '23 at 15:12
  • Thanks, I've done it but how I remove a component ? – Kev74 Jan 03 '23 at 16:52
  • Why do you need to remove it? If you change the data of the table you can just use the `setModel(...)` method of the table. Or you can replace the component in the scroll pane by using the `setViewportView(...)` method of the scroll pane. If you truly need to remove it then read the Container API for the remove(...) method. – camickr Jan 03 '23 at 17:11

0 Answers0