Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: How to scale the scrollpane's Vvalue

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Location
    South-Africa
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How to scale the scrollpane's Vvalue

    Hey

    It is my first time using javaFX 2 and I am having problems with the scrollPane's Vvalue.
    I am trying to keep track of the top left hand corner of the viewport because I want to render objects as I move around and I need to know the co-ordinates around the viewport.

    The current compensation I am trying to use it:

    double tempX = ((scroll.hvalueProperty().get()) * CANVASSIZE) - ((scroll.hvalueProperty().get()) * scrollPaneWidth);
    double tempY = ((scroll.vvalueProperty().get()) * CANVASSIZE) - ((scroll.vvalueProperty().get()) * (scrollPaneHeight));

    But this attempt is not 100% correct.
    After this works I also scaling the scrollPane's content, so I also want to scale the x and y co-oordinates with the scale.

    Does anyone have some insight in the problem?

    Thanks.
    Jacques

    I found a solution:

      tempY = (scroll.vvalueProperty().get())  * (CANVASSIZE- scrollPaneHeight/tempScale);

    I was just trying to make a pannable scrollPane and I had the scrollBars visible so that I could see where I was, but that messed up the calculations. When I set the scrollbar's visibility off, the code worked.
    Last edited by Jacques_ZA; January 25th, 2013 at 08:11 AM. Reason: answer


Similar Threads

  1. get gray scale value from 16-bits image
    By div111 in forum Java Theory & Questions
    Replies: 1
    Last Post: January 16th, 2013, 08:52 AM
  2. how to get gray scale value from 16- bit grayscale image
    By div111 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 16th, 2013, 08:51 AM
  3. scrollpane is displaing on screen
    By hwoarang69 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: November 12th, 2012, 09:32 AM
  4. [SOLVED] Scale Numbers from 0.0f to 1.0f
    By techwiz24 in forum Java Theory & Questions
    Replies: 1
    Last Post: September 23rd, 2011, 09:50 PM
  5. [SOLVED] Adding Scrollpane to jPanel
    By Onur in forum AWT / Java Swing
    Replies: 5
    Last Post: August 25th, 2011, 03:04 PM

Tags for this Thread