Java tutorial
/* * 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 Interfaz; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; /** * * @author ADRIAN */ public class JFPrincipal extends javax.swing.JFrame { public static WebDriver driverFull; /** * Creates new form JFPrincipal */ public JFPrincipal() { // Optional, if not specified, WebDriver will search your path for chromedriver. System.setProperty("webdriver.chrome.driver", "C:\\SeleniumDrivers\\chromedriver.exe"); //Hacemos la ventana de chrome grande ChromeOptions options = new ChromeOptions(); options.addArguments("--start-maximized"); driverFull = new ChromeDriver(options); initComponents(); this.setIconImage(new ImageIcon(getClass().getResource("/img/ikariam.png")).getImage()); JPLogin jpLogin = new JPLogin(); this.setBounds(100, 500, 700, 370); this.getContentPane().add(jpLogin); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jMenu6 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu2 = new javax.swing.JMenu(); jmiEdificios = new javax.swing.JMenuItem(); jmiTablaRecursos = new javax.swing.JMenuItem(); jMenu4 = new javax.swing.JMenu(); jmiSalir = new javax.swing.JMenuItem(); jMenu6.setText("jMenu6"); jMenuItem1.setText("jMenuItem1"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setUndecorated(true); jMenu2.setText("Bot"); jMenu2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenu2ActionPerformed(evt); } }); jmiEdificios.setText("Listas de construccion"); jmiEdificios.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jmiEdificiosActionPerformed(evt); } }); jMenu2.add(jmiEdificios); jmiTablaRecursos.setText("Tabla de recursos"); jmiTablaRecursos.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jmiTablaRecursosActionPerformed(evt); } }); jMenu2.add(jmiTablaRecursos); jMenuBar1.add(jMenu2); jMenu4.setText("Salir"); jmiSalir.setText("Salir"); jmiSalir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jmiSalirActionPerformed(evt); } }); jMenu4.add(jmiSalir); jMenuBar1.add(jMenu4); setJMenuBar(jMenuBar1); pack(); }// </editor-fold>//GEN-END:initComponents private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed }//GEN-LAST:event_jMenu2ActionPerformed private void jmiEdificiosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiEdificiosActionPerformed JPEdificios jPEdificios = null; try { jPEdificios = new JPEdificios(); } catch (InterruptedException ex) { Logger.getLogger(JFPrincipal.class.getName()).log(Level.SEVERE, null, ex); JOptionPane.showMessageDialog(null, "Error al instanciar el panel de edificios", "Informacion", JOptionPane.INFORMATION_MESSAGE); } this.setContentPane(jPEdificios); }//GEN-LAST:event_jmiEdificiosActionPerformed private void jmiTablaRecursosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiTablaRecursosActionPerformed JPRecursos jpRecursos = null; jpRecursos = new JPRecursos(); this.setContentPane(jpRecursos); }//GEN-LAST:event_jmiTablaRecursosActionPerformed private void jmiSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiSalirActionPerformed // TODO add your handling code here: System.exit(0); }//GEN-LAST:event_jmiSalirActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new JFPrincipal().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JMenu jMenu2; private javax.swing.JMenu jMenu4; private javax.swing.JMenu jMenu6; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jmiEdificios; private javax.swing.JMenuItem jmiSalir; private javax.swing.JMenuItem jmiTablaRecursos; // End of variables declaration//GEN-END:variables }