forked from goxr3plus/JavaFX-Web-Browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,178 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/> | ||
<classpathentry kind="lib" path="src/jfoenix.jar"/> | ||
<classpathentry kind="lib" path="src/commons-validator-1.6.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</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,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>xxWebBrowser</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>spartan.tipper</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>il.org.spartan.nature</nature> | ||
</natures> | ||
</projectDescription> |
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,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
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,7 @@ | ||
# About | ||
|
||
You always dreamed how to make a WebBrowser in JavaFX? Well then you are in the right place . It took me 2 days to make it and it is here for you ready to test and improve it . | ||
|
||
This project is part of XR3Player java Media Player , so i will continue to improve it in every update :) | ||
|
||
#Youtube Video Tutorial |
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,8 @@ | ||
<?xml version="1.0" encoding="ASCII"?> | ||
<anttasks:AntTask xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:anttasks="http://org.eclipse.fx.ide.jdt/1.0" buildDirectory="${project}/build"> | ||
<deploy> | ||
<application name="xxWebBrowser"/> | ||
<info/> | ||
</deploy> | ||
<signjar/> | ||
</anttasks:AntTask> |
Large diffs are not rendered by default.
Oops, something went wrong.
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,90 @@ | ||
/* | ||
* This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
Also(warning!): | ||
1)You are not allowed to sell this product to third party. | ||
2)You can't change license and made it like you are the owner,author etc. | ||
3)All redistributions of source code files must contain all copyright | ||
notices that are currently in this file, and this list of conditions without | ||
modification. | ||
*/ | ||
|
||
|
||
package application; | ||
|
||
import javafx.application.Application; | ||
import javafx.scene.Scene; | ||
import javafx.scene.layout.BorderPane; | ||
import javafx.stage.Screen; | ||
import javafx.stage.Stage; | ||
|
||
/** | ||
* From here you start the application | ||
* | ||
* @author GOXR3PLUS | ||
* | ||
*/ | ||
public class ApplicationMain extends Application { | ||
|
||
/* (non-Javadoc) | ||
* @see javafx.application.Application#start(javafx.stage.Stage) | ||
*/ | ||
@Override | ||
public void start(Stage primaryStage) { | ||
|
||
//Root | ||
BorderPane root = new BorderPane(); | ||
root.setCenter(new WebBrowserController()); | ||
|
||
//Scene | ||
Scene scene = new Scene(root, getVisualScreenWidth() / 1.2, getVisualScreenHeight() / 1.2); | ||
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); | ||
|
||
//Prepare the Stage | ||
primaryStage.setTitle("JavaFX WebBrowser Made By GOXR3PLUS STUDIO :) "); | ||
primaryStage.setScene(scene); | ||
primaryStage.show(); | ||
|
||
} | ||
|
||
/** | ||
* Gets the visual screen width. | ||
* | ||
* @return The screen <b>Width</b> based on the <b>visual bounds</b> of the Screen.These bounds account for objects in the native windowing system | ||
* such as task bars and menu bars. These bounds are contained by Screen.bounds. | ||
*/ | ||
public static double getVisualScreenWidth() { | ||
return Screen.getPrimary().getVisualBounds().getWidth(); | ||
} | ||
|
||
/** | ||
* Gets the visual screen height. | ||
* | ||
* @return The screen <b>Height</b> based on the <b>visual bounds</b> of the Screen.These bounds account for objects in the native windowing | ||
* system such as task bars and menu bars. These bounds are contained by Screen.bounds. | ||
*/ | ||
public static double getVisualScreenHeight() { | ||
return Screen.getPrimary().getVisualBounds().getHeight(); | ||
} | ||
|
||
/** | ||
* Main Method | ||
* | ||
* @param args | ||
*/ | ||
public static void main(String[] args) { | ||
launch(args); | ||
} | ||
} |
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,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import com.jfoenix.controls.JFXButton?> | ||
<?import javafx.geometry.Insets?> | ||
<?import javafx.scene.control.Tab?> | ||
<?import javafx.scene.control.TabPane?> | ||
<?import javafx.scene.control.Tooltip?> | ||
<?import javafx.scene.layout.AnchorPane?> | ||
<?import javafx.scene.layout.BorderPane?> | ||
|
||
<fx:root prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: rgb(0,0,0,0.85);" stylesheets="@application.css" type="BorderPane" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1"> | ||
<center> | ||
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" BorderPane.alignment="CENTER"> | ||
<children> | ||
<TabPane id="magicTabPane" fx:id="tabPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" tabClosingPolicy="ALL_TABS" AnchorPane.bottomAnchor="1.0" AnchorPane.leftAnchor="1.0" AnchorPane.rightAnchor="1.0" AnchorPane.topAnchor="1.0"> | ||
<tabs> | ||
<Tab text="Example1"> | ||
<content> | ||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" /> | ||
</content> | ||
</Tab> | ||
<Tab text="Example2"> | ||
<content> | ||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" /> | ||
</content> | ||
</Tab> | ||
</tabs> | ||
</TabPane> | ||
<JFXButton fx:id="addTab" layoutX="12.0" layoutY="8.0" style="-fx-text-fill: white;" styleClass="arrowButton2" text="+" AnchorPane.leftAnchor="3.0" AnchorPane.topAnchor="0.0"> | ||
<tooltip> | ||
<Tooltip text="New Tab" /> | ||
</tooltip> | ||
</JFXButton> | ||
</children> | ||
<padding> | ||
<Insets top="3.0" /> | ||
</padding> | ||
</AnchorPane> | ||
</center> | ||
<padding> | ||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" /> | ||
</padding> | ||
</fx:root> |
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,137 @@ | ||
/* | ||
* This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
Also(warning!): | ||
1)You are not allowed to sell this product to third party. | ||
2)You can't change license and made it like you are the owner,author etc. | ||
3)All redistributions of source code files must contain all copyright | ||
notices that are currently in this file, and this list of conditions without | ||
modification. | ||
*/ | ||
|
||
|
||
|
||
package application; | ||
|
||
import java.io.IOException; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
import com.jfoenix.controls.JFXButton; | ||
import com.jfoenix.controls.JFXDialog; | ||
|
||
import javafx.fxml.FXML; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.control.Alert; | ||
import javafx.scene.control.Alert.AlertType; | ||
import javafx.scene.control.Tab; | ||
import javafx.scene.control.TabPane; | ||
import javafx.scene.layout.BorderPane; | ||
|
||
/** | ||
* @author GOXR3PLUS | ||
* | ||
*/ | ||
public class WebBrowserController extends BorderPane { | ||
|
||
/** The logger. */ | ||
private final Logger logger = Logger.getLogger(getClass().getName()); | ||
|
||
//------------------------------------------------------------ | ||
|
||
@FXML | ||
private TabPane tabPane; | ||
|
||
@FXML | ||
private JFXButton addTab; | ||
|
||
// ------------------------------------------------------------- | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
public WebBrowserController() { | ||
// ------------------------------------FXMLLOADER ---------------------------------------- | ||
FXMLLoader loader = new FXMLLoader(getClass().getResource("WebBrowserController.fxml")); | ||
loader.setController(this); | ||
loader.setRoot(this); | ||
|
||
try { | ||
loader.load(); | ||
} catch (IOException ex) { | ||
logger.log(Level.SEVERE, "", ex); | ||
} | ||
} | ||
|
||
/** | ||
* Called as soon as .fxml is initialized [[SuppressWarningsSpartan]] | ||
*/ | ||
@FXML | ||
private void initialize() { | ||
|
||
//tabPane | ||
tabPane.getTabs().clear(); | ||
createNewTab("coz"); | ||
|
||
//addTab | ||
addTab.setOnAction(a -> { | ||
|
||
//Check tabs number | ||
if (tabPane.getTabs().size() >= 8) { | ||
JFXDialog dialog = new JFXDialog(); | ||
//Show Message | ||
Alert alert = new Alert(AlertType.WARNING, | ||
"Currently only 8 tabs are allowed , for performance reasons... \n\n If you can hack it without decompiling the code i will give you 5$ dollars via paypal ;)"); | ||
alert.showAndWait(); | ||
|
||
return; | ||
} | ||
|
||
//Create | ||
createNewTab(); | ||
}); | ||
|
||
} | ||
|
||
/** | ||
* Creates a new tab for the webbrowser ->Directing to a specific website [[SuppressWarningsSpartan]] | ||
* | ||
* @param webSite | ||
*/ | ||
public void createNewTab(String... webSite) { | ||
//Add new Tab | ||
Tab tab = new Tab(""); | ||
WebBrowserTabController webBrowserTab = new WebBrowserTabController(tab,webSite.length==0?null:webSite[0]); | ||
tab.setOnCloseRequest(c -> { | ||
|
||
//Check the tabs number | ||
if (tabPane.getTabs().size() == 1) | ||
createNewTab(); | ||
|
||
// Delete cache for navigate back | ||
webBrowserTab.webEngine.load("about:blank"); | ||
|
||
//Delete cookies Experimental!!! | ||
//java.net.CookieHandler.setDefault(new java.net.CookieManager()) | ||
|
||
}); | ||
|
||
//Add the tab | ||
tabPane.getTabs().add(tab); | ||
//System.out.println(Arrays.asList(webSite)) | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.