Featured post
java - Scrollable JPanel in JTable cell -
i want create custom cell in jtable. used custom renderer , returned jpanel object. works there 1 problem. while program running jpanel draws on using paintcomponent() method. on each "tick" (usually each 100ms) panel getting wider (im drawing kind of graph) , when becomes big rest hidden. i
d resize , create scrollbar. tried several ways of putting scrollpane none of them worked. basically, want thread view in java visualvm. ideas?
it hard work put scroll pane inside ordinary table cell, because 1 component used render cells in table. may remove jtable , put large set of components in ordinary jpanel grid layout?
if still want use jtable:
every scroll pane contain special jviewport control. jviewport control scrolling work, , jsrollpane layout scroll bars. because single viewport used cells, must store somewhere viewport scroll position , restore every painting cell (on getcellrenderer method). jsrollpane need heavy layout work slow solution.
may preferable solution: override jpane cell renderer paint method, , paint method must create sub-graphics (graphics.create() ) proper scroll offset. scroll offset data must stored somewhere (in table model example). when user click on cell, jtable begin cell editing, , install cell editor. must special cell editor, contains scroll pane itself. user scroll control (none special support required) , went finished cell editing must save scroll position model (in stopcellediting() function). cell rendered paint , in paint method content scroll offset model. user see scrolled cell. can put jscrollbar inside cell rendered, user can see scroll position (but need special support). can use jviewport pain work, in control hard understanding. not see troubles wit use scroll pant in cell editor, must work. in way huge work.
- Get link
- X
- Other Apps
Comments
Post a Comment