samedi 25 octobre 2014

Swing UI: Table with variable height cells aligned on a vertical time scale


Vote count:

0




I realize this must be a beginner's problem, still I cannot find a satisfactory solution to my case, your experience sharing will be much appreciated.


I'm designing a calendar-like swing application which is conceptually a table. Each column has a header and a content which is a set of small compound panels, similar to the one framed in red below.


Calendar view


Each of the components in the panel must have the ability to display a tool tip and react individually to mouse clicks. Each compound panel is also aligned in the Y direction with the time scale on the left hand, based on the calendar event time.


My current solution is a JTable within a JScrollPane. The scroll pane row header is the time scale. The table has only one data row (because each compound panel has a variable height), which I build using a custom cell renderer in charge of assembling the compound panels, and laying them out with regard to the time scale. The renderer extends DefaultTableCellRenderer and returns a JPanel.


So far, so good, except that after it has been rendered the cell is no more a JPanel, but only a set of pixels, and I cannot maintain in the JTable the required tool tip and mouse handling features.


Could you help me moving this JTable + JScrollPane + DefaultTableCellRenderer design to another one which would support these missing features?



asked 1 min ago

mins

674






Swing UI: Table with variable height cells aligned on a vertical time scale

Aucun commentaire:

Enregistrer un commentaire