Results 1 to 18 of 18
  1. #1
    erikn is offline Member
    Join Date
    Jan 2013
    Posts
    7
    Rep Power
    0

    Default "Fixed" pane inside scrollpane

    Hi all. Not a super regular JavaFX user here, but using it for a collaborative project.

    I'm looking to have a static "fixed" pane appear in a pannable scrollpane such that it is anchored to the bottom of the browser window and not affected by the scrolling of the background. I cannot seem to find any info on how to do this.

    Currently using a Canvas element as the ScrollPane's child, and looking to add a second, separate Canvas element to the fixed pane. I'd be incredibly grateful for any wisdom anyone here might be willing to share. Thanks so much.

  2. #2
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    398
    Rep Power
    5

    Default Re: "Fixed" pane inside scrollpane

    I have not tried this yet and I have not run across this yet either, but the first thing I would try to do is to set the location of the node based on the information you can get for the viewport of the scrollpane.
    Example: if you want to place the node always at the top left corner, the coordinates for the node are the coordinates of the top left corner of the viewport.
    You will have to establish a Listener for any kind of scrollpane movement and recalculate with each movement.

  3. #3
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,989
    Rep Power
    8

    Default Re: "Fixed" pane inside scrollpane

    You should move the "fixed" pane out of the scrollpane and create a new BorderPane, put the scrollpane in the center and the fixed pane in the bottom. (https://docs.oracle.com/javafx/2/lay...in_layouts.htm)
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  4. #4
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    398
    Rep Power
    5

    Default Re: "Fixed" pane inside scrollpane

    good solution. my understanding was that OP wants to have the node fixed inside the ScrollPane though.

  5. #5
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,989
    Rep Power
    8

    Default Re: "Fixed" pane inside scrollpane

    Quote Originally Posted by benji2505 View Post
    good solution. my understanding was that OP wants to have the node fixed inside the ScrollPane though.
    How would that be different from a BorderPane with a center and a south part?
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  6. #6
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    398
    Rep Power
    5

    Default Re: "Fixed" pane inside scrollpane

    my understanding is that OP wants to have a "fixed/static" node inside the scrollpane. So, some sort of node that stays in a certain place in the foreground, and the scrolling happening in the background. I don't think OP wants to segregate the pane via Gridpane, Borderpane, SplitPane, etc.

  7. #7
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,989
    Rep Power
    8

    Default Re: "Fixed" pane inside scrollpane

    Maybe OP should shed some light on the design.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  8. #8
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: "Fixed" pane inside scrollpane

    Sounds to me like the OP wants the capability to "freeze" a section of the scrollable contents, similar to what one can do in Excel.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: "Fixed" pane inside scrollpane

    And this, ladies and gents, is why clarity of requirements is quite important...
    :)

    I think we have three different interpretations so far.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,989
    Rep Power
    8

    Default Re: "Fixed" pane inside scrollpane

    It's a statusbar. I am positive about that :)

    "Fixed" pane inside scrollpane-10160285_8d3c50f724_o.gif
    Last edited by SurfMan; 04-10-2017 at 07:28 PM.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  11. #11
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    398
    Rep Power
    5

    Default Re: "Fixed" pane inside scrollpane

    Quote Originally Posted by jim829 View Post
    Sounds to me like the OP wants the capability to "freeze" a section of the scrollable contents, similar to what one can do in Excel.
    That's how I understood it as well.

  12. #12
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    398
    Rep Power
    5

    Default Re: "Fixed" pane inside scrollpane

    I know this is html/JS, but to get an example of my understanding:
    fedex.com, expand the blue box on the right "ask fedex", then scroll the homepage up and down. the box will stay put (roughly). I guess this is what OP is looking for.

  13. #13
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,989
    Rep Power
    8

    Default Re: "Fixed" pane inside scrollpane

    My understanding, I think, My guess, Maybe, Sounds to me
    Time for OP to give out some details. This is driving me nuts :)
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  14. #14
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: "Fixed" pane inside scrollpane

    Just to throw my hat in the ring, I actually thought it was a fixed overlay above the scrolling whatever underneath.
    So imagine a watermark.
    :)
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  15. #15
    erikn is offline Member
    Join Date
    Jan 2013
    Posts
    7
    Rep Power
    0

    Default Re: "Fixed" pane inside scrollpane

    Quote Originally Posted by benji2505 View Post
    I know this is html/JS, but to get an example of my understanding:
    fedex.com, expand the blue box on the right "ask fedex", then scroll the homepage up and down. the box will stay put (roughly). I guess this is what OP is looking for.
    Quote Originally Posted by Tolls View Post
    Just to throw my hat in the ring, I actually thought it was a fixed overlay above the scrolling whatever underneath.
    So imagine a watermark.
    :)
    THANKS all for taking the time to respond and sorry for taking awhile to make it back, but benji and Tolls, what you guys are describing is indeed what I'm looking for, sorry if my OP was unclear.. I want the overlay container to be static in the viewport, like a 'position: fixed' element in HTML.

    At this point, I'm thinking it might be easier to draw them both to the same Canvas element and just use redraws and scroll-offsets for "fixededness.'

  16. #16
    erikn is offline Member
    Join Date
    Jan 2013
    Posts
    7
    Rep Power
    0

    Default Re: "Fixed" pane inside scrollpane

    Quote Originally Posted by SurfMan View Post
    Click image for larger version. 

Name:	10160285_8d3c50f724_o.gif 
Views:	18 
Size:	153.4 KB 
ID:	7278
    Classic! Love the pane about documentation, though I admit I'm a skimper.. especially with my own personal projects.

  17. #17
    erikn is offline Member
    Join Date
    Jan 2013
    Posts
    7
    Rep Power
    0

    Default Re: "Fixed" pane inside scrollpane

    <dupe post>

  18. #18
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: "Fixed" pane inside scrollpane

    You should be able to stack the panes, making the top one (your overlay) semi-transparent.
    There's a StackPane layout (tutorial page).

    Now, there might be an issue with the scroll bars, but that's where I would start.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 0
    Last Post: 12-07-2012, 08:29 AM
  2. Replies: 3
    Last Post: 10-30-2012, 03:06 PM
  3. Replies: 2
    Last Post: 10-05-2012, 10:37 PM
  4. An "if" statement inside a "for" loop?
    By soccermiles in forum New To Java
    Replies: 18
    Last Post: 04-20-2010, 03:44 AM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •