Resolution independece in JavaFX

I'm doing a study over resolution independence of web technologies.
How does JavaFX handle resolution independence? Does it use vector graphics?
Let's say I have one device with screen size 480x600 px and another with 1200x900 px. Can I tell the application to automatically scale its GUI to the screen size. And that it is done without loss of detail?
Thanks,
Jocke

The JavaFX scene graph is all about vector graphics (unless you explicitly use some image based graphic) but that is probably not the answer you are looking for. Supporting a resolution independent GUI takes much more than that and JavaFX currently does not support that out of the box but I think it could be done manually via CSS and a clever layout design.
There is a JIRA request for this featrue:
http://javafx-jira.kenai.com/browse/RT-14020
Michael

Similar Messages

  • How to set a background image in javafx?

    Hi everyone,
    I draw FXML GUI,it includes labels and ProgressBar,load it in JavaFX, this is a snippet.
    root = FXMLLoader.load(getClass().getResource("StartMenuFXML.fxml"));
    label1=(Label)root.lookup("#label");
    label2=(Label)root.lookup("#label");
    progressBar = (ProgressBar)root.lookup("#ProgressBar");
    scene=new Scene(root,600,400);
    stage.setTitle("Start Progress");
    Progress p = new Progress();
    p.start();
    stage.setScene(scene);
    stage.show();
    I need to add a background picture in it, so I add the statements:
    GridPane pane = new GridPane();
    pane.setTitle("-fx-background-image: url('image1.jpg')");
    and change: scene =new Scene(pane,600,400);
    It can display the background picture, but I don't know how to display the labels and ProgressBar on the background picture.
    Give me a good resolution please!
    Thank you so much!

    James_D,
    Your answer is the exact solution, you are a real expert.
    Thank you very very much!!!

  • On differences between JavaFX CSS and the w3c standard css

    This is a discussion topic which came to mind after reading comments in this thread Re: FXML, css and -fx-font-family
    Feel free to comment or share your thoughts on the topic.
    Note that these comments relate to the naming and semantic meanings of css tags, and not the syntax and parsing of css (as both w3c css and javaFX css seem to be equivalent in the later regard).
    You know, sometimes I find JavaFX's lack of certain css features refreshing. It is nice to have all, well, almost all, of the JavaFX CSS documented on one page. I think if you were to do the same thing for w3c css then it would end up with a much larger, more difficult to understand document and even what the contents of that document should be would probably be pretty controversial, in the same kind of way that the HTML5 specification ended up being. Microsoft contributed over 7000 tests to w3c just to cover only a subset of the css rules available in browsers today. The webkit project lists almost a thousand open CSS bugs: https://bugs.webkit.org/buglist.cgi?product=WebKit&component=CSS&resolution=---. So implementing even partial w3c CSS support is a complex project.
    When I first started using JavaFX CSS I found the differences to w3c CSS quite jarring, and it was hard to account for them. Now that I am used to JavaFX CSS, I don't have as much of an issue. The difference in names and semantics is going to be an impediment to designers working on JavaFX who are familar with w3c CSS - but the designers will quickly also discover that FXML is not HTML and Java is not JavaScript and JavaFX deployment is not HTML deployment. So, perhaps, in the larger picture, it is not as big a deal as it would seem. Still, one can't help think that any impediment to people easily picking up and adopting JavaFX is doing the technology a disservice.
    There are other advantages in having the JavaFX CSS in it's own namespace to w3c css, in that it can evolve seperately, it is not expected to be exactly the same because it has a different name, it is not expected to fully implement w3c css as browsers do because it's clearly a different thing by name, etc. There is even precedent for it in the use by mozilla of moz- CSS prefixes and webkit css properties http://css-infos.net/properties/webkit - the web as not as standard as a lot of people propose. JavaFX CSS is backing a JavaFX rendering engine and not an HTML rendering engine. It is quite remarkable that Oracle was able to build and make available a CSS model for JavaFX that feels as familar as it does to w3c css, as w3c css is targeted very strongly toward styling a completely different technology set (HTML markup and document object model).
    It would be useful to have a tool which translates w3c css to approximations of JavaFX css and vice versa, or the ability for JavaFX to have a mode (perhaps a boolean value when a stylesheet is loaded) to perform an automatic alias or mapping of w3c css to javafx (at least for the subset of w3c css which would make sense to automatically translate to JavaFX css). I haven't checked the JavaFX jira in detail, so perhaps a request for such support already exists - perhaps it is under the private http://javafx-jira.kenai.com/browse/RT-9272 jira.
    The JavaFX css model is really powerful and I have found really useful some of the additions that it adds above the baseline 2.1 css that is found consistently in browsers. With the upcoming Java CSS object model http://javafx-jira.kenai.com/browse/RT-17293, you will also get better programmatic access from Java.
    So, nice work on building and implementing this complex feature . . .

    Thanks for the feedback. Closing the gap between JavaFX CSS and W3C CSS will be an evolutionary process. It would be nice to use a standard's based stylesheet but there is not always a 1-1 mapping to JavaFX. But for those properties that can be mapped, it is something that should be supported. For example, we should be able to handle "font" or "-fx-font".
    I have made http://javafx-jira.kenai.com/browse/RT-9272 public.

  • JavaFX 2.0 : How to make a stage fit into browser view area?

    Invoking a JavaFX 2.0 applet from browser results in white spaces on the right and bottom area of the browser. This happens when the JavaFX stage resolutions is lesser than that of browsing desktop resolution. In a client/server model, usually server components doesn't know about the client resolutions. So how to make a stage fit into browser view area?
    Also I think, setting the primary stage to full screen mode is not what I want to achieve, as this mode overlays the browser window.

    Try typing 100% into the width and height fields. Alternatively, you could use Javascript (no connection to Java in spite of the name) to create an event to resize the applet to the window's size.

  • How to change the screen resolution in the Mobile Emulator

    so far we tried the Mobile Emulator in the netbeans, it is alway 240*320, but many real device is WVGA(480*800)
    whether does that mean the JavaFX Mobile only support the 240*320?
    if not, how can I change the screen resolution of the mobile Emulator, thank you

    I'd like to know how to do this, too. I tried fiddling with the "ScreenGraphics.bean" in the JavaFX\javafx-sdk1.2\emulator\toolkit-lib\devices\QwertyFxPhone directory, but without success.
    If anyone knows, please just drop a quick line here!

  • How to design FXML for all screen resolution

    hello
    I am designing a page in FXML using scene builder,and I want that my fxml runs good on few screen resolutions,for that there is need for relative positioning but in FXML there is nothing like % and all.
    Please do any one have worked on this then help me out.
    thanks in advance.

    See this blog, it doesn't answer your question, but I hope it helps:
    http://blog.randahl.dk/2012/12/javafx-designing-for-multiple-screen.html

  • Rendering in JavaFX

    Hi,
    I am currently working on my bachelor thesis about JavaFX 2
    I have a few questions about rendering in JavaFX
    I don’t really understand what the glass toolkit is for and how it’s connected to prism.
    If the glass toolkit is firing the pulse event how does prism know that it has to render a frame?
    And how does the Quantum Toolkit handling the threads?
    And what is the advantage of having two threads (Application and Prism Render Thread) instead of one like in Swing?
    I haven’t found much about rendering in the documentation so please help me. :)

    Hi David,
    Glass is to FX as AWT is to JavaSE. Sort of :-). Glass is our windowing toolkit implementation. It is responsible for showing windows (including Stage, Popup, etc), managing the event queue, passing events up to JavaFX, and setting up timers. Every native application (on Windows, Mac, Linux, etc) has a native event queue. On some platforms like Mac, you get callbacks called whenever an event needs to be handled (that is, the native system pumps the event queue and delivers events to native callback methods). So on Mac Glass, we get these native callbacks, turn them in to JavaFX events, and send them to JavaFX (more or less). On Windows we have to manually pump the event queue, pulling off the event, creating the JavaFX event equivalent, and then pass that up to JavaFX for dispatching.
    Pulse events are normal events on our event queue, but they are generated based on a timer. Glass sets up a timer which fires off every 16.666ms. It is either based on just a hi resolution system timer (native), or it is based on a callback from the OS whenever the video card refresh occurs. This latter mechanism is much more precise, system timers can sometimes drift leading to "jitter" in animations whereas the video card refresh is pretty rock solid. When JavaFX gets notified by glass when the timer fires, it checks to see: is there a pulse already queued up or being handled? If so, don't fire another pulse (keeps us from flooding the event queue with pulses). If the scene is not dirty and there are no animations, then we don't need to handle the pulse. Otherwise if the scene is clean but there are animations, then we handle the pulse. A PulseEvent is then created and put on the event queue.
    During the normal process of handling the events on the event queue, when we encounter a pulse event, we then do the following things:
    - Process animations
    - Process CSS
    - Process Layout
    - Synchronize from the FX scene graph to the render tree (Prism)
    - Pick the scene and update the mouse hover state if a node has moved under the cursor or moved out from under the cursor
    The render thread then goes off and renders after the synchronization step has occurred.
    Quantum is the thing that listens to Glass pulse timer events and creates the PulseEvent and adds it to the event queue, and is also the thing that handles the pulse event, causing animations to be processed and then telling each scene to handle the pulse event (where each scene processes CSS, layout, and synchronizes etc). Quantum then tells the render thread to go off and render.
    Presently in JavaFX, although we have a render thread and application thread, they both essentially run synchronous. I have a patch going into 3.0 as soon as the repo opens that allows us to run multithreaded, where the FX app thread and render thread will be running in parallel except for the brief period of time where they synchronize during the pulse. We have seen 1.5x - 2x performance improvement on tablets by running these threads in parallel. We've also noticed 40%+ performance improvement on desktop in some of the scenarios I've run thus far. Having multiple threads just makes sense in a world where we have multiple cores (even on embedded systems!). Even on a single core, multiple threads might still be advantageous because the CPU doesn't have to wait on memory read operations or GPU operations but can be busy computing the state for the next rendered frame. Having multiple threads does increase the memory overhead, but actually it may not do so very significantly (we have one prototype where we found that the performance cost in constantly converting from FX Color to native Color objects was so bad that caching the converted color object was cheaper anyway, so it isn't clear that even in an immediate-mode style single-threaded rendering system that you'd save much in terms of memory).
    I don't know when your thesis is due by, unfortunately a lot of code in this area hasn't been open sourced yet so you're kind of flying blind. May the decompiler ever guide you ;-)

  • Multiple JavaFX stages in fullscreen mode

    I have an application that contains two stages which should be shown on two different screens both in fullscreen mode. I managed to position the two stages on seperate screens, and tried to set the fullscreen property to true on each Stage, but only of them is shown without decoration. It is always the one that has the fullscreen property set last that is shown in fullscreen mode.
    Is it not possible in JavaFX 2.2 to have multiple stages in fullscreen mode at the same time?

    Is it not possible in JavaFX 2.2 to have multiple stages in fullscreen mode at the same time?This I do not know. My app has also 2 stages, displayed fullscreen on both monitors. To achieve this, I retrieve the screen resolutions and then I set the size accordingly..what is the benefit of fullsceen-mode ?

  • Font measurement points in JavaFX.

    I ran on one problem.
    When I set the font size of any node with CSS, no matter what measurement unit I choose (I tried both pt and px), font size is still set in pixels. I also tried to set font for “Text” with the method “setFont”, which accepts parameter of type “Font”.
    It is said in JavaFX2 documentation, that:
    The size of a Font is described as being specified in points which are a real world measurement of approximately 1/72 inch.
    But the font size was still set in pixels.
    For an experiment I added “WebView” to the scene and loaded a page in it, on which I displayed two div tags. Within the first div the font size was in pt, and within the second one – in px. As I had suggested, the font sizes were different, and the font size in the last div was identical to the font size in the nodes I referred to at the beginning.
    Why is this happening? How do I set the font size in pt? At this moment to solve this problem I convert pt to px using this formula: px=pt/0.75 (dpi of my screen is 96).
    example:
    import javafx.application.Application;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.text.FontPosture;
    import javafx.scene.text.FontSmoothingType;
    import javafx.scene.text.FontWeight;
    import javafx.scene.text.Text;
    import javafx.scene.web.WebView;
    import javafx.stage.Stage;
    import java.net.URL;
    public class TestFont extends Application {
        @Override
        public void start(Stage stage) throws Exception {
            final Group root = new Group();
            Scene s = new Scene(root, 500, 500);
            Text t = new Text(100, 250, "1) - abcdeABCDE12");
            t.setFontSmoothingType(FontSmoothingType.LCD);
            t.setStyle("-fx-font-size: 36pt; -fx-font-family: Calibri;");
            Text t2 = new Text(100, 300, "2) - abcdeABCDE12");
            t2.setFont(javafx.scene.text.Font.font("Calibri", FontWeight.NORMAL, FontPosture.REGULAR, 36));
            t2.setFontSmoothingType(FontSmoothingType.GRAY);
            Text t3 = new Text(100, 350, "3) - abcdeABCDE12");
            t3.setStyle("-fx-font-size: 36px; -fx-font-family: Calibri;");;
            t3.setFontSmoothingType(FontSmoothingType.GRAY);
            WebView wv = new WebView();
            wv.setLayoutX(100);
            wv.setLayoutY(360);
            URL urlWebViewCell = this.getClass().getResource("/testFont.html");
            wv.getEngine().load(urlWebViewCell.toExternalForm());
            root.getChildren().addAll(wv, t, t2, t3);
            stage.setScene(s);
            stage.show();
        public static void main(String[] args) {
            launch(args);
    }testFont.html:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
        <title></title>
    </head>
    <body>
    <div style="font-size: 36pt; font-family: Calibri;">4) - abcdeABCDE12</div>
    <div style="font-size: 36px; font-family: Calibri;">5) - abcdeABCDE12</div>
    </body>
    </html>

    I don't know exactly how JavaFX is doing it, but standard Java on Windows just assumes a screen resolution of 72 dpi and thus effectively maps points to pixels as one to one. You would see a difference when you print your text (if JavaFX would support printing).

  • Handling different screen resolutions by a desktop application

    Hi,
    I recently tried to make a desktop app using basic javafx layouts and controls. I made it using borderpanes, gridpanes and stackpanes. I had a base of borderpane, on which all my controls were placed on grid, but it looked lame, so i inserted a colorful rectangle in between the background and controls using stackpane. Everything was wonderful on my system, but when i gave it to a friend to check out what i had made, it just wasn't the way i had made it on my system.
    The background was as it should have been(it was because the scene was kept at screen resolution) but the rectangle and the controls were displaced, and the reason was my friend has a laptop with higher resolution than mine. I tried to fix things up, removing the hard coding for the placements and using an ratio of the screen resolution, but no matter how much i tried, something or the other seemed to be out of place. For ex, on a page where i had one big rectangle, inside which there are two small rectangles and each rectangle have a gridpane with controls. All of them are stacked together using Stackpane.
    I'd blame all to the stackpane, but i chose it coz my requirement demanded it.
    Any suggestions on how to make an desktop application which can handle all resolutions, and the best practices that must be followed and kept in mind, while designing a desktop app.
    Thanks,
    Abhi

    one example you can find in the image below, where i had set the message perfectly in my system and opening it in another system, the message is not placed correctly.
    http://i37.tinypic.com/hv8mtl.png
    Hope now yu understand my problem.

  • Javafx 1.3.1 multiple display environment

    Hi all,
    I'm currently using javafx 1.3.1.
    I need to know when the user drag the window from one display to another in order to adjust the stage resolution.
    any help will be appreciated
    Moti

    You can still follow Control, Skin, Behavior model for implementing custom controls. Its just that you cannot extend any of the internal classes, actual implementation of control is now in CSS file. There are no official documentation for customizing JavaFX 1.3 CSS implementation though.
    You can refer to below articles..
    JavaFX Control Styling: http://pleasingsoftware.blogspot.com/2010/04/advanced-javafx-control-styling.html
    Building Custom Controls: http://jonathangiles.net/blog/?p=478

  • JavaFX roadmap ... emerging platforms ... (iPhone/iPad, Android ...)

    Hi,
    This url talks about the roadmap.
    http://javafx.com/roadmap/
    It seems to be upto 2014.
    Request the JavaFX Product Managers to develop and state their plans for the emerging platforms. (iPhone/iPad, Android, Blackberry OS ? )
    Cheers ...
    /rk

    See http://fxexperience.com/2012/01/2012-javafx-resolutions/ for an unofficial top 10 goals for this year.
    Note resolution #5 (embedded):
    "As announced at JavaOne 2011, the new embedded platforms coming from Oracle (CDC) will be using JavaFX as the UI technology. That is slated for final release in 2013 along with Java 8 and JavaFX 3. However, there is a lot of work that has to be done this year to make this a reality, including adding touch event support to the platform. Having working embedded prototypes for this year is high on the list of goals for JavaFX!"
    I could be wrong here, but I believe the Android prototype shown at JavaOne was based on very early CDC prototype and the potential strategy for iOS support would include bundling an iOS port of the CDC with apps. My guess is that the JavaFX team is working on Android/iOS support (and additional ARM/Intel platforms) but is not at liberty to discuss this work and roadmap in detail at this stage (but that is just my guess - I don't know).
    Also, as resolution #1 (open source) progresses, future plans will become naturally more transparent.
    The goal is to complete the open source process this year.

  • Anyone using javafx 8 with preview 80?

    I'm finding this version almost unusable. None of the tree/list/table rendering works and there are tons of CSS resolution errors for modena and caspian. Or is it just me?
    Curtis

    I am the tech lead of the UI Controls team at Oracle. Don't dismiss things too quickly as "buggy beta software" - now is the perfect time for us to fix bugs that you may be experiencing, and in many cases we may not even know there is a bug unless you file a bug report on us. Please take the time to go to http://javafx-jira.kenai.com and file a bug report under 'runtime' and 'controls' so that we can take a look.
    Thanks!

  • Whether JavaFX is the right choice for my application??

    Hi,
    I am interested in creating a graphics application. I have bunch of sensors on a table and I want to create different images on the table through a projector hung on ceiling facing down. I am have some values for a gray scale. Say for example I have 250 values then I want the screen to be divided into equal 250 rectangles and each of them will be given a color based on the gray scale value I have. If I have 800 X 600 values then I will have that much resolution of the gray scale image. after certain time the values change and I have to change the image as well.
    I thought of using JavaFX but I am not sure should I go with this or there is some other language or tool which will be very helpful in creating application at pixel level?
    Samip

    Pixel level manipulations is not the strong point of JavaFX.
    For the application you describe, I recommend instead using Processing, lot of people use it for shows and exhibitions. And it interfaces well to hardware.

  • Mini DVI to Video Adapter - S-Video Resolutions / HDMI

    Hello,
    I just got my Mini DVI to Video Adapter and I using a S-Video cable to plug to my HD LCD 32'' TV.
    When I connect everything, the resolution drops from 1280x800 to 1024x768.
    How can I change back to 1280x800?
    I don't know but I'm kind of disappointed with the QUALITY of the video... is there any way I could improve this? Perhaps using a Mini-DVI to HDMI Adapter? Does it exist? Will upgrade the resolution and/or the quality of the video?
    I've read that audio is not supported using the Mini-DVI. To be honest, I don't really care about the audio... I can use the analog. But I'm very very disappointed with the quality of the video...
    Thanks anyone

    Well,
    Based on what you said, I should have three options:
    A: MacBook -> MiniDVI to DVI Adapter -> DVI to HDMI cable -> TV with HDMI input
    C: MacBook -> MiniDVI to DVI Adapter -> DVI to DVI cable -> TV with DVI input
    B: MacBook -> MiniDVI to HDMI Adapter -> HDMI cable -> TV with HDMI input
    What should work best?
    My TV does not support DVI input, so that's kind of narrow it down, right?! Leaving options A and C.
    I don't have any of the adapters. In both ways I'll end up having to buy stuff. Which is less expansive?
    Thanks in advance
    Cheers.

Maybe you are looking for

  • How much is to much?

    I recently experienced an issue with my Thunderbolt display or more accurately daisy chaining my Thunderbolt display. I have a 15 inch MacBook Pro and 2 Thunderbolt displays powered through the daisy chain. This set up has worked fine for about a yea

  • Error while accessing public holiday calendar on 20100101

    Dear Gurus. When i was created Work Schedule TC-PT01 Error Showing "Error while accessing public holiday calendar on 20100101" Message no. P2518 Diagnosis The function module HOLIDAY_CHECK_AND_GET_INFO has generated an error. Please Advised Regards M

  • Error when discover Weblogic 10.x under Grid Control 11g

    Hi all, I'm trying to adding web logic from middleware tab but I receive Internal Error has occurred. Check the log file for details. agent is installed and everything is working perfect. But every time I discover I receive this error which may indic

  • What are the main differences between 9 iAS and Oracle 8.1.7 ?

    My question is focus on JServ/JVM/EJB Deployment. 1. They both provide Appach JServ to support JSP/Servlet application 2. They both provide JVM 8i to support EJB 1.1. 3. You can deploy JSP/Servlet application to JVM via mod_ose. 4. On the White paper

  • How to modify a constant from V_T511K without generating a Transport

    Hello, Is there any posibility (or OSS note) to make view V_T511K user modificable? I mean, we want to let our users to modify that table directly in Production environment. Thank you very much, Matias