Recent changes Random page
GAMING
Technology
 
Gaming
Entertainment
Science Fiction
Biggest wikis
Hobbies
Music
See more...

Magic Constants

From Planet JFX

Jump to: navigation, search
 
  • __DIR__ -- returns the url of the directory that contains the current FX source file. This may be a JAR url if the current file was loaded from a jar file.
  • __FILE__ -- returns the url of the current source file
  • __LINE__ -- returns the current line in the current source file
  • __ARCHIVE__ -- returns the url of the jar file containing the current file, if any

[edit] Example (Compiler)

import javafx.ext.swing.*;


SwingFrame {
    closeAction: function(): Void {java.lang.System.exit(0);}
     
    title      : 'Show Magic Constants'
    visible    : true

    content: GridPanel {
                 columns: 1
                 rows   : 2
                 content: [Label{text: "__DIR__ = {__DIR__}"},
                           Label{text: "__FILE__ = {__FILE__}"}]
    }// GridPanel              
}// SwingFrame

[edit] Example (Interpreter)

import javafx.ui.*;
		
Frame {
    title  : 'Magic Constants'
    width  : 700
    height : 400
    content: Label {text: "<html><dl>
                           <dt>__DOCBASE__</dt><dd>{__DOCBASE__}</dd>
                           <dt>__DIR__</dt>    <dd>{__DIR__}</dd>
                           <dt>__FILE__</dt>   <dd>{__FILE__}</dd>
                           <dt>__LINE__</dt>   <dd>{__LINE__}</dd>
                           <dt>__ARCHIVE__</dt><dd>{__ARCHIVE__}</dd>
                           </dl></html>"}
       
    visible: true
}// Frame

[edit] Links

Rate this article:
Share this article: