• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

mig layout, jscrollpane, and min size

 
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is my panel, which is on the bottom half of another panel (also mig layout).
The trouble is this panel always end up with the panel title and the table titles are visible but not the actual data.
i would like not to put the table in a scroll pane, but that appears to be how swing is designed to display tables.
I made a panelClass that overrode getSize and getPreferedSize to make a min height, but they were being ignored.

So my question is: how do i either make the panel big enough using the scroll pane, or make the table display properly not using the scroll pane?



the main panel is defined as:

 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I usually use something like.


or make the table display properly not using the scroll pane


Now that's strange. How do you suppose to display the data if the table contains more rows than the visible area?
Anyway, you can try the following:
1) Define a panel with BorderLayout
2) Add the table to the CENTER
3) Add the table header to NORTH

 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i know the table will never have more than 4/5 rows in it, so am quiet confident about space.

never thought of sticking border layout in the middle, as i was promised mig was the saviour of all my problems


 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well you can still do it with MigLayout only.



 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when i do that the left and top table borders get lost.
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code you have posted cannot be compiled. Can you post a http://sscce.org/ example?
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just trying to get this done
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Maneesh Godbole wrote:The code you have posted cannot be compiled. Can you post a http://sscce.org/ example?



nope sorry, i tried to make a standalone program, but failed.
which is bad news, i will take all the layout stuff out of my panel and start again clean
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You give up too easily
The problem is the layout.
Just create a dummy panel with the layout constraints and post it.
Well to confess I already did it. So don't bother.

But what you can do is post a screenshot indicating the top and left borders which you mentioned.
PS. I presume you know how to explicitly set borders when required,
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i know how to set borders, just not how to post screenshots to java ranch.

And i decided you were right the scroll pane is the way i should be going so i have concentrated my efforts on that.
And when using images big enough in my demo program i mananged to reproduce the tiny table.



 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I can try out that code as soon as I get access to

private static final String MY_PICTURES = "C:\\Documents and Settings\\wendy.gibbons\\My Documents\\My Pictures\\";



In the meanwhile you can try this out.


Its the same code you posted yesterday, which I tweaked to take out the unknown stuff.

When you are posting a reply, there is an attachment tab at the bottom of the text area which you can use to upload the screenshots
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I figured you would have your own huge pictures you could replace it with , as i needed everything on the screen to need lots of space and images where easiest
And call me a purest but i wanted to know where the outlines that are meant to be there went when I made my own they appeared but...
my_table_problem.JPG
[Thumbnail for my_table_problem.JPG]
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nah! I am too lazy to switch to my image folders

Ok. At a risk of sounding daft, I need to clarify things.
1) Are we still talking about the vanishing top and left areas? In your later post you agreed the scroll panel was a good idea. Also, your latest code uses the scroll panel.
2) I looked at the screen shot. I can't figure out what am I supposed to observe in the red oval. Doh!

I am attaching my screen shot. It is from the code snippet I posted.
The only change I did was

migLayoutTable.JPG
[Thumbnail for migLayoutTable.JPG]
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry talking to me too long confuses people for the 1st 3-4 years then they get the hang of it

Sorry The screen print was showing the old missing borders.

So this screen print shows the tiny usless scroll pane it gives me, an actually usefull picture
usless-scroll-pane.jpg
[Thumbnail for usless-scroll-pane.jpg]
the useless scrollpane
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since the data is not clearly visible, the scrollbar is showing up.
The solution would be to resize the other panels to provide sufficient space for the table.
Since you have not explicitly set any scroll bar policy, they would disappear when the data is properly visible.

Also, please check your private message.
 
An elephant? An actual elephant. Into the apartment. How is the floor still here. Hold this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic