Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package controlepcvolumegtafxiino2;
- import com.mysql.jdbc.Connection;
- import com.mysql.jdbc.PreparedStatement;
- import java.awt.AWTException;
- import java.awt.Robot;
- import java.awt.event.InputEvent;
- import java.awt.event.KeyEvent;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import javafx.application.Application;
- import javafx.application.Platform;
- import javafx.beans.value.ChangeListener;
- import javafx.beans.value.ObservableValue;
- import javafx.collections.FXCollections;
- import javafx.collections.ObservableList;
- import javafx.event.ActionEvent;
- import javafx.event.Event;
- import javafx.event.EventHandler;
- import javafx.geometry.Pos;
- import javafx.scene.Group;
- import javafx.scene.Scene;
- import javafx.scene.control.Alert;
- import javafx.scene.control.Button;
- import javafx.scene.control.ButtonType;
- import javafx.scene.control.CheckBox;
- import javafx.scene.control.ChoiceBox;
- import javafx.scene.control.Label;
- import javafx.scene.control.ListView;
- import javafx.scene.control.Menu;
- import javafx.scene.control.MenuBar;
- import javafx.scene.control.MenuItem;
- import javafx.scene.control.TextField;
- import javafx.scene.input.MouseEvent;
- import javafx.scene.layout.HBox;
- import javafx.scene.layout.StackPane;
- import javafx.scene.layout.VBox;
- import javafx.scene.paint.Color;
- import javafx.scene.text.Font;
- import javafx.scene.text.Text;
- import javafx.scene.web.WebEngine;
- import javafx.scene.web.WebView;
- import javafx.stage.Stage;
- import javafx.stage.WindowEvent;
- import jssc.SerialPort;
- import jssc.SerialPortEvent;
- import jssc.SerialPortEventListener;
- import jssc.SerialPortException;
- import jssc.SerialPortList;
- /**
- *
- * @author tina
- */
- public class ControlePCVolumeGTAFXIINO2 extends Application {
- final Menu menu1 = new Menu("Aplicativo");
- final Menu menu2 = new Menu("Configuração");
- final Menu menu3 = new Menu("Manual");
- final Menu menuitem1 = new Menu("press");
- final Menu menuitem2 = new Menu("press");
- final Menu menuitem3 = new Menu("press");
- MenuBar menuBar = new MenuBar();
- Text lbCodigo = new Text("Codigo: ");
- Text lbComando = new Text("Comando");
- ChoiceBox cbPerfil = new ChoiceBox();
- ChoiceBox cb = new ChoiceBox();
- Button btconect = new Button("Conectar");
- //scene3//
- Stage stage = new Stage();
- Group gp = new Group();
- Scene scene = new Scene(gp, 400, 400, Color.SILVER);
- // scene2
- Stage stage2 = new Stage();
- Group gp2 = new Group();
- Scene scene2 = new Scene(gp2, 400, 400, Color.SILVER);
- //scene3
- Stage stage3 = new Stage();
- Group gp3 = new Group();
- Scene scene3 = new Scene(gp3, 400, 400, Color.SILVER);
- //create perfil
- Stage stageNewP = new Stage();
- Group gpNewP = new Group();
- Scene sceneNewP = new Scene(gpNewP, 400, 400, Color.SILVER);
- //code receiver
- TextField tfp11 = new TextField();//receiver de comandos
- //code controle
- TextField tfp0 = new TextField("");//receiver de perfil de controles
- //code de tecla wdsa
- TextField tfp1 = new TextField();//start
- TextField tfp2 = new TextField();//cima
- TextField tfp3 = new TextField();//direita
- TextField tfp4 = new TextField();//baixo
- TextField tfp5 = new TextField();//esquerda
- TextField tfp6 = new TextField();//azul
- TextField tfp7 = new TextField();//verde
- TextField tfp8 = new TextField();//amarelo
- TextField tfp9 = new TextField();//vermelho
- //contorle convencional adcional power
- TextField tfp20 = new TextField("");//power
- //code select
- TextField tfp21 = new TextField();//select
- TextField tfpmenu = new TextField();//menu
- TextField tfpok = new TextField();//ok
- TextField tfpvolumemais = new TextField();//ovolume +
- TextField tfpvolumemenos = new TextField();//Volume-
- //code 1a0
- TextField tfp22 = new TextField();//tec1
- TextField tfp23 = new TextField();//tec2
- TextField tfp24 = new TextField();//tec3
- TextField tfp25 = new TextField();//tec4
- TextField tfp26 = new TextField();//tec5
- TextField tfp27 = new TextField();//tec6
- TextField tfp28 = new TextField();//tec7
- TextField tfp29 = new TextField();//tec8
- TextField tfp30 = new TextField();//tec9
- TextField tfp31 = new TextField();//tec0
- // mouse
- TextField tfp32 = new TextField();//mouse move cima +1
- TextField tfp33 = new TextField();//mouse move Baixo +1
- TextField tfp34 = new TextField();//mouse move direita +1
- TextField tfp35 = new TextField();//mouse move esquerda +1
- TextField tfp36 = new TextField();//mouseClickesquerda
- TextField tfp37 = new TextField();//mouseClickDireita
- TextField tfp38 = new TextField();//mouse segurar
- //1conexao
- String url = "jdbc:mysql://localhost/codigosir";
- Connection conexao;
- PreparedStatement pesquisa;
- PreparedStatement excluir;
- PreparedStatement inputdatas;
- ResultSet resultadoPesquisa;
- String vllistviewclear;
- String strvalueclear;
- //exluir perfil
- Stage stageclear = new Stage();
- Group gpclear = new Group();
- Scene sceneclear = new Scene(gpclear, 400, 400, Color.SILVER);
- ObservableList<String> names = FXCollections.observableArrayList("");
- ListView<String> listViewclear = new ListView<String>(names);
- Button btapagarclear = new Button("apagar perfil");
- //serial portas
- SerialPort serialport;
- String input;
- String strcontrole;
- String strstart;
- String strcima;
- String strdireita;
- String strbaixo;
- String stresquerda;
- String strazul;
- String strgren;
- String stryellow;
- String strred;
- //mode IR this comands
- String strpower;
- String strselect;
- String strmenu;
- String strok;
- String strvolumemais;
- String strvolumemenos;
- String strtec1;
- String strtec2;
- String strtec3;
- String strtec4;
- String strtec5;
- String strtec6;
- String strtec7;
- String strtec8;
- String strtec9;
- String strtec0;
- //mode mouse teclas e açoes de mouse
- String strmousecima;
- String strmousebaixo;
- String strmousedireita;
- String strmouseesquerda;
- String strmouseclickesquerda;
- String strmouseclickdireita;
- String strmousepress;
- //serial portas mysql modegamecar
- PreparedStatement correnteDepesquisa;
- String Rstrcontrole;
- String Rstrstart;
- String Rstrcima;
- String Rstrdireita;
- String Rstrbaixo;
- String Rstresquerda;
- String Rstrazul;
- String Rstrgren;
- String Rstryellow;
- String Rstrred;
- //mode IR this comands
- String Rstrpower;
- String Rstrselect;
- String Rstrmenu;
- String Rstrok;
- String Rstrvolumemais;
- String Rstrvolumemenos;
- String Rstrtec1;
- String Rstrtec2;
- String Rstrtec3;
- String Rstrtec4;
- String Rstrtec5;
- String Rstrtec6;
- String Rstrtec7;
- String Rstrtec8;
- String Rstrtec9;
- String Rstrtec0;
- //mode mouse teclas e açoes de mouse
- String Rstrmousecima;
- String Rstrmousebaixo;
- String Rstrmousedireita;
- String Rstrmouseesquerda;
- String Rstrmouseclickesquerda;
- String Rstrmouseclickdireita;
- String Rstrmousepress;
- //mouse açoes
- String vlactions = "";
- int Cima = 500;
- int Direita = 500;
- //String ;
- public void engnerPortConection() {
- final String[] serialPortasNomes = SerialPortList.getPortNames();
- for (String nomeportas : serialPortasNomes) {
- cb.getItems().addAll("" + nomeportas);
- System.out.println(" porta" + nomeportas);
- }
- }
- //comunicaçao jssc
- public void confirmmysql() {
- try {
- conexao = (Connection) DriverManager.getConnection(url, "root", "");
- pesquisa = (PreparedStatement) conexao.prepareStatement("SELECT * FROM comandoir");
- inputdatas = (PreparedStatement) conexao.prepareStatement(
- "insert into comandoir(controle , start , cima , direita , baixo , esquerda , azul, gren , yellow , red ,"
- + " power , selects , menu , ok , volumemais , volumemenos ,"
- + " tec1 , tec2 , tec3 , tec4 , tec5 , tec6 , tec7 , tec8 , tec9 , tec0 ,"
- + " mousecima , mousebaixo , mousedireita , mouseesquerda , mouseclickdireita , mouseclickesquerda , mousepress "
- + ") values"
- + "(\"" + tfp0.getText().toString() + "\",\"" + tfp1.getText().toString() + "\",\"" + tfp2.getText().toString()
- + "\",\"" + tfp3.getText().toString() + "\",\"" + tfp4.getText().toString() + "\",\"" + tfp5.getText().toString()
- + "\",\"" + tfp6.getText().toString() + "\",\"" + tfp7.getText().toString() + "\",\"" + tfp8.getText().toString()
- + "\",\"" + tfp9.getText().toString() + "\",\"" + tfp20.getText().toString() + "\",\"" + tfp21.getText().toString()
- + "\",\"" + tfpmenu.getText().toString() + "\",\"" + tfpok.getText().toString() + "\",\"" + tfpvolumemais.getText().toString() + "\",\"" + tfpvolumemenos.getText().toString()
- + "\",\"" + tfp22.getText().toString() + "\",\"" + tfp23.getText().toString() + "\",\"" + tfp24.getText().toString()
- + "\",\"" + tfp25.getText().toString() + "\",\"" + tfp26.getText().toString() + "\",\"" + tfp27.getText().toString()
- + "\",\"" + tfp28.getText().toString() + "\",\"" + tfp29.getText().toString() + "\",\"" + tfp30.getText().toString() + "\",\"" + tfp31.getText().toString()
- + "\",\"" + tfp32.getText().toString() + "\",\"" + tfp33.getText().toString() + "\",\"" + tfp34.getText().toString()
- + "\",\"" + tfp35.getText().toString() + "\",\"" + tfp36.getText().toString() + "\",\"" + tfp37.getText().toString()
- + "\",\"" + tfp38.getText().toString()
- + "\");"
- );
- } catch (SQLException ex) {
- System.out.println("servidor desconectado ou off");
- }
- }
- public void conexaosql() {
- int cont1 = 0;
- try {
- confirmmysql();
- resultadoPesquisa = pesquisa.executeQuery();
- while (resultadoPesquisa.next()) {
- cont1++;
- strcontrole = "" + resultadoPesquisa.getString("controle");
- strstart = "" + resultadoPesquisa.getString("start");
- strcima = "" + resultadoPesquisa.getString("cima");
- strdireita = "" + resultadoPesquisa.getString("direita");
- strbaixo = "" + resultadoPesquisa.getString("baixo");
- stresquerda = "" + resultadoPesquisa.getString("esquerda");
- strazul = "" + resultadoPesquisa.getString("azul");
- strgren = "" + resultadoPesquisa.getString("gren");
- stryellow = "" + resultadoPesquisa.getString("yellow");
- strred = "" + resultadoPesquisa.getString("red");
- //implementaçao todos contoles e comandos IR
- strpower = resultadoPesquisa.getString("power");
- strselect = resultadoPesquisa.getString("selects");
- strmenu = resultadoPesquisa.getString("menu");
- strok = resultadoPesquisa.getString("ok");
- strvolumemais = resultadoPesquisa.getString("volumemais");
- strvolumemenos = resultadoPesquisa.getString("volumemenos");
- strtec1 = resultadoPesquisa.getString("tec1");;
- strtec2 = resultadoPesquisa.getString("tec2");
- strtec3 = resultadoPesquisa.getString("tec3");
- strtec4 = resultadoPesquisa.getString("tec4");
- strtec5 = resultadoPesquisa.getString("tec5");
- strtec6 = resultadoPesquisa.getString("tec6");
- strtec7 = resultadoPesquisa.getString("tec7");
- strtec8 = resultadoPesquisa.getString("tec8");
- strtec9 = resultadoPesquisa.getString("tec9");
- strtec0 = resultadoPesquisa.getString("tec0");
- //mode mouse teclas e açoes de mouse
- strmousecima = resultadoPesquisa.getString("mousecima");
- strmousebaixo = resultadoPesquisa.getString("mousebaixo");
- strmousedireita = resultadoPesquisa.getString("mousedireita");
- strmouseesquerda = resultadoPesquisa.getString("mouseesquerda");
- strmouseclickesquerda = resultadoPesquisa.getString("mouseclickesquerda");
- strmouseclickdireita = resultadoPesquisa.getString("mouseclickdireita");
- strmousepress = resultadoPesquisa.getString("mousepress");
- System.out.println("Pesquisa de codigos IR no banco de dados \'codigos\' "
- + "-controle=" + strcontrole + "\n"
- + "-----Start=" + strstart + "\n"
- + "-----Cima=" + strcima + "\n"
- + "-----Direita=" + strdireita + "\n"
- + "-----Baixo=" + strbaixo + "\n"
- + "-----Esquerda=" + stresquerda + "\n"
- + "-----Azul=" + strazul + "\n"
- + "-----Gren=" + strgren + "\n"
- + "-----Yellow=" + stryellow + "\n"
- + "-----Red=" + strred + "\n"
- + "-----Power" + strpower + "\n"
- + "-----menu" + strmenu + "\n"
- + "-----ok" + strok + "\n"
- + "-----volumemais" + strvolumemais + "\n"
- + "-----volumemenos" + strvolumemenos + "\n"
- + "-----tecla 1" + strtec1 + "\n"
- + "-----tecla 2" + strtec2 + "\n"
- + "-----tecla 3" + strtec3 + "\n"
- + "-----tecla 4" + strtec4 + "\n"
- + "-----tecla 5" + strtec5 + "\n"
- + "-----tecla 6" + strtec6 + "\n"
- + "-----tecla 7" + strtec7 + "\n"
- + "-----tecla 8" + strtec8 + "\n"
- + "-----tecla 9" + strtec9 + "\n"
- + "-----tecla 0" + strtec0 + "\n"
- //mode mouse teclas e açoes de mouse
- + "-----mousecima" + strmousecima + "\n"
- + "-----mousebaixo" + strmousebaixo + "\n"
- + "-----mousedireita" + strmousedireita + "\n"
- + "-----mouseesquerda" + strmouseesquerda + "\n"
- + "-----mouseclickesquerda" + strmouseclickesquerda + "\n"
- + "-----mouseclickdireita" + strmouseclickdireita + "\n"
- + "-----mouseclickpress" + strmousepress + "\n"
- );
- names.addAll("" + strcontrole);
- cbPerfil.getItems().addAll("" + strcontrole);
- }
- } catch (SQLException ex) {
- Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- public void menusitens() {
- menuBar.getMenus().addAll(menu1, menu2, menu3);
- menu1.getItems().addAll(menuitem1);
- menu2.getItems().addAll(menuitem2);
- menu3.getItems().addAll(menuitem3);
- menuBar.prefWidthProperty().bind(scene.widthProperty());
- menuitem1.setOnAction(new EventHandler<ActionEvent>() {
- @Override
- public void handle(ActionEvent event) {
- System.out.println("evento1");
- stage.setTitle("Controle PC Volume v.GTAS.A---Conexoes");
- mn1();
- }
- });
- menuitem2.setOnAction(new EventHandler<ActionEvent>() {
- @Override
- public void handle(ActionEvent event) {
- System.out.println("evento2");
- stage.setTitle("Controle PC Volume v.GTAS.A---Configurações");
- mn2();
- }
- });
- menuitem3.setOnAction(new EventHandler<ActionEvent>() {
- @Override
- public void handle(ActionEvent event) {
- mn3();
- System.out.println("event3");
- stage.setTitle("Controle PC Volume v.GTAS.A---Manual de instrução");
- }
- });
- }
- public void mn1() {
- stage.setScene(scene);
- gp.getChildren().addAll(menuBar);
- VBox vb1 = new VBox(10);
- vb1.layoutYProperty().bind(menuBar.heightProperty().add(5));
- vb1.layoutXProperty().bind(scene.widthProperty().divide(9.5));
- Label lbaplicativo = new Label("APlicativo");
- vb1.getChildren().add(lbaplicativo);
- gp.getChildren().add(vb1);
- VBox vbaplicativo = new VBox(5);
- vb1.getChildren().add(vbaplicativo);
- String strcodigo, strcomando;
- HBox hbportconection = new HBox(10);
- hbportconection.getChildren().addAll(btconect, cb);
- vb1.getChildren().addAll(lbCodigo, lbComando, hbportconection);
- btconect.setOnMouseClicked(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- try {
- if (cbPerfil.valueProperty().getValue().toString().length() >= 1) {
- System.out.println("Perfil Escolhido " + cbPerfil.getValue().toString());
- try {
- if (cb.valueProperty().getValue().toString().length() >= 1) {
- System.out.println("POrta escolhida " + cb.getValue().toString());
- serialport = new SerialPort(cb.getValue().toString());
- try {
- serialport.openPort();
- serialport.setParams(9600, 8, 1, 0);
- serialport.setEventsMask(SerialPort.MASK_RXCHAR);
- System.out.println("conectado");
- } catch (SerialPortException ex) {
- Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- if (serialport.isOpened() == true) {
- btconect.setText("Desconectar");
- } else {
- btconect.setText("Conectar");
- }
- try {
- serialport.addEventListener(new SerialPortEventListener() {
- @Override
- public void serialEvent(SerialPortEvent serialPortEvent) {
- try {
- input = serialport.readString(serialPortEvent.getEventValue());
- if (serialPortEvent.isRXCHAR()) {
- if (input.endsWith("\r\n")) {
- // System.out.print("Code:");
- System.out.println("" + input.substring(0, input.indexOf("\r\n")));
- // System.out.println("" + input.endsWith("\r\n"));
- lbCodigo.setText("Codigo: " + input.substring(0, input.indexOf("\r\n")));
- // lbCodigo.setText(""+vlCode.toString());
- String vlx = input.substring(0, input.indexOf("\r\n"));
- tfp11.setText("" + vlx);
- ///retorno de code ir
- System.out.println("valore recebido" + vlx);
- System.out.println("comparando valores");
- if (vlx.equals(Rstrcima)) {
- System.out.println("cima =" + Rstrcima);
- lbComando.setText("Comando: Cima");
- Robot robot;
- try {
- vlactions = "Cima";
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_W);
- robot.delay(450);
- robot.keyRelease(KeyEvent.VK_W);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }//
- } else if (vlx.equals(Rstrbaixo)) {
- vlactions = "Baixo";
- System.out.println("Baixo" + Rstrbaixo);
- lbComando.setText("Comando: Baixo");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_S);
- robot.delay(500);
- robot.keyRelease(KeyEvent.VK_S);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }//
- } else if (vlx.equals(Rstrdireita)) {
- vlactions = "Direita";
- System.out.println("Direita" + Rstrdireita);
- lbComando.setText("Comando: direita");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_D);
- robot.delay(220);
- robot.keyRelease(KeyEvent.VK_D);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }//
- } else if (vlx.equals(Rstresquerda)) {
- vlactions = "Esquerda";
- System.out.println("Esquerda" + Rstresquerda);
- lbComando.setText("Comando: Esquerda");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_A);
- robot.delay(220);
- robot.keyRelease(KeyEvent.VK_A);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }//
- } //retorno de caracter 0=4294967295
- else if (vlx.equals("4294967295") && "Cima".equals(vlactions)) {
- System.out.println("retorno de caracter:" + vlactions);
- Robot robot = new Robot();
- robot.keyPress(KeyEvent.VK_W);
- robot.delay(450);
- robot.keyRelease(KeyEvent.VK_W);
- } else if (vlx.equals("4294967295") && "Baixo".equals(vlactions)) {
- System.out.println("retorno de caracter:" + vlactions.toString());
- Robot robot = new Robot();
- robot.keyPress(KeyEvent.VK_S);
- robot.delay(450);
- robot.keyRelease(KeyEvent.VK_S);
- } else if (vlx.equals("4294967295") && "Esquerda".equals(vlactions)) {
- System.out.println("retorno de caracter:" + vlactions.toString());
- Robot robot = new Robot();
- robot.keyPress(KeyEvent.VK_A);
- robot.delay(220);
- robot.keyRelease(KeyEvent.VK_A);
- } else if (vlx.equals("4294967295") && "Direita".equals(vlactions)) {
- System.out.println("retorno de caracter:" + vlactions.toString());
- Robot robot = new Robot();
- robot.keyPress(KeyEvent.VK_D);
- robot.delay(220);
- robot.keyRelease(KeyEvent.VK_D);
- } else if (vlx.equals(Rstrazul)) {
- System.out.println("Azul" + Rstrazul);
- lbComando.setText("Comando: azul");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_Q);
- robot.keyPress(KeyEvent.VK_E);
- robot.delay(1600);
- robot.keyRelease(KeyEvent.VK_E);
- robot.keyRelease(KeyEvent.VK_Q);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }//
- }
- else if (vlx.equals(Rstrgren)) {
- System.out.println("GREN" + strgren);
- lbComando.setText("Comando: Gren");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_CONTROL);
- robot.delay(1010);
- robot.keyRelease(KeyEvent.VK_CONTROL);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- } else if (vlx.equals(stryellow)) {
- System.out.println("Yellow" + stryellow);
- lbComando.setText("Comando: Yellow");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_SPACE);
- robot.delay(1010);
- robot.keyRelease(KeyEvent.VK_SPACE);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- } else if (vlx.equals(strred)) {
- System.out.println("Red" + strred);
- lbComando.setText("Comando: Red");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_ENTER);
- robot.delay(500);
- robot.keyRelease(KeyEvent.VK_ENTER);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }//
- }
- else if (vlx.equals(Rstrstart)) {
- System.out.println("Start");
- lbComando.setText("Comando: Start");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_ESCAPE);
- robot.delay(500);
- robot.keyRelease(KeyEvent.VK_ESCAPE);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- else if (vlx.equals(Rstrpower)) {
- System.out.println("Power");
- lbComando.setText("Comando: Power");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_CONTROL);
- robot.keyPress(KeyEvent.VK_ALT);
- //corrigir
- robot.delay(1000);
- robot.keyRelease(KeyEvent.VK_CONTROL);
- robot.keyRelease(KeyEvent.VK_ALT);
- robot.keyRelease(KeyEvent.VK_DELETE);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- else if (vlx.equals(Rstrselect)) {
- System.out.println("selectis");
- lbComando.setText("Comando: selects");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_ESCAPE);
- robot.delay(500);
- robot.keyRelease(KeyEvent.VK_ESCAPE);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- else if (vlx.equals(Rstrmenu)) {
- System.out.println("Menu");
- lbComando.setText("Comando: Menu opçoes");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_WINDOWS);
- robot.delay(500);
- robot.keyRelease(KeyEvent.VK_WINDOWS);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- else if (vlx.equals(Rstrok)) {
- System.out.println("OK");
- lbComando.setText("Comando: OK");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_ENTER);
- robot.delay(500);
- robot.keyRelease(KeyEvent.VK_ENTER);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- else if (vlx.equals(Rstrvolumemais)) {
- System.out.println("Volume mais");
- lbComando.setText("Comando: Volume+");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_DEAD_VOICED_SOUND);
- robot.delay(500);
- robot.keyRelease(KeyEvent.VK_DEAD_SEMIVOICED_SOUND);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- else if (vlx.equals(Rstrvolumemenos)) {
- System.out.println("Volume nenos");
- lbComando.setText("Comando: Volume -");
- Robot robot;
- try {
- robot = new Robot();
- robot.keyPress(KeyEvent.VK_ESCAPE);
- robot.delay(500);
- robot.keyRelease(KeyEvent.VK_ESCAPE);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }//eventos de mouses
- else if (vlx.equals(Rstrmousecima)) {
- System.out.println("Mouse Cima");
- lbComando.setText("Comando: Evento move Cima");
- vlactions = "mCima";
- Cima = Cima - 10;
- try {
- Robot rb = new Robot();
- rb.mouseMove(Direita, Cima);
- } catch (AWTException ex) {
- //Logger.getLogger(JFXControleArduinoPCvolume.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- else if (vlx.equals(Rstrmousebaixo)) {
- System.out.println("Caomando Baixo");
- lbComando.setText("Comando: mouse event Baixo");
- vlactions = "mBaixo";
- Cima = Cima + 10;
- try {
- Robot rb = new Robot();
- rb.mouseMove(Direita, Cima);
- } catch (AWTException ex) {
- // Logger.getLogger(JFXControleArduinoPCvolume.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- else if (vlx.equals(Rstrmousedireita)) {
- System.out.println("mouse event direira");
- lbComando.setText("Comando: Mouse event direita");
- vlactions = "mDireita";
- Direita = Direita + 10;
- try {
- Robot rb = new Robot();
- rb.mouseMove(Direita, Cima); //layouttx ,layoutY
- } catch (AWTException ex) {
- //Logger.getLogger(JFXControleArduinoPCvolume.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- else if (vlx.equals(Rstrmouseesquerda)) {
- System.out.println("MouseeventEsquerda");
- lbComando.setText("Comando: mouse event esquerda");
- vlactions = "mEsquerda";
- Direita = Direita - 10;
- try {
- Robot rb = new Robot();
- rb.mouseMove(Direita, Cima); //layouttx ,layoutY
- } catch (AWTException ex) {
- //Logger.getLogger(JFXControleArduinoPCvolume.class.getName()).log(Level.SEVERE, null, ex);
- }
- } //caracter 0=4294967295
- else if (vlx.equals("4294967295") && "mCima".equals(vlactions)) {
- System.out.println("retorno de caracter:" + vlactions);
- Cima = Cima - 15;
- Robot robot = new Robot();
- robot.mouseMove(Direita, Cima);
- } else if (vlx.equals("4294967295") && "mBaixo".equals(vlactions)) {
- System.out.println("retorno de caracter:" + vlactions.toString());
- Cima = Cima + 15;
- Robot robot = new Robot();
- robot.mouseMove(Direita, Cima);
- } else if (vlx.equals("4294967295") && "mEsquerda".equals(vlactions)) {
- System.out.println("retorno de caracter:" + vlactions.toString());
- Direita = Direita - 15;
- Robot robot = new Robot();
- robot.mouseMove(Direita, Cima);
- } else if (vlx.equals("4294967295") && "mDireita".equals(vlactions)) {
- System.out.println("retorno de caracter:" + vlactions.toString());
- Direita = Direita + 15;
- Robot robot = new Robot();
- robot.mouseMove(Direita, Cima);
- } else if (vlx.equals(Rstrmouseclickdireita)) {
- System.out.println("mouse Eventodireita");
- lbComando.setText("Comando: click direitaa");
- Robot robot;
- try {
- Robot rb = new Robot();
- //layouttx ,layoutY
- rb.mousePress(InputEvent.BUTTON1_MASK);
- rb.mouseRelease(InputEvent.BUTTON1_MASK);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- else if (vlx.equals(Rstrmouseclickesquerda)) {
- System.out.println("mouse esquerda");
- lbComando.setText("Comando: click esquerda");
- Robot robot;
- try {
- Robot rb = new Robot();
- //layouttx ,layoutY
- rb.mousePress(InputEvent.BUTTON2_MASK);
- rb.mouseRelease(InputEvent.BUTTON2_MASK);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- else if (vlx.equals(Rstrmousepress)) {
- System.out.println("Start");
- lbComando.setText("click de preçao");
- Robot robot;
- try {
- Robot rb = new Robot();
- //layouttx ,layoutY
- rb.mousePress(InputEvent.BUTTON3_MASK);
- rb.mouseRelease(InputEvent.BUTTON3_MASK);
- } catch (AWTException ex) {
- // Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- //... tec1.....a tec9
- }
- //else{System.out.println("codigo diferente"); }
- }
- }
- } catch (SerialPortException ex) {
- System.err.println("error : Sem porta de conexao escolhida");
- } catch (AWTException ex) {
- Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- });
- } catch (SerialPortException ex) {
- System.out.println(".handle()errprserial123");
- }
- }
- } catch (Exception e) {
- System.out.println("nenhuma porta foi escolhida");
- Alert la = new Alert(Alert.AlertType.INFORMATION, "Nenhuma Porta Escolhida", ButtonType.OK);
- la.show();
- }
- }
- } catch (Exception e) {
- System.out.println("nenhum perfil escolhido\nescolha em configurações");
- Alert la = new Alert(Alert.AlertType.INFORMATION, "Nenhum Perfil Escolhido:\n"
- + "Escolha o Perfil de controles em Configuraçães", ButtonType.OK);
- la.show();
- }
- }
- });
- }
- public void createperfil() {
- Stage stageP = new Stage();
- Group gpP = new Group();
- Scene sceneP = new Scene(gpP, 650, 430, Color.SILVER);
- stageP.setScene(sceneP);
- stageP.setTitle("Controle PC Volume v.GTA S.A-Criar Perfil");
- VBox vbp1 = new VBox(15);
- Label lbP = new Label("Novo Perfil de Configuraçao IR");
- VBox vbp2 = new VBox(5);
- VBox vbp3 = new VBox(5);
- VBox vbp4 = new VBox(5);
- HBox hbvpx = new HBox();
- hbvpx.getChildren().addAll(vbp2, vbp3, vbp4);
- vbp1.getChildren().addAll(lbP, hbvpx);
- gpP.getChildren().addAll(vbp1);
- HBox hbp0 = new HBox();
- Label lbpx0 = new Label("Controle ");
- tfp0.setPromptText("Marca do Controle");
- hbp0.getChildren().addAll(lbpx0, tfp0);
- HBox hbp1 = new HBox();
- Label lbpx1 = new Label("start____");
- hbp1.getChildren().addAll(lbpx1, tfp1);
- HBox hbp2 = new HBox();
- Label lbpx2 = new Label("cima_____");
- hbp2.getChildren().addAll(lbpx2, tfp2);
- HBox hbp3 = new HBox();
- Label lbpx3 = new Label("direita__");
- hbp3.getChildren().addAll(lbpx3, tfp3);
- HBox hbp4 = new HBox();
- Label lbpx4 = new Label("baixo____");
- hbp4.getChildren().addAll(lbpx4, tfp4);
- HBox hbp5 = new HBox();
- Label lbpx5 = new Label("esquerda_");
- hbp5.getChildren().addAll(lbpx5, tfp5);
- HBox hbp6 = new HBox();
- Label lbpx6 = new Label("azul_____");
- hbp6.getChildren().addAll(lbpx6, tfp6);
- HBox hbp7 = new HBox();
- Label lbpx7 = new Label("gren_____");
- hbp7.getChildren().addAll(lbpx7, tfp7);
- HBox hbp8 = new HBox();
- Label lbpx8 = new Label("yellow__");
- hbp8.getChildren().addAll(lbpx8, tfp8);
- HBox hbp9 = new HBox();
- Label lbpx9 = new Label("red______");
- hbp9.getChildren().addAll(lbpx9, tfp9);
- ////
- HBox hbp20 = new HBox();
- Label lbpx20 = new Label("power ");
- hbp20.getChildren().addAll(lbpx20, tfp20);
- HBox hbp21 = new HBox();
- Label lbpx21 = new Label("selects ");
- hbp21.getChildren().addAll(lbpx21, tfp21);
- HBox hbpmenu = new HBox();
- Label lbpxmenu = new Label("menu ");
- hbpmenu.getChildren().addAll(lbpxmenu, tfpmenu);
- HBox hbpok = new HBox();
- Label lbpxok = new Label("ok ");
- hbpok.getChildren().addAll(lbpxok, tfpok);
- HBox hbpvolumemais = new HBox();
- Label lbpxvolumemais = new Label("Volume+ ");
- hbpvolumemais.getChildren().addAll(lbpxvolumemais, tfpvolumemais);
- HBox hbpvolumemenos = new HBox();
- Label lbpxvolumemenos = new Label("volume - ");
- hbpvolumemenos.getChildren().addAll(lbpxvolumemenos, tfpvolumemenos);
- HBox hbp22 = new HBox();
- Label lbpx22 = new Label("tec.1");
- hbp22.getChildren().addAll(lbpx22, tfp22);
- HBox hbp23 = new HBox();
- Label lbpx23 = new Label("tec.2");
- hbp23.getChildren().addAll(lbpx23, tfp23);
- HBox hbp24 = new HBox();
- Label lbpx24 = new Label("tec.3");
- hbp24.getChildren().addAll(lbpx24, tfp24);
- HBox hbp25 = new HBox();
- Label lbpx25 = new Label("tec.4");
- hbp25.getChildren().addAll(lbpx25, tfp25);
- HBox hbp26 = new HBox();
- Label lbpx26 = new Label("tec.5");
- hbp26.getChildren().addAll(lbpx26, tfp26);
- HBox hbp27 = new HBox();
- Label lbpx27 = new Label("tec.6");
- hbp27.getChildren().addAll(lbpx27, tfp27);
- HBox hbp28 = new HBox();
- Label lbpx28 = new Label("tec7");
- hbp28.getChildren().addAll(lbpx28, tfp28);
- HBox hbp29 = new HBox();
- Label lbpx29 = new Label("tec.8 ");
- hbp29.getChildren().addAll(lbpx29, tfp29);
- HBox hbp30 = new HBox();
- Label lbpx30 = new Label("tec.9 ");
- hbp30.getChildren().addAll(lbpx30, tfp30);
- HBox hbp31 = new HBox();
- Label lbpx31 = new Label("tec.0");
- hbp31.getChildren().addAll(lbpx31, tfp31);
- // mouse eventos
- HBox hbp32 = new HBox();
- Label lbpx32 = new Label("M.Cima");
- hbp32.getChildren().addAll(lbpx32, tfp32);
- HBox hbp33 = new HBox();
- Label lbpx33 = new Label("M.Baixo");
- hbp33.getChildren().addAll(lbpx33, tfp33);
- HBox hbp34 = new HBox();
- Label lbpx34 = new Label("M.Direita");
- hbp34.getChildren().addAll(lbpx34, tfp34);
- HBox hbp35 = new HBox();
- Label lbpx35 = new Label("M.Esquerda");
- hbp35.getChildren().addAll(lbpx35, tfp35);
- HBox hbp36 = new HBox();
- Label lbpx36 = new Label("M.click.Esq");
- hbp36.getChildren().addAll(lbpx36, tfp36);
- HBox hbp37 = new HBox();
- Label lbpx37 = new Label("m.click.Dir");
- hbp37.getChildren().addAll(lbpx37, tfp37);
- HBox hbp38 = new HBox();
- Label lbpx38 = new Label("M.click.Pres");
- hbp38.getChildren().addAll(lbpx38, tfp38);
- HBox hbp10 = new HBox();
- Button btgravarPerfil = new Button("Gravar");
- Button btclearCampo = new Button("limpar");
- hbp10.getChildren().addAll(btgravarPerfil, btclearCampo);
- vbp2.getChildren().addAll(hbp0, hbp1, hbp2, hbp3, hbp4, hbp5, hbp6, hbp7, hbp8, hbp9, hbp10);
- vbp3.getChildren().addAll(hbp20, hbp21, hbpmenu, hbpok, hbpvolumemais, hbpvolumemenos, hbp22, hbp23, hbp24, hbp25, hbp26);
- vbp4.getChildren().addAll(hbp27, hbp28, hbp29, hbp30, hbp31, hbp32, hbp33, hbp34, hbp35, hbp36, hbp37, hbp38);
- HBox hbp11 = new HBox(10);
- Label lbpx11 = new Label("Codigo IR Statico");
- lbpx11.setAlignment(Pos.CENTER);
- hbp11.getChildren().addAll(lbpx11, tfp11);
- vbp1.getChildren().add(hbp11);
- btgravarPerfil.setOnMouseClicked(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- try {
- confirmmysql();
- try {
- inputdatas.executeUpdate();
- System.out.println("controle" + tfp0.getText() + "gravado");
- Alert la = new Alert(Alert.AlertType.INFORMATION, "controle" + tfp0.getText() + "gravado", ButtonType.OK);
- la.show();
- } catch (Exception e) {
- System.out.println("error ao gravar banco de dados 12 caracteres");
- }
- } catch (Exception ex) {
- Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- });
- btclearCampo.setOnMouseClicked(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- tfp0.setText("");
- tfp1.setText("");
- tfp2.setText("");
- tfp3.setText("");
- tfp9.setText("");
- tfp6.setText("");
- tfp5.setText("");
- tfp4.setText("");
- tfp8.setText("");
- tfp7.setText("");
- }
- });
- stageP.show();
- }
- public void clearperfil(){
- try {
- if(vllistviewclear!=""){
- excluir = (PreparedStatement) conexao.prepareStatement("DELETE FROM comandoir WHERE controle =\"" + vllistviewclear + "\";");
- excluir.executeUpdate();
- listViewclear.getItems().remove(vllistviewclear);
- System.out.println("controle ecluido" + vllistviewclear);
- }else {
- System.out.println("nao selecionado no listview");}
- } catch (SQLException ex) {
- System.out.println("nso spsgou odado do bd");
- }
- }
- public void mn2() {
- stage.setScene(scene2);
- gp2.getChildren().addAll(menuBar);
- VBox vbmnc1 = new VBox(10);
- vbmnc1.layoutYProperty().bind(menuBar.heightProperty().add(5));
- vbmnc1.layoutXProperty().bind(scene2.widthProperty().divide(4.5));
- Label lbConfig = new Label("Configuraçoes");
- vbmnc1.getChildren().add(lbConfig);
- gp2.getChildren().add(vbmnc1);
- VBox vbConfig = new VBox(5);
- vbmnc1.getChildren().add(vbConfig);
- CheckBox cbAuto = new CheckBox("Iniciar Automatico");
- cbAuto.setIndeterminate(false);
- vbConfig.getChildren().add(cbAuto);
- HBox hbmn2perfil = new HBox(10);
- vbConfig.getChildren().add(hbmn2perfil);
- cbPerfil.getItems().addAll("Gravação");
- Button btperfil = new Button("Perfil!");
- hbmn2perfil.getChildren().addAll(cbPerfil, btperfil);
- HBox hbmn2optionsperfil = new HBox(10);
- Button btnewPerfil = new Button("Novo Perfil");
- Button btClearPerfil = new Button("Exluir Perfil");
- hbmn2optionsperfil.getChildren().addAll(btnewPerfil, btClearPerfil);
- vbmnc1.getChildren().addAll(hbmn2optionsperfil);
- listViewclear.getSelectionModel().selectedItemProperty().addListener(
- new ChangeListener<String>() {
- public void changed(ObservableValue<? extends String> ov,
- String old_val, String new_val) {
- System.out.println("informe " + new_val);
- vllistviewclear = new_val;
- //pesquisa por listview
- }
- });
- btClearPerfil.setOnMouseClicked(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- stageclear.setScene(sceneclear);
- stageclear.setTitle("Controle PC Volume v.GTAS.A--- Apagar Perfil");
- VBox vbclear = new VBox();
- gpclear.getChildren().add(vbclear);
- Label labelclear = new Label("lista de perfil de controle no BD");
- listViewclear.setPrefSize(200, 300);
- vbclear.getChildren().addAll(labelclear, listViewclear, btapagarclear);
- btapagarclear.setOnAction(new EventHandler<ActionEvent>() {
- @Override
- public void handle(ActionEvent event) {
- clearperfil();
- }
- });
- stageclear.show();
- }
- });
- btnewPerfil.setOnMouseClicked(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- createperfil();
- }
- });
- btperfil.setOnMouseClicked(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- String valuedpervil = cbPerfil.getValue().toString();
- System.out.println("" + valuedpervil);
- try {
- correnteDepesquisa = (PreparedStatement) conexao.prepareStatement("select * from comandoir where controle=\"" + valuedpervil + "\";");
- ResultSet Rstrcorrente = correnteDepesquisa.executeQuery();
- while (Rstrcorrente.next()) {
- //controle gta
- Rstrcontrole = "" + Rstrcorrente.getString("controle");
- Rstrstart = "" + Rstrcorrente.getString("start");
- Rstrcima = "" + Rstrcorrente.getString("cima");
- Rstrdireita = "" + Rstrcorrente.getString("direita");
- Rstrbaixo = "" + Rstrcorrente.getString("baixo");
- Rstresquerda = "" + Rstrcorrente.getString("esquerda");
- Rstrazul = "" + Rstrcorrente.getString("azul");
- Rstrgren = "" + Rstrcorrente.getString("gren");
- Rstryellow = "" + Rstrcorrente.getString("yellow");
- Rstrred = "" + Rstrcorrente.getString("red");
- //implementaçao todos contoles e comandos IR
- Rstrpower = Rstrcorrente.getString("power");;
- Rstrselect = Rstrcorrente.getString("selects");
- Rstrmenu = Rstrcorrente.getString("menu");
- Rstrok = Rstrcorrente.getString("ok");
- Rstrvolumemais = Rstrcorrente.getString("volumemais");
- Rstrvolumemenos = Rstrcorrente.getString("volumemenos");
- Rstrtec1 = Rstrcorrente.getString("tec1");;
- Rstrtec2 = Rstrcorrente.getString("tec2");
- Rstrtec3 = Rstrcorrente.getString("tec3");
- Rstrtec4 = Rstrcorrente.getString("tec4");
- Rstrtec5 = Rstrcorrente.getString("tec5");
- Rstrtec6 = Rstrcorrente.getString("tec6");
- Rstrtec7 = Rstrcorrente.getString("tec7");
- Rstrtec8 = Rstrcorrente.getString("tec8");
- Rstrtec9 = Rstrcorrente.getString("tec9");
- Rstrtec0 = Rstrcorrente.getString("tec0");
- //mode mouse teclas e açoes de mouse
- Rstrmousecima = Rstrcorrente.getString("mousecima");
- Rstrmousebaixo = Rstrcorrente.getString("mousebaixo");
- Rstrmousedireita = Rstrcorrente.getString("mousedireita");
- Rstrmouseesquerda = Rstrcorrente.getString("mouseesquerda");
- Rstrmouseclickesquerda = Rstrcorrente.getString("mouseclickesquerda");
- Rstrmouseclickdireita = Rstrcorrente.getString("mouseclickdireita");
- Rstrmousepress = Rstrcorrente.getString("mousepress");
- System.out.println("Pesquisa de codigos IR no banco de dados \'codigos\' "
- + "-controle=" + Rstrcontrole + "\n"
- + "-----Start=" + Rstrstart + "\n"
- + "-----Cima=" + Rstrcima + "\n"
- + "-----Direita=" + Rstrdireita + "\n"
- + "-----Baixo=" + Rstrbaixo + "\n"
- + "-----Esquerda=" + Rstresquerda + "\n"
- + "-----Azul=" + Rstrazul + "\n"
- + "-----Gren=" + Rstrgren + "\n"
- + "-----Yellow=" + Rstryellow + "\n"
- + "-----Red=" + Rstrred + "\n"
- + "-----Power" + Rstrpower + "\n"
- + "-----menu" + Rstrmenu + "\n"
- + "-----ok" + Rstrok + "\n"
- + "-----volumemais" + Rstrvolumemais + "\n"
- + "-----volumemenos" + Rstrvolumemenos + "\n"
- + "-----tecla 1" + Rstrtec1 + "\n"
- + "-----tecla 2" + Rstrtec2 + "\n"
- + "-----tecla 3" + Rstrtec3 + "\n"
- + "-----tecla 4" + Rstrtec4 + "\n"
- + "-----tecla 5" + Rstrtec5 + "\n"
- + "-----tecla 6" + Rstrtec6 + "\n"
- + "-----tecla 7" + Rstrtec7 + "\n"
- + "-----tecla 8" + Rstrtec8 + "\n"
- + "-----tecla 9" + Rstrtec9 + "\n"
- + "-----tecla 0" + Rstrtec0 + "\n"
- //mode mouse teclas e açoes de mouse
- + "-----mousecima" + Rstrmousecima + "\n"
- + "-----mousebaixo" + Rstrmousebaixo + "\n"
- + "-----mousedireita" + Rstrmousedireita + "\n"
- + "-----mouseesquerda" + Rstrmouseesquerda + "\n"
- + "-----mouseclickesquerda" + Rstrmouseclickesquerda + "\n"
- + "-----mouseclickdireita" + Rstrmouseclickdireita + "\n"
- + "-----mouseclickpress" + Rstrmousepress + "\n"
- );
- }
- } catch (SQLException ex) {
- Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- // String strpesquisalista="select * from contatos where nome=\""+vllist+"\"";
- }
- });
- }
- public void mn3() {
- stage.setScene(scene3);
- gp3.getChildren().addAll(menuBar);
- HBox hbmanual=new HBox(10);
- gp3.getChildren().addAll(hbmanual);
- hbmanual.layoutYProperty().bind(menuBar.heightProperty().add(5));
- hbmanual.layoutXProperty().bind(scene2.widthProperty().divide(8));
- Label lbmanual = new Label("Manual");
- VBox vbmnc3 = new VBox(10);
- Label lbleitor = new Label("visualizaçao");
- VBox vbmnc3b = new VBox(10);
- hbmanual.getChildren().addAll(vbmnc3,vbmnc3b);
- Label lbaplicativoss=new Label("aplicativos");
- ChoiceBox cbaplicativos=new ChoiceBox();
- cbaplicativos.getItems().addAll("index","Codigo","Comandos","Conectar","Portas","Automatico","Perfil","NovoPerfil","ExcluirPerfil");
- vbmnc3.getChildren().addAll(lbmanual,lbleitor,lbaplicativoss,cbaplicativos );
- final WebView browser = new WebView();
- final WebEngine webEngine = browser.getEngine();
- webEngine.load(""+controlepcvolumegtafxiino2.ControlePCVolumeGTAFXIINO2.class.getResource("index.html"));
- browser.setPrefSize(200, 300);
- Button btx=new Button("verificar");
- btx.setOnMouseClicked(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- if (null != cbaplicativos.getValue().toString()) switch (cbaplicativos.getValue().toString()) {
- case "index":
- webEngine.load(""+controlepcvolumegtafxiino2.ControlePCVolumeGTAFXIINO2.class.getResource("index.html"));
- break;
- case "Codigo":
- webEngine.load(""+controlepcvolumegtafxiino2.ControlePCVolumeGTAFXIINO2.class.getResource("Codigo.html"));
- break;
- case "Comandos":
- webEngine.load(""+controlepcvolumegtafxiino2.ControlePCVolumeGTAFXIINO2.class.getResource("Comandos.html"));
- break;
- case "Conectar":
- webEngine.load(""+controlepcvolumegtafxiino2.ControlePCVolumeGTAFXIINO2.class.getResource("Conectar.html"));
- break;
- case "Portas":
- webEngine.load(""+controlepcvolumegtafxiino2.ControlePCVolumeGTAFXIINO2.class.getResource("Portas.html"));
- break;
- case "Automatico":
- webEngine.load(""+controlepcvolumegtafxiino2.ControlePCVolumeGTAFXIINO2.class.getResource("Automatico.html"));
- break;
- case "Perfil":
- webEngine.load(""+controlepcvolumegtafxiino2.ControlePCVolumeGTAFXIINO2.class.getResource("Perfil.html"));
- break;
- case "NovoPerfil":
- webEngine.load(""+controlepcvolumegtafxiino2.ControlePCVolumeGTAFXIINO2.class.getResource("NovoPerfil.html"));
- break;
- case "ExcluirPerfil":
- webEngine.load(""+controlepcvolumegtafxiino2.ControlePCVolumeGTAFXIINO2.class.getResource("ExcluirPerfil.html"));
- break;
- default:
- break;
- }
- }
- })
- ;
- vbmnc3b.getChildren().addAll(browser,btx);
- }
- public void manuals(){
- }
- @Override
- public void start(Stage stage1) {
- conexaosql();//conexao mysql
- menusitens();//configuraçao de menu
- mn1();//classe inicial
- //conexaocomjsc
- engnerPortConection();
- stage.setTitle("Controle PC Volume Versão GTA S.A ---Conexoes ");
- stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
- @Override
- public void handle(WindowEvent event) {
- if (btconect.getText() == "Desconectar") {
- try {
- serialport.closePort();
- Platform.exit();
- } catch (SerialPortException ex) {
- Logger.getLogger(ControlePCVolumeGTAFXIINO2.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
- }
- );
- stage.show();
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- launch(args);
- }
- }
- ///2155847775 cima
- ///2155831455 baixo
- ///2155815135 direita
- ///2155864095 esquerda
- ///2155811055 select
- ///2155806975 azul
- ///2155855935 gren
- ///2155823295 amarelo
- ///2155839615 red
- bem10jfx.blogspot.com
- mabson neves
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement