Results 1 to 4 of 4
  1. #1
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default how to set minimum space in a jdialog

    i'm building a jdialog with different jpanels. i defined the size of the jdialog with pack(). my question: it's possible to define a minimum space to the border of the jdialog and if yes how?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by j2me64 View Post
    i'm building a jdialog with different jpanels. i defined the size of the jdialog with pack(). my question: it's possible to define a minimum space to the border of the jdialog and if yes how?
    What exactly do you mean by "minimum space to the border of the JDialog"? Do you mean to put an empty border around the contents held by the JDialog? If so, have you tried using an EmptyBorder(.....) on the JDialog's contentPane? You may wish to give it a look.

  3. #3
    zweibieren is offline Senior Member
    Join Date
    Aug 2009
    Location
    Pittsburgh, PA
    Posts
    284
    Rep Power
    6

    Default

    One could use JOptionPane
    Java Code:
        JOptionPane  pane = new JOptionPane(...);
        int borderWidth = 23; // for a really big border !-)
        pane.setBorder(BorderFactory.createEmptyBorder(borderWidth));
        ...

  4. #4
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    Quote Originally Posted by Fubarable View Post
    Do you mean to put an empty border around the contents held by the JDialog?
    hallo Fubarable

    do you remember the class DialogDemoDialog you wrote? I put 3 JTextField and 3 JLabels in the mainPanel and so I needed some space at the border. the statement i was looking for is

    mainPanel.setBorder(new EmptyBorder(10, 10, 10, 10));

    thank you and zweibieren

Similar Threads

  1. minimum,/maximium
    By sinista in forum New To Java
    Replies: 7
    Last Post: 10-01-2009, 06:07 PM
  2. Replies: 0
    Last Post: 07-05-2009, 01:31 PM
  3. [SOLVED] Help Finding the Minimum value of an array
    By MSteinman in forum New To Java
    Replies: 18
    Last Post: 04-21-2009, 10:14 AM
  4. Help With Minimum Value
    By Bodomar in forum New To Java
    Replies: 1
    Last Post: 11-07-2008, 05:29 AM
  5. Minimum system requirements
    By coco in forum New To Java
    Replies: 1
    Last Post: 07-31-2007, 09:19 PM

Posting Permissions

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