Problem getting GUI to size properly

Posted on 2003-03-04
Medium Priority
Last Modified: 2013-11-23

    I have created a JPanel to which I add a JTable and alot of JButtons.  I then instantiate this JPanel inside my main method and then add it to my JFrame.

Here a snippet of my "main method":

 public static void main(String s[]) {
    JFrame frame = new JFrame("Kirk");
    //pass handle of JFrame
    DataFileTable panel = new DataFileTable(frame);
    frame.addWindowListener(new WindowCloser());

The problem is that when I execute my program the GUI comes out "squeeze" looking. Instead of displaying seven buttons it display three buttons.  The only way for me to get the full display is to stretch out the frame.

I think the only way to fix my problem is to set a size to my panel since my frame set its size from the panel that is added.

If anyone knows a better solution please let me know.


Question by:nutless
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 15

Accepted Solution

VGR earned 40 total points
ID: 8068142
you may enumerate controls owned by the panel and resize accordingly by adding their width properties...
LVL 15

Expert Comment

ID: 8104919
if my answer did not suit you, I prefer you refuse it rather than giving me a grade "C"
If my stupid suggestion led you to the solution, it should be B or A

Please re-read the guidelines as for what are grades "A", "B" and "C"

community support : anyone ?

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question