This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTable shown in JScrollPane issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable shown in JScrollPane issues" Watch "JTable shown in JScrollPane issues" New topic
Author

JTable shown in JScrollPane issues

Greg Reeder
Ranch Hand

Joined: Jun 14, 2011
Posts: 99

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

Joined: Jun 14, 2011
Posts: 99

sorry, wrong code:

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

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

Joined: Jun 14, 2011
Posts: 99

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

Joined: Oct 27, 2005
Posts: 19649
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Greg Reeder
Ranch Hand

Joined: Jun 14, 2011
Posts: 99

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

Joined: Jun 13, 2009
Posts: 2152
    
    7
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable shown in JScrollPane issues
 
Similar Threads
JTable
Displaying ArrayList data in a JTable
JTable
JTable
JTable