Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable shown in JScrollPane issues

 
Greg Reeder
Ranch Hand
Posts: 99
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have the following issue. I have a JTable inside a JScrollPane. It works great for the height of the table, but for the width, I am having the issue that when the JFrame is resized, the columns are also made smaller, sometimes to the point where you cannot make them out anymore. When I use the code:



I can get the width scrollbar to show once the jframe is made too small.

I do set the minimum width:



it is only as if it means nothing when it is resized. My goal is that all columns remain the same width and that the column with the index 2 gets the remainder width, and when they hit their minimum width, the JScrollPane shows the with scrollbar. Any help would be awesome!!

Greg
 
Greg Reeder
Ranch Hand
Posts: 99
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, wrong code:

 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Reeder wrote:sorry, wrong code

To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.
 
Greg Reeder
Ranch Hand
Posts: 99
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sometimes that is just extra overhead that takes away from the real issue at hand. Furthermore to post the "rule book" just wastes time. If you dont want to help me, feel free to ignore this thread.
 
Rob Spoor
Sheriff
Pie
Posts: 20550
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we help if we can't see the problem itself? We don't have access to your full code, nor do we want it. That's what the SSCCE is for. It's basically your code with all the stuff not related to this problem removed. That means no extra buttons, no menus, etc. Just the core code that displays the problem. Without that we can only guess if our solutions would work.
 
Greg Reeder
Ranch Hand
Posts: 99
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that is exactly what is there! It just cannot be started becuase there is no JFrame etc in the code, otherwise, i could copy and paste it into an ide with the proper import fields, and let it run! I explained the problem and put the code that is giving me issues! What is the issue!!!
 
Rob Camick
Ranch Hand
Posts: 2600
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It just cannot be started becuase there is no JFrame etc in the code


Exactly!

If you want help then make it easy for us to help you. We don't have time to write code that creates a frame and adds the table and scrollpane to the frame for every person that asks a question. Also, the code we write may be different that the code you write, which could affect the outcome of the problem.

 
Paul Clapham
Sheriff
Posts: 21133
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Reeder wrote:If you dont want to help me, feel free to ignore this thread.


Greg, there aren't a lot of people who give good Swing advice. So far two people who do give good Swing advice have asked you to improve your question. However if you don't want them to help you, feel free to ignore their requests.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic