CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: JFileChooser

  1. #1
    Join Date
    Jan 2006
    Location
    Baltimore, Maryland, USA
    Posts
    104

    JFileChooser

    How can one adjust and alter the size of the open dialog shown when using the JFIleChooser object?

    I tired to put the FileChooser in a seperate panel with a specific size, but that didn't work.
    -= the best is yet to come =-

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: JFileChooser

    Your best bet is probably to override the JFileChooser.createDialog method, calling the superclass method, then setting the size you want on the dialog it returns:
    Code:
    protected JDialog createDialog(Component parent) {
      JDialog dlg = super.createDialog(parent);
      dlg.setSize(new Dimension (WIDTH, HEIGHT));
      return dlg;
    }
    It is better to have an approximate answer to the right question than an exact answer to the wrong one...
    J. Tukey
    Last edited by dlorde; May 26th, 2010 at 08:34 AM.
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured