package rainbowPackage;//www.RainbowFirm.com's Rainbow Software For Developing Variated Rainbow/Custom-Color Videos, Pictures, And Browsing

import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Parent;
import javafx.stage.*;
import javafx.stage.StageStyle;
import javafx.scene.input.*;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import java.net.URL;
import java.net.URI;
import java.io.IOException;

public class RainbowMainBody extends Application
{
	public void start(Stage zeroStage) throws Exception, IOException
	{
		//Thread zeroThread = new Thread();//(() -> {
		URL zeroURL = URI.create("file:///C:/Dev/RainbowFirm/RainbowSoft/rainbowPackage/3Dfxml/View3D.fxml").toURL();
		FXMLLoader zeroLoader = new FXMLLoader(zeroURL);
		System.out.println("zeroLoader URL: " + zeroLoader.getLocation());
		//if (zeroLoader == null) {
		//	throw new RuntimeException("Could not find " + zeroLoader.toString()); }
		Parent zeroRoot = zeroLoader.load();
		System.out.println("zeroRoot: " + zeroRoot);
		//if (zeroRoot == null) {
		//	throw new RuntimeException("Could not find " + zeroRoot.toString()); }
		/*zeroStage.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
		{
			public void handle(MouseEvent event) 
			{
				System.exit(0);
			}
		});// */
		zeroStage.initStyle(StageStyle.UNDECORATED);
		try { Thread.sleep(400); }//zeroThread.sleep(400);
		catch (InterruptedException exc) { throw new Error("Unexpected interruption", exc); }
		// Update text on FX Application Thread:
		/*stage.addEventHandler(KeyEvent.KEY_RELEASED, (KeyEvent event) -> {
	        if (KeyCode.ESCAPE == event.getCode()) {
	            stage.close();
	        }
	    });//*/
		/*stage.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
			public void handle(KeyEvent event) {
				if (changeHotkey) {
					if (addHotkey(event, changeHotkeyFunction)) {
						changeHotkey = false;
					}
				}
			}
		});//*/

		Platform.runLater(new Runnable() {
			public void run()
			{
				//@Override
				zeroStage.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
				{
					@Override
					public void handle(MouseEvent event) 
					{
						System.exit(0);
					}
				});//

				//try { onKeyPressed (KeyEvent); }
				//catch(IOException ie) { ie.printStackTrace(); }
				try { RainbowSetup.Setup(zeroStage, /*zeroThread,*/ zeroRoot ); }
				catch(IOException ie) { ie.printStackTrace(); }
				catch (Exception e)
				{
					if (e.getCause().getClass().equals(AssertionError.class))
					{
						e.getCause().printStackTrace();
					} else
					{
						e.getCause().printStackTrace();
						// handle the rest of the world exception 
					}
				}
			}
		}); // */
		//zeroThread.setDaemon(true);
		//zeroThread.start();
	}
	public static void main(String[] args)
	{
		/*args.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
	    {
	        public void handle(MouseEvent event) 
	        {
	            System.exit(0);
	        }
	    });// */
		try {
			launch(args);
		} catch (Exception e) {
			if (e.getCause().getClass().equals(AssertionError.class)) {
				e.getCause().printStackTrace();
			} else {
				e.getCause().printStackTrace();
				// handle the rest of the world exception 
			}
		}
	}

	//Stage zeroStage;
	
	/* RainbowMainBody.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
    {
        public void handle(MouseEvent event) 
        {
            System.exit(0);
        }
    });// */
	//@Override
	
	
	//@Override
	/*public void onKeyPressed(KeyEvent SecondEvent) {
		if (SecondEvent.getKeyCode() == KeyCode.ESCAPE.hashCode()) {
			System.exit(0);
		}
	}// */
	/*public static void main(String[] args) {
        try {
            launch(args);
        } catch (Exception e) {
            if (e.getCause().getClass().equals(AssertionError.class)) {
                e.getCause().printStackTrace();
            } else {
                e.getCause().printStackTrace();
                // handle the rest of the world exception 
            }
        }
    }// */
}

//import java.awt.Dimension;

//import javafx.application.Application.*;

//import android.graphics.Color;

/*import javafx.scene.*;
import javafx.scene.paint.Paint.*;
import javafx.scene.paint.Color.*;
import javafx.scene.Scene;
import javafx.stage.*; // */
//import javafx.stage.Stage;
//import javafx.scene.input.KeyCombination;
//import javafx.scene.input.KeyCode;
//import javafx.scene.input.KeyEvent;
//import java.awt.event.KeyEvent;
/*import javafx.scene.*;
import javafx.scene.image.*;
//import javafx.scene.input.KeyEvent;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyListener;

import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.scene.SnapshotParameters;

import java.awt.*;
import java.awt.image.*;
//import java.awt.event.ActionEvent;
import java.awt.Dimension;
import java.lang.Object;
import java.io.InputStream;
import java.io.File;
import javax.imageio.ImageIO;//Keep For .png Image Creation */

