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:

fine lookingwrong

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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -