Fandom

Planet JFX

Fullscreen window example

118pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

This is a simple example showing "Hello World" centered on a fullscreen frame

Preview SDK version

 
package javafxapplication1;


import javafx.ui.*;
import javafx.ui.canvas.*;
import javafx.ui.filter.*;
import java.awt.Toolkit;

Frame {
    var s = Toolkit.getDefaultToolkit().getScreenSize()
   
  
    title: "Hello"
    undecorated: true
    background: Color.WHITE
    width: s.width
    height: s.height
      
          
    
    content: Canvas {
        var text:Text
        content:
            text = Text {
            x: (s.width / 2) - (text.currentWidth / 2)
            y: (s.height / 2) - (text.currentHeight / 2)
            content: "Hello World! {s.width} x {s.height}"
            font: Font 
                {
                    face: FontFace.VERDANA,  style: [ FontStyle.ITALIC,  FontStyle.BOLD], size: 60
                }
            }
        

    }
    visible: true
}


JavaFX SDK 1.2

package com.jfx.wikia;

import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.paint.Color;
import javafx.stage.Screen;
import javafx.scene.text.Text;import javafx.scene.text.Font;

var text:Text = bind Text {
    x:(Screen.primary.visualBounds.width/2)
 y:(Screen.primary.visualBounds.height/2)
 content: "Hello World! {%5.0f Screen.primary.visualBounds.width} x {%5.0f Screen.primary.visualBounds.height}"
 font: Font {
  name: "Verdana Bold Italic"
  size: 24
 }
}
Stage { 
 fullScreen: true 
 scene: Scene { 
     fill: Color.WHITE
  content: [ 
   text
  ]
 }
}

Also on Fandom

Random Wiki