//import java.nio.ByteBuffer;
//import javafx.scene.input.KeyCode;

/*import javafx.scene.paint.Color;
import javafx.geometry.Rectangle2D;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.KeyCombination;
import javafx.scene.input.KeyCodeCombination;
//import javafx.scene.input.KeyEvent;
import javafx.scene.layout.StackPane;
import javafx.scene.image.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.image.PixelReader;
import javafx.scene.image.PixelWriter;
import javafx.scene.image.WritableImage;
import javafx.scene.image.WritableImage.*;
//import javafx.scene.input.KeyEvent;
//import javafx.scene.layout.VBox;
import javafx.scene.text.*;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.scene.layout.*;
//import javafx.scene.shape.

/import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker;
import javafx.concurrent.Worker.State;

import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker;
import javafx.concurrent.Worker.State;
//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.control.ProgressBar;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

//import java.util.Timer;
//import java.util.TimerTask;
import java.lang.Object.*;
/////import org.apache.commons.io.*;
import java.io.PrintWriter;
import java.io.PrintStream;
import javax.swing.JFileChooser;

//import javafx.stage.DirectoryChooser;
//import javafx.stage.FileChooser;
import javafx.embed.swing.SwingFXUtils;
import javafx.embed.swing.SwingFXUtils.*;
//import org.openqa.selenium.By;
//import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.firefox.FirefoxDriver;
//import com.sun.tools.javac.api.JavacTaskPool.Worker;
//import org.apache.commons.io.FileUtils;
//import org.openqa.selenium.OutputType;
//import org.openqa.selenium.TakesScreenshot;
import java.io.*;
import org.jcodec.api.SequenceEncoder;
import org.jcodec.api.SequenceEncoder.*;
import org.jcodec.api.awt.AWTSequenceEncoder;
import org.jcodec.common.Codec;
import org.jcodec.common.Format;
import org.jcodec.common.io.NIOUtils;
import org.jcodec.common.io.SeekableByteChannel;
import org.jcodec.common.model.Rational;
import org.jcodec.scale.AWTUtil;
import org.jcodec.api.*;
import java.nio.channels.*;// */
//import java.nio.channels.SeekableByteChannel;
//import org.jcodec.*;//Keep For .mp4 Video Creation

//www.allaviacad.com Owns
//www.freeworldalliance.org Which Operates
//www.rainbowfirm.com Which Provides
//RainbowSoft(R) For The Pixies To Use And Control In Their Local Area Under The Angels Of The
//www.orderofmagi.com Who Protect The
//rainbowPackage Where It All Is,
//main Starts Application
//RainbowMainBody Extends Application To Begin
//start Which Starts Threading
//Which Runs Setup
//Which Begins Engine To Deploy
//RainbodSoft2D Which Maintains Loop Of
//RainbowVideo.java Which Accesses
//RainbowColorCodeSchemes.java For Frames
//Which Uses RainbowSoftColorCodes.java Of
//RainbowSoftColorCode.java Codes Of
//VibrantColors.java Class To Configure Where Patterns Are Displayed Through Accessing
//RainbowPattern2D.java For Each Rainbow/Custom Pattern, Which Accesses
//RainbowSoftColor.java For Each Rainbow/Custom Color Determination, Which Uses
//ColorSlider.java For Variation Determination Between 2 Of Each Color Points And Can Use
//TranspaerencySlider.java As Well For Transparency Determination At The Same Time, And The
//ColorTooSimilar.java Class Is For Checking To See If 2 Colors Are To Similar For Another Color To Be Displayed Allowing Text To Be Seen Throughout
//RainbowFirm's(R)
//Rainbow Hardware(R) Developments That Make
//RainbowSoft's(R)
//Proprietary Rainbow Software Which With Proper Computational Support And Expertise Makes
//Ideal Variated Rainbow/Custom Videos
//Hard Coded Fluffy Math To Make Fuzzy Science; What Everything Is Based On LezReal World Or Not; Simulated Simy.

/*public class RainbowMainBody {

	public RainbowMainBody() {
		// TODO Auto-generated constructor stub
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}*/



/*package rainbowPackage;

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;


public class Main extends Application {
	@Override
	public void start(Stage primaryStage) {
		try {
			BorderPane root = new BorderPane();
			Scene scene = new Scene(root,400,400);
			scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
			primaryStage.setScene(scene);
			primaryStage.show();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		launch(args);
	}
}// */
