How to put a component on top of others?

前端 未结 3 1558
臣服心动
臣服心动 2020-12-02 02:18

I have a JScrollPanel that includes a big panel which it\'s self includes 3 inner panels. i want to put a panel (for example) in a special place so that always

相关标签:
3条回答
  • 2020-12-02 02:50

    You could use

    • The GlassPane
    • JLayeredPane

    To overlay content on top of the other components on the screen

    0 讨论(0)
  • 2020-12-02 03:11

    Couldn't you just put the content that you don't want to move in a separate JPanel that isn't the scrolling panel? I don't see any reason to include it in the scrolling panel if you don't want it to scroll.

    So have one big panel (call it bigPanel or something) that doesn't scroll. Then have the panel that you don't want to scroll in bigPanel. Then also put the scrolling panel in bigPanel as well.

    Perhaps I'm missing something, but wouldn't that solve your problem?

    0 讨论(0)
  • 2020-12-02 03:14

    There's a JLayeredPane example here, but OverlayLayout, seen here, may be of interest. It's not included in the conventional gallery.

    OverlayLayout

    Also consider this example that paints on the scroll pane's JViewport.

    viewport

    0 讨论(0)
提交回复
热议问题