Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Achieving a LineBorder that is also padded

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Achieving a LineBorder that is also padded

    Hi all.

    I'm using
    setBorder (BorderFactory.createEmptyBorder (10,10,10,10));
    to get some padding around a component (which is a group of other components), however I'd also like a thin border around this group (as well as the padding). How do I go about this.

    At first I tried creating a new CompoundBorder with both the line and empty border. But this didn't work.

    Cheers.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,166
    My Mood
    Hungover
    Thanks
    141
    Thanked 597 Times in 512 Posts

    Default Re: Achieving a LineBorder that is also padded

    What do you mean by "didn't work"?

    I'd suggest you throw together an SSCCE demonstrating what you tried. A single component with the compound border should probably be enough.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: Achieving a LineBorder that is also padded

    Hello caesius,

    These links should help you with your problem:

    How to Use Borders (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)

    Different Swing borders : BorderSwing JFCJava
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers