1

I want to make a table witch can contain small tables and supports resize. enter image description here

My solution use a JScrollpane wich contains the table and the gridbaglayout contains the row which is a JPanel and this row JPanel contains JLabels and ETable (flowlayout).

How i can solve the resize problem? When i resize the window the column align automtically with the window.

My code is here.

enter image description here

The columns are not aligned correctly in the big table.

flatronka
  • 1,061
  • 25
  • 51

2 Answers2

1
  1. I see there J(X)TreeTable or Outline with Custom Look and Feel (Renderer talking about Nimbus L&F, because isn't there correctly used background for Boolean value)

  2. put JComponents (from top) top the JPanel and there use GridBagLayout

  3. put JScrollPane with J(X)TreeTable or Outline put to the Center area

  4. please which type of TreeTable is there used ??? (for calculating PreferredSize of Columns)

EDIT

In this case replace the table with a black box. It's not relevant.

JFrame has implemented BorderLayout in the API, then

  • all JComponents from the TOP of the JFrame put to the separate JPanel, there you can use GridBagLayout, this JPanel put to the NORTH area e.g. JFrame.add(JPanel, BorderLayout.NORHT)

  • put black box to the CENTER area e.g. JFrame.add(black box, BorderLayout.CENTER)

mKorbel
  • 109,525
  • 20
  • 134
  • 319
  • 2
    Also consider opening the sub-table in another container. – trashgod Jul 10 '12 at 12:23
  • In this case replace the small table with a black box. It's not relevant. The big table is column alignment is the main problem when i resize the window. – flatronka Jul 10 '12 at 13:01
0

You can use this

Jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

using this JTable will display horizontal as well as vertical scroll bar when required.

mtk
  • 13,221
  • 16
  • 72
  • 112
jay gohel
  • 29
  • 5