0

I want to place Components like JLabel, JTextField on specific location, my application view hierarchy looks like this :

| frame
| ---- tabbedPane
     | ---- Panel             (BorderLayout)
           | ---- JLabel
           | ---- JScrollPane [center]
                 | ---- JTable
           | ---- JLabel 

And I need to have something where the top of the header can have a component like that :

What I want

The problem is that the window can be resized.

Ideas I had, creating an other table on top with no header and manage to stick it to the JTable. A part from that I have not a single clue to where I can begin since LayoutManager is a pain for me.

0xmax
  • 503
  • 1
  • 6
  • 26
  • 1
    there are three ways to GlassPane, JViewport, or add (standard way) JComponent (GridBagLayout, SpringLayout, BoxLayout), a few times about that here – mKorbel Nov 25 '15 at 14:31
  • Thank you @mKorbel for your response. Can you be more specific on your answer on the GlassPane and the JViewport please ? I don't see where you want to go exactly. – 0xmax Nov 25 '15 at 14:53
  • 1
    See [*How to Use Root Panes: The Glass Pane*](https://docs.oracle.com/javase/tutorial/uiswing/components/rootpane.html), [*How to Use Scroll Panes: Providing Custom Decorations*](https://docs.oracle.com/javase/tutorial/uiswing/components/scrollpane.html#decorations) and [*A Visual Guide to Layout Managers*](https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html), respectively. – trashgod Nov 25 '15 at 15:53
  • Thanks @trashgod for the vocabulary and links – 0xmax Dec 06 '15 at 15:58

1 Answers1

0

You need to use a TableCellRenderer

http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#editrender

See the luca's answer in this post

How can I put a control in the JTableHeader of a JTable?

Community
  • 1
  • 1
reos
  • 8,766
  • 6
  • 28
  • 34