Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable (Size and Colour)

 
Jessie Tan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i place a JTable in Jframe... May i know how to set size for the JTable and as well as color??
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on if you are using a LayoutManager or not. If you are, the JTable's size is dependent on the size of the JFrame. If not, a simple setBounds(int xpos, int ypos, int width, int height) will suffice.
As far as the color, what on the JTable are you wanting the color changed?
 
Jessie Tan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i wanna change the color of the empty space.. whereby there's no col and row all that..
the grey color thingy..
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jessie Tan:
i wanna change the color of the empty space.. whereby there's no col and row all that..
the grey color thingy..

So you don't want the grid lines?
 
Jessie Tan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes..
i want the grid line...
wat i mean is, if my frame is big, and the table din take up all the space,
there will have a big space of grey color thingy... with nothing there...
and i wanna that too other color..
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jessie Tan:
yes..
i want the grid line...
wat i mean is, if my frame is big, and the table din take up all the space,
there will have a big space of grey color thingy... with nothing there...
and i wanna that too other color..


Ahhh, ok, I know what you are talking about now. But I have never been able to find a solution to this. I will keep researching it though.
 
Jessie Tan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind is ok...
anyway thanx alot..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic