• Post Reply Bookmark Topic Watch Topic
  • New Topic

DefaultTableModel  RSS feed

 
dushantha Rathnayake
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How can I change the size and location of a jtable? this table using defaulttablemodel. Please help me.Actually I need to change the bounds of the table. But in defaulttablemodel I can't do that.please help me.

thank you.
 
Rob Camick
Ranch Hand
Posts: 2756
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The DefaultTableModel is used to store data, thats it. The JTable is responsible for displaying the data in the model.

Your question about changing the bounds of the table makes no sense to me. I suggest you read the JTable API where you will find a link to the Swing tutorial on "How to Use Tables" which contains a working example of using a table in a scrollpane. Use a layout manager to build your GUI and then you can use the setPreferredSize(...) method of the scrollpane to control its size.

For further help you should create a SSCCE (Short, Self Contained, Compilable and Executable, Example Program), that demonstrates the incorrect behaviour.

Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dushantha,
Welcome to the Ranch.

From your post it sounds like you are using a null layout which is a wrong thing to do. You would do better with layout managers.
http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html
 
dushantha Rathnayake
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thank you very very much.

I have another problem....
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have edited your post. http://faq.javaranch.com/java/UseOneThreadPerQuestion

Also, your new question should be posted in the JDBC forums
http://faq.javaranch.com/java/CarefullyChooseOneForum

Please do not provide mail addresses for private correspondence
http://faq.javaranch.com/java/UseTheForumNotEmail

Please do take out time to read these tips on getting the most out of the Ranch
http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
 
dushantha Rathnayake
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please Sorry for my fault,

Thank you very much for advising me. I'm a new member. Anyway I never do that fault. and again sorry.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!