java - Center JTable's cells to the middle of the JTable -
how center jtable
cells middle of jtable
?
i using table paint boxes in table, when resized, cells remain left-top aligned. when table fits cells nicely, not problem. when resize window (and table it), wrong:
my question is, possible make cells appear in middle of table? suppose use glues on sides (this borderlayout
), rather take approach.
since tablecellrenderer
painting colored blocks, put table in flowlayout
, override getpreferredscrollableviewportsize()
.
private static final int wide = 10; private static final int high = 20; private static final int size = 50; ... @override public dimension getpreferredscrollableviewportsize() { return new dimension(wide * size, high * size); }
Comments
Post a Comment