Results 1 to 5 of 5
  1. #1
    itaipee is offline Member
    Join Date
    Dec 2008
    Posts
    99
    Rep Power
    0

    Default non-rectangle JPanel

    Hi

    do I have option for non-rectangle JPanel
    instead of ( the punel surface in *)
    ****
    ****
    ****

    I want ot have

    ******
    ******
    ***
    ***

    ofcourse I can have two or more panels but I need ot have only one..

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    12

    Default

    No. You can make JFrames will funky shapes in Java 6, but that just involves making parts of a square frame transparent.

    For your situation, just make a JPanel the size of the bigger rectangle and put whatever goes in that gap in the corner.

    Java Code:
    ******       ###       ******
    ******   +   ###   =   ******
    ******                 ***###
    ******                 ***###
    Last edited by OrangeDog; 04-30-2009 at 07:14 PM. Reason: alignment
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  3. #3
    itaipee is offline Member
    Join Date
    Dec 2008
    Posts
    99
    Rep Power
    0

    Default

    The problem I have two panels: 1 i mark with ## and the other I mark wiht xx

    I want layout liek that

    ####
    ##xx
    ##xx

    If i set bound of panel ### to be 3*4 - then every change I made in the panel will cause the second panel (xxx) to dsiapear

  4. #4
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    12

    Default

    Put panel xxx inside panel ###.
    Avoid using setBounds() for layout, use a LayoutManager instead.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  5. #5
    itaipee is offline Member
    Join Date
    Dec 2008
    Posts
    99
    Rep Power
    0

Similar Threads

  1. Replies: 2
    Last Post: 03-22-2009, 02:53 PM
  2. How to Fill a Rectangle in Java
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-23-2008, 12:10 AM
  3. How to Draw a Rectangle in Java
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-23-2008, 12:09 AM
  4. Rectangle Intersection
    By Gwindow in forum Java 2D
    Replies: 1
    Last Post: 04-24-2008, 04:53 PM
  5. help with rectangle class
    By darkgt in forum New To Java
    Replies: 7
    Last Post: 11-14-2007, 07: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
  •