You could subclass TreeCellRenderer and use setCellRenderer(javax.swing.tree.TreeCellRenderer) to draw each row with any arbitrary height, and setRowHeight(0) so the the current cell renderer is queried for each row's height.
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
You'll have to Google for details, but briefly, JTree uses a JLabel to draw each cell in the tree. But you can define your own renderer (normally a subclass of JLabel) to draw each cell however you like - eg use a bigger font for some cells, add graphics etc etc
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
This is what the API doc says:
public void setRowHeight(int rowHeight)
Sets the height of each cell, in pixels. If the specified value is less than or equal to zero the current cell renderer is queried for each row's height.
So, like I said in my first post, setRowHeight(0)
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
@JamesCherrill
don't sub_class no, nothing, never inside Renderer, as you correctly said Renderer returns by default JLabel (on Edit JTextField), then why overrode JLabel by using JLabel, for those .... is there Editor
mKorbel
Veteran Poster
1,141 posts since Feb 2011
Reputation Points: 480
Solved Threads: 224
@warlord902 is you refuse Sub_Classing and setSize(), then Renderer fill HEIGHT & WEIGHT by default
mKorbel
Veteran Poster
1,141 posts since Feb 2011
Reputation Points: 480
Solved Threads: 224