elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a Git (Primera Parte)


  Mostrar Mensajes
Páginas: [1] 2 3 4 5
1  Comunicaciones / Redes / Problema de conexion entre el ISP y Data Center Turnkey en: 14 Marzo 2017, 19:59 pm
El ISP es CANTV y se encuentra en Venezuela el data center Turnkey se encuentra en Australia. Mis Clientes Cuando van a realizar sus solicitudes al DNS llamado efactory.sytes.net tienen respuesta lenta. El paquete de datos comprado a Turnkey para el almacenamiento queda descartado, hay disponibilidad de sobra de RAM y CPU.

Cual podría ser entonces la causa del Problema?
2  Programación / Java / GridBagLayout no posiciona los componentes en: 26 Octubre 2016, 16:01 pm
Dentro de la ventana Login los componentes se muestran totalmente desordenados, a pesar que estoy utilizando GridBagLayout

Código
  1. package drone;
  2.  
  3. import java.awt.*;
  4. import java.sql.*;
  5. import java.text.Collator;
  6. import java.util.logging.Level;
  7. import java.util.logging.Logger;
  8. import javax.swing.JOptionPane;
  9. import javax.swing.*;
  10.  
  11.  
  12.  
  13. public class Login extends javax.swing.JFrame {
  14. //private JPanel panel1;
  15. public static boolean RIGHT_TO_LEFT = false;
  16. final static boolean shouldFill = true;
  17. final static boolean shouldWeightX = true;
  18.  
  19.  
  20.    public Login() {
  21.        initComponents();
  22.        this.setSize(Toolkit.getDefaultToolkit().getScreenSize());
  23.        PnlFondo fondo = new PnlFondo();
  24.        this.setLayout(new BorderLayout());
  25.        this.add(fondo,BorderLayout.CENTER);
  26.        //getContentPane().setLayout(null);  
  27.        //addComponentsToPane(pane);
  28.    }
  29. public static void addComponentsToPane(Container pane) {
  30.        if (RIGHT_TO_LEFT) {
  31.            pane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
  32.        }
  33.  
  34.        JLabel jLabel1,jLabel2,jLabel3;
  35.        JTextField usuario;
  36.        JPasswordField contraseña;
  37.        JButton jButton2;
  38.  
  39. pane.setLayout(new GridBagLayout());
  40. if (shouldFill) {
  41. //natural height, maximum width
  42. c.fill = GridBagConstraints.HORIZONTAL;
  43. }
  44.  
  45. jLabel1 = new JLabel();
  46. if (shouldWeightX) {
  47. c.weightx = 0.5;
  48. }
  49. c.fill = GridBagConstraints.HORIZONTAL;
  50. c.gridx = 200;
  51. c.gridy = 100;
  52. pane.add(jLabel1, c);
  53.  
  54. jLabel2 = new JLabel();
  55. c.fill = GridBagConstraints.HORIZONTAL;
  56. c.weightx = 0.5;
  57. c.gridx = 200;
  58. c.gridy = 110;
  59. pane.add(jLabel2, c);
  60.  
  61. jLabel3 = new JLabel();
  62. c.fill = GridBagConstraints.HORIZONTAL;
  63. c.weightx = 0.5;
  64. c.gridx = 2;
  65. c.gridy = 0;
  66. pane.add(jLabel3, c);
  67.  
  68. usuario = new JTextField("Long-Named Button 4");
  69. c.fill = GridBagConstraints.HORIZONTAL;
  70. c.ipady = 40;      //make this component tall
  71. c.weightx = 0.0;
  72. c.gridwidth = 3;
  73. c.gridx = 0;
  74. c.gridy = 1;
  75. pane.add(usuario, c);
  76.  
  77.        contraseña = new JPasswordField("Long-Named Button 4");
  78. c.fill = GridBagConstraints.HORIZONTAL;
  79. c.ipady = 40;      //make this component tall
  80. c.weightx = 0.0;
  81. c.gridwidth = 3;
  82. c.gridx = 0;
  83. c.gridy = 1;
  84. pane.add(contraseña, c);
  85.  
  86.  
  87. jButton2 = new JButton();
  88. c.fill = GridBagConstraints.HORIZONTAL;
  89. c.ipady = 0;       //reset to default
  90. c.weighty = 1.0;   //request any extra vertical space
  91. c.anchor = GridBagConstraints.PAGE_END; //bottom of space
  92. c.insets = new Insets(10,0,0,0);  //top padding
  93. c.gridx = 1;       //aligned with button 2
  94. c.gridwidth = 2;   //2 columns wide
  95. c.gridy = 2;       //third row
  96. pane.add(jButton2, c);
  97. }
  98.    private static void createAndShowGUI() {
  99.        //Create and set up the window.
  100.        JFrame frame = new JFrame("GridBagLayoutDemo");
  101.        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  102.  
  103.        //Set up the content pane.
  104.        addComponentsToPane(frame.getContentPane());
  105.  
  106.        //Display the window.
  107.        frame.pack();
  108.        frame.setVisible(true);
  109.    }
  110.  
  111.    /**
  112.      * This method is called from within the constructor to initialize the form.
  113.      * WARNING: Do NOT modify this code. The content of this method is always
  114.      * regenerated by the Form Editor.
  115.      */
  116.    @SuppressWarnings("unchecked")
  117.    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  118.    private void initComponents() {
  119.  
  120.        jLabel1 = new javax.swing.JLabel();
  121.        jLabel2 = new javax.swing.JLabel();
  122.        usuario = new javax.swing.JTextField();
  123.        jLabel3 = new javax.swing.JLabel();
  124.        contraseña = new javax.swing.JPasswordField();
  125.        jButton2 = new javax.swing.JButton();
  126.  
  127.        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  128.  
  129.        jLabel1.setText("Iniciar Sesion");
  130.  
  131.        jLabel2.setText("Usuario");
  132.  
  133.        jLabel3.setText("Contraseña");
  134.  
  135.        jButton2.setText("Aceptar");
  136.        jButton2.addActionListener(new java.awt.event.ActionListener() {
  137.            public void actionPerformed(java.awt.event.ActionEvent evt) {
  138.                jButton2ActionPerformed(evt);
  139.            }
  140.        });
  141.  
  142.        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  143.        getContentPane().setLayout(layout);
  144.        layout.setHorizontalGroup(
  145.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  146.            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  147.                .addContainerGap(113, Short.MAX_VALUE)
  148.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  149.                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  150.                        .addGroup(layout.createSequentialGroup()
  151.                            .addComponent(jLabel2)
  152.                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  153.                            .addComponent(usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE))
  154.                        .addGroup(layout.createSequentialGroup()
  155.                            .addGap(20, 20, 20)
  156.                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
  157.                            .addGap(169, 169, 169)))
  158.                    .addGroup(layout.createSequentialGroup()
  159.                        .addComponent(jLabel3)
  160.                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  161.                        .addComponent(contraseña, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
  162.                        .addGap(163, 163, 163))))
  163.            .addGroup(layout.createSequentialGroup()
  164.                .addGap(148, 148, 148)
  165.                .addComponent(jButton2)
  166.                .addGap(0, 0, Short.MAX_VALUE))
  167.        );
  168.        layout.setVerticalGroup(
  169.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  170.            .addGroup(layout.createSequentialGroup()
  171.                .addContainerGap(108, Short.MAX_VALUE)
  172.                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
  173.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  174.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  175.                    .addComponent(jLabel2)
  176.                    .addComponent(usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
  177.                .addGap(11, 11, 11)
  178.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  179.                    .addComponent(jLabel3)
  180.                    .addComponent(contraseña, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  181.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  182.                .addComponent(jButton2)
  183.                .addGap(107, 107, 107))
  184.        );
  185.  
  186.        pack();
  187.    }// </editor-fold>                        
  188.  
  189.    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  190.  
  191.        String user=usuario.getText();
  192.        String pass=contraseña.getText();
  193.        if ((user.length()==0)||(pass.length()==0)){
  194.           JOptionPane.showMessageDialog(rootPane, "Campo usuario o contraseña vacio");
  195.             }else{
  196.            Conexion mysql= new Conexion();
  197.       Connection conn= mysql.conectar();
  198.      /* if(conn!=null){
  199.            JOptionPane.showMessageDialog(rootPane, "Conexion con base de datos");
  200.        }*/
  201.              try {
  202.                  @SuppressWarnings("null")
  203.                  Statement sentencia= conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
  204.                ResultSet rs;
  205.                rs = sentencia.executeQuery("SELECT * FROM usuarios WHERE Usuario='"+user+"' && Contraseña='"+pass+"'");
  206.                Collator comparador = Collator.getInstance();
  207.                comparador.setStrength(Collator.TERTIARY);
  208.                String tem1=rs.getString("Usuario");
  209.                String tem2=rs.getString("Contraseña");
  210.                if(rs.next()&&comparador.equals(user,tem1)&&comparador.equals(pass,tem2)){
  211.                    Menu inicio=new Menu();
  212.                    inicio.setVisible(true);
  213.                }
  214.                else{
  215.                    JOptionPane.showMessageDialog(rootPane, "Los datos son incorrectos");
  216.                }
  217.            } catch (SQLException ex) {
  218.                Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
  219.            }
  220.        }
  221.        //if (user.equals()&&pass.equals());
  222.    }                                        
  223.  
  224.    /**
  225.      * @param args the command line arguments
  226.      */
  227.    public static void main(String args[]) {
  228.        /* Set the Nimbus look and feel */
  229.        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  230.        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  231.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  232.          */
  233.        try {
  234.            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  235.                if ("Nimbus".equals(info.getName())) {
  236.                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
  237.                    break;
  238.                }
  239.            }
  240.        } catch (ClassNotFoundException ex) {
  241.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  242.        } catch (InstantiationException ex) {
  243.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  244.        } catch (IllegalAccessException ex) {
  245.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  246.        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  247.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  248.        }
  249.        //</editor-fold>
  250.  
  251.        /* Create and display the form */
  252.        java.awt.EventQueue.invokeLater(new Runnable() {
  253.            public void run() {
  254.                createAndShowGUI();
  255.                new Login().setVisible(true);
  256.            }
  257.        });
  258.  
  259.    }
  260.  
  261.    // Variables declaration - do not modify                    
  262.    private javax.swing.JPasswordField contraseña;
  263.    private javax.swing.JButton jButton2;
  264.    private javax.swing.JLabel jLabel1;
  265.    private javax.swing.JLabel jLabel2;
  266.    private javax.swing.JLabel jLabel3;
  267.    private javax.swing.JTextField usuario;
  268.    // End of variables declaration                  
  269. }
  270.  

A quien pueda ayudar, gracias por adelentado
3  Programación / Java / Re: Problema con la conexión a la BD en: 11 Octubre 2016, 01:04 am
Debo agregar que e IDE que utilizo es netbeans el cual me indica Dereferencing possible null pointer en la linea Statement sentencia= conn.createStatement(); de la clase Login
4  Programación / Java / Problema con la conexión a la BD en: 11 Octubre 2016, 00:32 am
Esta es la clase que contiene el codigo para la conexion con la base de datos

Código
  1. package drone;
  2. import java.sql.*;
  3. import javax.swing.*;
  4.  
  5. public class Conexion {
  6.    public String db = "prototipo";
  7.    public String user= "root";
  8.    public String pass="";
  9.    public String url= "jdbc:mysql://localhost/"+db;
  10.    public Conexion()
  11.    {
  12.            }
  13.   public Connection conectar()
  14.   {
  15.       java.sql.Connection link=null;
  16.       Statement st=null;
  17.       try{
  18.                 Class.forName("com.mysql.jdbc.Driver");
  19.                 link=DriverManager.getConnection(this.url, this.user, this.pass);
  20.                 if(link!=null){
  21.                     JOptionPane.showMessageDialog(null, "conexion establecida");
  22.                 }
  23.                 /*if(link!=null){
  24.                      st=link.createStatement();
  25.                  }*/
  26.   }
  27.       catch(Exception e)
  28.       {
  29.           JOptionPane.showMessageDialog(null, "fallo conexion");
  30.           JOptionPane.showMessageDialog(null, e);
  31.       }
  32.       return link;
  33.   }
  34.    }
  35.  
  36.  

Esta es la clase Login que contiene el llamado al metodo conectar() de la clase Conexion, aqui tambien se genera el evento de boton

Código
  1. package drone;
  2.  
  3. import java.awt.BorderLayout;
  4. import java.awt.Toolkit;
  5. import java.sql.*;
  6. import java.util.logging.Level;
  7. import java.util.logging.Logger;
  8. import javax.swing.JOptionPane;
  9. import java.lang.*;
  10.  
  11.  
  12. public class Login extends javax.swing.JFrame {
  13.  
  14.  
  15.    public Login() {
  16.        initComponents();
  17.        this.setSize(Toolkit.getDefaultToolkit().getScreenSize());
  18.        PnlFondo fondo = new PnlFondo();
  19.        this.setLayout(new BorderLayout());
  20.        this.add(fondo,BorderLayout.CENTER);
  21.  
  22.    }
  23.  
  24.    /**
  25.      * This method is called from within the constructor to initialize the form.
  26.      * WARNING: Do NOT modify this code. The content of this method is always
  27.      * regenerated by the Form Editor.
  28.      */
  29.    @SuppressWarnings("unchecked")
  30.    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  31.    private void initComponents() {
  32.  
  33.        jButton1 = new javax.swing.JButton();
  34.        jLabel1 = new javax.swing.JLabel();
  35.        jLabel2 = new javax.swing.JLabel();
  36.        usuario = new javax.swing.JTextField();
  37.        jLabel3 = new javax.swing.JLabel();
  38.        contraseña = new javax.swing.JPasswordField();
  39.        jButton2 = new javax.swing.JButton();
  40.  
  41.        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  42.  
  43.        jButton1.setText("Registrarse");
  44.  
  45.        jLabel1.setText("Iniciar Sesion");
  46.  
  47.        jLabel2.setText("Usuario");
  48.  
  49.        jLabel3.setText("Contraseña");
  50.  
  51.        jButton2.setText("Aceptar");
  52.        jButton2.addActionListener(new java.awt.event.ActionListener() {
  53.            public void actionPerformed(java.awt.event.ActionEvent evt) {
  54.                jButton2ActionPerformed(evt);
  55.            }
  56.        });
  57.  
  58.        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  59.        getContentPane().setLayout(layout);
  60.        layout.setHorizontalGroup(
  61.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  62.            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  63.                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  64.                .addComponent(jButton1)
  65.                .addGap(46, 46, 46))
  66.            .addGroup(layout.createSequentialGroup()
  67.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  68.                    .addGroup(layout.createSequentialGroup()
  69.                        .addGap(89, 89, 89)
  70.                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  71.                            .addComponent(jLabel3)
  72.                            .addComponent(jLabel2))
  73.                        .addGap(75, 75, 75)
  74.                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  75.                            .addComponent(usuario, javax.swing.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
  76.                            .addComponent(contraseña)))
  77.                    .addGroup(layout.createSequentialGroup()
  78.                        .addGap(163, 163, 163)
  79.                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  80.                            .addComponent(jButton2)
  81.                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE))))
  82.                .addContainerGap(116, Short.MAX_VALUE))
  83.        );
  84.        layout.setVerticalGroup(
  85.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  86.            .addGroup(layout.createSequentialGroup()
  87.                .addGap(20, 20, 20)
  88.                .addComponent(jButton1)
  89.                .addGap(33, 33, 33)
  90.                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
  91.                .addGap(18, 18, 18)
  92.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  93.                    .addGroup(layout.createSequentialGroup()
  94.                        .addComponent(jLabel2)
  95.                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 27, Short.MAX_VALUE)
  96.                        .addComponent(jLabel3)
  97.                        .addGap(159, 159, 159))
  98.                    .addGroup(layout.createSequentialGroup()
  99.                        .addComponent(usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
  100.                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  101.                        .addComponent(contraseña, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  102.                        .addGap(29, 29, 29)
  103.                        .addComponent(jButton2)
  104.                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  105.        );
  106.  
  107.        pack();
  108.    }// </editor-fold>                        
  109.  
  110.    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  111.  
  112.        String user=usuario.getText();
  113.        String pass=contraseña.getText();
  114.        if ((user.length()==0)||(pass.length()==0)){
  115.           JOptionPane.showMessageDialog(rootPane, "Campo usuario o contraseña vacio");
  116.             }else{
  117.            Conexion mysql= new Conexion();
  118.       Connection conn= mysql.conectar();
  119.       if(conn!=null){
  120.           JOptionPane.showMessageDialog(rootPane, "Conexion con base de datos");
  121.       }
  122.              try {
  123.                  Statement sentencia= conn.createStatement();
  124.                ResultSet rs;
  125.                rs = sentencia.executeQuery("SELECT * FROM usuarios WHERE Usuario="+user+" && Contraseña="+pass+"");
  126.                int encontrado=rs.getRow();
  127.                if(encontrado==1){
  128.                    Menu inicio=new Menu();
  129.                    inicio.setVisible(true);
  130.                }
  131.                else{
  132.                    JOptionPane.showMessageDialog(rootPane, "Los datos son incorrectos");
  133.                }
  134.            } catch (SQLException ex) {
  135.                Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
  136.            }
  137.        }
  138.        //if (user.equals()&&pass.equals());
  139.    }                                        
  140.  
  141.    /**
  142.      * @param args the command line arguments
  143.      */
  144.    public static void main(String args[]) {
  145.        /* Set the Nimbus look and feel */
  146.        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  147.        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  148.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  149.          */
  150.        try {
  151.            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  152.                if ("Nimbus".equals(info.getName())) {
  153.                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
  154.                    break;
  155.                }
  156.            }
  157.        } catch (ClassNotFoundException ex) {
  158.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  159.        } catch (InstantiationException ex) {
  160.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  161.        } catch (IllegalAccessException ex) {
  162.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  163.        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  164.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  165.        }
  166.        //</editor-fold>
  167.  
  168.        /* Create and display the form */
  169.        java.awt.EventQueue.invokeLater(new Runnable() {
  170.            public void run() {
  171.                new Login().setVisible(true);
  172.            }
  173.        });
  174.  
  175.    }
  176.  
  177.    // Variables declaration - do not modify                    
  178.    private javax.swing.JPasswordField contraseña;
  179.    private javax.swing.JButton jButton1;
  180.    private javax.swing.JButton jButton2;
  181.    private javax.swing.JLabel jLabel1;
  182.    private javax.swing.JLabel jLabel2;
  183.    private javax.swing.JLabel jLabel3;
  184.    private javax.swing.JTextField usuario;
  185.    // End of variables declaration                  
  186. }
  187.  
  188.  

Gracias por adelantado quien me pueda ayudar
5  Programación / PHP / Re: Problema con codeigniter en: 22 Agosto 2016, 15:10 pm
Persiste el problema 404 Page Not Found
6  Programación / PHP / Re: Problema con codeigniter en: 13 Agosto 2016, 15:42 pm
La URL que estoy utilizando en el navegador es esta:

http://localhost/codeigniter/Prueba.php

Código
  1. <? php defined('BASEPATH') OR exit('No direct script access allowed');
  2.  
  3. class Prueba extends CI_Controller {
  4.  
  5. function __construct{
  6. parent::__construct();
  7.  
  8. }
  9.  
  10. public function index(){
  11. echo "controlador prueba se ejecuta";
  12. /*$id_planta=1;
  13. $this->load->helper('url');
  14.  
  15. $this->load->model('Planta_model');
  16. $datos=$this->planta_model->dame_planta('$id_planta');
  17. $datos_vista= array('rs_planta' => $datos );
  18. $this->load->view('bienvenido',$datos_vista);*/
  19. }
  20. }
  21. ?>
7  Programación / PHP / Re: Problema con codeigniter en: 13 Agosto 2016, 15:37 pm
Anteriormente se ejecutaba en acceso al controlador Prueba.php con las configuraciones para la eliminacion del index.php. Luego que modifique el archivo database.php para conectar con la base de datos todo se daño. Puedo acceder al controlador welcome q es el por defecto de codeigniter pero cuando cambio la variable

$route['default_controller'] = 'welcome'; por la de abajo
$route['default_controller'] = 'prueba';

Se imprime en pantalla 404 page not found
8  Programación / PHP / Problema con codeigniter en: 12 Agosto 2016, 20:59 pm
My proyecto local con Xampp 1.8.1 and codeigniter 3.0.6 me da error 404 Page not Found

Código
  1. File htaccess:
  2.  
  3. `
  4. RewriteEngine On
  5. # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
  6. # slashes.
  7. # If your page resides at
  8. # http://www.example.com/mypage/test1
  9. # then use
  10. # RewriteBase /mypage/test1/
  11. RewriteBase /codeigniter
  12. RewriteCond %{REQUEST_FILENAME} !-f
  13. RewriteCond %{REQUEST_FILENAME} !-d
  14. RewriteRule ^(.*)$ index.php?/$1 [L]
  15.  
  16. # If we don't have mod_rewrite installed, all 404's
  17. # can be sent to index.php, and everything works as normal.
  18. # Submitted by: ElliotHaughin
  19.  
  20. ErrorDocument 404 /index.php
  21.  
  22. `
  23. File config:
  24. $config['base_url'] = 'http://localhost/codeigniter';
  25. $config['index_page'] = '';
  26.  
  27. $active_group = 'default';
  28. $query_builder = TRUE;
  29.  
  30. File database:
  31. $db['default'] = array(
  32. 'dsn' => '',
  33. 'hostname' => 'localhost',
  34. 'username' => 'root',
  35. 'password' => '',
  36. 'database' => 'sistemaderiego',
  37. 'dbdriver' => 'mysqli',
  38. 'dbprefix' => '',
  39. 'pconnect' => TRUE,
  40. 'db_debug' => (ENVIRONMENT !== 'production'),
  41. 'cache_on' => FALSE,
  42. 'cachedir' => '',
  43. 'char_set' => 'utf8',
  44. 'dbcollat' => 'utf8_general_ci',
  45. 'swap_pre' => '',
  46. 'encrypt' => FALSE,
  47. 'compress' => FALSE,
  48. 'stricton' => FALSE,
  49. 'failover' => array(),
  50. 'save_queries' => TRUE
  51. );
  52.  
  53. File route:
  54. $route['default_controller'] = 'Prueba';
  55.  
  56.  

Alguna ayuda?
9  Programación / PHP / Re: echo no imprime en: 30 Enero 2016, 22:59 pm
He realizado el ajuste, sin embargo en el navegador no se imprime nada. Estoy utilizando xampp como kit de desarrollo.
10  Programación / PHP / echo no imprime en: 25 Enero 2016, 16:54 pm
Código
  1. <html>
  2. <head><title>php con html</title><head>
  3.  
  4. <body>
  5.  
  6. <? php
  7. echo "Hola mundo!";
  8. echo "Fin";
  9. ?>
  10.  
  11. </body>
  12. </html>

He probado en chrome, opera, mozilla y el resultado es el mismo: El titulo "php con html" aparece en el borde del navegador pero no se imprime "Hola mundo". La URL no es el problema de lo contrario el title no apareceria.
Páginas: [1] 2 3 4 5
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines