![]() |
LearnJavaOnline.org |
Tuesday, December 10, 2013
Learn Java online: Free interactive Java tutorial
Whether you are an experienced programmer or not, the website, LearnJavaOnline.org, is intended for everyone who wishes to learn the Java programming language.
Scene Builder is now open source, as a part of the OpenJFX project
Scene Builder is now open source, as a part of the OpenJFX project .
The whole Scene Builder functionality is provided, including the SB Kit API (designed for integration of SB features into third party tools) as well as the standalone SB application.
This code is made available under the terms of a BSD-style license, similar to JavaFX samples.
The only part of the product which remains closed is the native packaging/installer code.
Scene Builder source code is located in apps/scenebuilder/ in the OpenJFX repository .
Building and running the Scene Builder application from these sources can be done either of the following ways:
From NetBeans: open the SceneBuilderApp project and run it (you need a JDK 1.8 Java Platform configured)
From the command line:
$ cd SceneBuilderApp
$ ant -Dplatforms.JDK_1.8.home=<path_to_JDK_home> run
source: https://forums.oracle.com/message/11290619
The whole Scene Builder functionality is provided, including the SB Kit API (designed for integration of SB features into third party tools) as well as the standalone SB application.
This code is made available under the terms of a BSD-style license, similar to JavaFX samples.
The only part of the product which remains closed is the native packaging/installer code.
Scene Builder source code is located in apps/scenebuilder/ in the OpenJFX repository .
Building and running the Scene Builder application from these sources can be done either of the following ways:
From NetBeans: open the SceneBuilderApp project and run it (you need a JDK 1.8 Java Platform configured)
From the command line:
$ cd SceneBuilderApp
$ ant -Dplatforms.JDK_1.8.home=<path_to_JDK_home> run
source: https://forums.oracle.com/message/11290619
標籤:
news,
OpenJFX,
Scene Builder
Sunday, December 8, 2013
File.getPath(), File.getAbsolutePath() and File.getCanonicalPath()
This example show how File.getCanonicalPath() different from getPath() and getAbsolutePath() in Linux to open soft-link file.
It is described in Java doc:
It is described in Java doc:
- getPath() converts this abstract pathname into a pathname string.
The resulting string uses the default name-separator character to separate the names in the name sequence. - getAbsolutePath() Returns the absolute pathname string of this abstract pathname.
If this abstract pathname is already absolute, then the pathname string is simply returned as if by the getPath() method. If this abstract pathname is the empty abstract pathname then the pathname string of the current user directory, which is named by the system property user.dir, is returned. Otherwise this pathname is resolved in a system-dependent way. On UNIX systems, a relative pathname is made absolute by resolving it against the current user directory. On Microsoft Windows systems, a relative pathname is made absolute by resolving it against the current directory of the drive named by the pathname, if any; if not, it is resolved against the current user directory. - getCanonicalPath()
Returns the canonical pathname string of this abstract pathname.
A canonical pathname is both absolute and unique. The precise definition of canonical form is system-dependent. This method first converts this pathname to absolute form if necessary, as if by invoking the getAbsolutePath() method, and then maps it to its unique form in a system-dependent way. This typically involves removing redundant names such as "." and ".." from the pathname, resolving symbolic links (on UNIX platforms), and converting drive letters to a standard case (on Microsoft Windows platforms).
Every pathname that denotes an existing file or directory has a unique canonical form. Every pathname that denotes a nonexistent file or directory also has a unique canonical form. The canonical form of the pathname of a nonexistent file or directory may be different from the canonical form of the same pathname after the file or directory is created. Similarly, the canonical form of the pathname of an existing file or directory may be different from the canonical form of the same pathname after the file or directory is deleted.
package javafx_filechooser; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.stage.FileChooser; import javafx.stage.Stage; /** * * @web java-buddy.blogspot.com */ public class JavaFX_FileChooser extends Application { File file; @Override public void start(Stage primaryStage) { primaryStage.setTitle("Hello World!"); final Label labelFile = new Label(); Button btn = new Button(); btn.setText("Open FileChooser'"); btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { FileChooser fileChooser = new FileChooser(); //Set extension filter FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("ALL files (*.*)", "*.*"); fileChooser.getExtensionFilters().add(extFilter); //Show open file dialog file = fileChooser.showOpenDialog(null); String pathsInfo = ""; pathsInfo += "getPath(): " + file.getPath() + "\n"; pathsInfo += "getAbsolutePath(): " + file.getAbsolutePath() + "\n"; pathsInfo += (new File(file.getPath())).isAbsolute(); try { pathsInfo += "getCanonicalPath(): " + file.getCanonicalPath() + "\n"; } catch (IOException ex) { Logger.getLogger(JavaFX_FileChooser .class.getName()).log(Level.SEVERE, null, ex); } labelFile.setText(pathsInfo); } }); VBox vBox = new VBox(); vBox.getChildren().addAll(btn, labelFile); StackPane root = new StackPane(); root.getChildren().add(vBox); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
Subscribe to:
Posts (Atom)