0

Hello good day.

I have an idea for my program. I have a Table in my display. I want to add a Component to - let's say - the right of my screen. When I click this component it should display to me buttons and other components that I have added to it. I want this component is activiated I want it to display from one side of my Frame as a layer over the Table that I have in my display; much like a docked panel or overlay panel.

I would love to know how I could accomplish this please? Are there any components that would facilitate this?

My current GUI setup is this.

My JFrame has a JScrollPane with a JTabbedPane as it's viewport view. On one of the tabbed pane's JPanel's there is THAT TABLE I mentioned added to it within a JScrollPane.

3
Contributors
10
Replies
30
Views
3 Years
Discussion Span
Last Post by JamesCherrill
Featured Replies
  • 1

    whenever I use absolute positioning resizing my JFrame leaves me with some out of place components. - add ComponentListener to JFrame, - must be delayed by Swing Timer (local variable) with small delay (450-600ms) because this listener firing one event per one pixel, to avoiding (useless) bunch of repainting at … Read More

  • Annoying? Absolutely not! Sensible questions, and good use made of the answers. Ideal. Mark solved? Read More

0

there are four ways

  • OverLayout or JLayeredPane

  • GlassPane

  • JLayer (required Java7 based on JXLayer - Java6)

  • Java Accordion

_____________________________________________

  • note don't to use JViewport for this job without own custom RepaintManager
0

Thank you very much. So do I add the layered pane to the tabbed Pane?

Edited by CoilFyzx: Grammatical error

0

Other way round. You add the layered pane to your JFrame, then add everything to the layered pane so you can overlap things as required.

0

Okay. Here's another question please:

Searching forums it seems that I have to treat the adding of components to the layered pane as if I were creating my own layout...setLocattion...setBounds...
this is me hardcoding locations. Isn't this bad practice? How do I seamlessly take care of resizing of my frame using layered pane please?

0

Let me be more specific then, whenever I use absolute positioning resizing my JFrame leaves me with some out of place components.

I have added my JLayeredPane to a scroll pane. How do I get my scrollpane to allow scrolling when the JFrame shrinks to a particular dimension please?

1

whenever I use absolute positioning resizing my JFrame leaves me with some out of place components.

  • add ComponentListener to JFrame,

  • must be delayed by Swing Timer (local variable) with small delay (450-600ms) because this listener firing one event per one pixel, to avoiding (useless) bunch of repainting at runtime

  • call Timer.restart() if resize continued,

  • otherwise Swing Action or ActionListener will fired

  • resize of layer should be wrapped into invokeLater (moving this event to the end of EDT queue)

Edited by mKorbel

0

Thank you all. I decided that I could put my JLayeredPane in a ScrollPane. This worked for me.

I set the size of the layered pane and it's preferred size as well as the size of the scroll pane. Thank you very much for your help. I hope I didn't annoy anyone...(I keep getting this feeling that I am. :s)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.