Foros del Web » Programación para mayores de 30 ;) » Java »

Alguien Me Ayuda Xfa!

Estas en el tema de Alguien Me Ayuda Xfa! en el foro de Java en Foros del Web. ESTA ES LA 2DA PARTE DEL CODIGO: private JPanel getJContentPane() { if (jContentPane == null) { jContentPane = new JPanel(); jContentPane.setLayout(new BorderLayout()); jContentPane.add(getPanelSur(), BorderLayout.SOUTH); jContentPane.add(getPanelEste(), ...
  #1 (permalink)  
Antiguo 12/07/2008, 10:03
 
Fecha de Ingreso: julio-2008
Mensajes: 3
Antigüedad: 15 años, 9 meses
Puntos: 0
Alguien Me Ayuda Xfa!

ESTA ES LA 2DA PARTE DEL CODIGO:

private JPanel getJContentPane()
{
if (jContentPane == null)
{
jContentPane = new JPanel(); jContentPane.setLayout(new BorderLayout());
jContentPane.add(getPanelSur(), BorderLayout.SOUTH);
jContentPane.add(getPanelEste(), BorderLayout.WEST);
jContentPane.add(getPanelOeste(), BorderLayout.EAST);

}
return jContentPane;
}
static String url=null;
static Connection con = null;
static Statement smt=null;

/* public static void createTableAlumnos(Connection c)
{
try
{

String createStmt = "create table alumnos " +
" ( nrocedula integer, " +
" nombre varchar(30) , " +
" apellido varchar(30) , " +
" direccion varchar (30) , " +
" email varchar(50) , " +
" telefono integer " +
" ) ";

smt = c.createStatement();
smt.executeUpdate(createStmt);
smt.close();
System.out.println("La tabla fue creada");

} catch (Exception e)
{
e.printStackTrace();
}
}*/
/*public static void cargarAlumnos(Connection c) throws SQLException
{
String insertStmt= "INSERT INTO alumnos VALUES ( 1234567, 'Rosana', 'Ayala', 'Capiata', 'ros',555555)";
String insertother= "INSERT INTO alumnos VALUES ( 1152487, 'Armando', 'Martinez', 'Asuncion', 'arman',021021 )";

try
{
smt = c.createStatement();
smt.executeUpdate(insertStmt);
smt.executeUpdate(insertother);
smt.close();
System.out.println("Los registros han sido agregados");
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("No se pudo realizar la operacion");
}
} */

public static void DesplegarAlumnos(Connection c) throws SQLException
{
//Crea la consulta
String selectStmt = "select nrocedula, nombre, apellido, direccion, email, telefono from alumnos";
//Ejecuta la consulta
smt = con.createStatement();
ResultSet rs = smt.executeQuery(selectStmt);

while (rs.next())
{
System.out.println("Nro_cedula:" +rs.getInt("nrocedula"));
System.out.println("Nombre: " + rs.getString("nombre"));
System.out.println("Apellido: " + rs.getString("apellido"));
System.out.println("Dirección: " + rs.getString("direccion"));
System.out.println("Email: " + rs.getString("email"));
System.out.println("Telefono: " + rs.getInt("telefono"));


}
smt.close();
}

public static void main(String[] args) throws ClassNotFoundException
{
try
{
//Cargamos el driver de Postgres
Class.forName("org.postgresql.Driver");

//Establecer conexion
url = "jdbc:postgresql://localhost:5432/postgres";
con = DriverManager.getConnection(url, "ayala", "gimenez");

// createTableAlumnos(con);
// cargarAlumnos(con);
DesplegarAlumnos(con);
// borrarRegistro(con);
// borrarTabla(con);

con.close();

} catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}

SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
trabajofinal thisClass = new trabajofinal();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_ CLOSE);
thisClass.setVisible(true);
}
});
}
}
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:12.