• Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating a resizable panel in a corner of a frame  RSS feed

 
Dan Kao
Greenhorn
Posts: 18
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I was working on a small GUI program and wanted to create a small output panel similar to the console of Eclipse - when it is not locked into the "sidebar."

The two things I'd like to emulate are:
  • in one corner
  • above other items

  • and if possible, the fact that it can be resized.

    I've successfully placed a component (for example, a JLabel) above my main contents using a JLayeredPane, but is there any other existing component I could use to create something like this, or something similar?
    If not, how would I go about doing this?

    Thanks
     
    Rob Camick
    Ranch Hand
    Posts: 2756
    12
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Create a non-modal JDialog.

    It works just like a JFrame, but is a child window to the frame. The user will be able to resize it and move it around the desktop.
     
    Dan Kao
    Greenhorn
    Posts: 18
    Eclipse IDE Java Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Sorry - I just realized I made a mistake and didn't use the correct terminology in my question.
    What I meant to ask was, is it possible to have a resizable panel that is only locked to one corner, as opposed to the entire side.

    For example,


    as opposed to


    (in the first image, the console is "floating" above the text and is not part of the sidebars, and in the second it is locked to the side.)
    Is this possible using Swing components?

    (I'm not sure if these solutions would be viable, but I've considered an invisible JDesktopPane and a JInternalFrame to do the job, and a JTextArea in a higher layer on which I could call setBounds(), which I know isn't recommended.)

    TIA
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!