Java - Interface en java

 
Vista:

Interface en java

Publicado por Guillermo (14 intervenciones) el 12/06/2008 22:10:07
hice una interface con el visual editor de java. El problema que tengo es que intento compilarlo pero me salta error.
Alguien me puede ayudar???

Muchas gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Interface en java

Publicado por Rene Gonzalez (115 intervenciones) el 13/06/2008 05:51:02
Debes ser un poco mas especifico. Quizas podrias poner el codigo o el error que te lanza el compilador para poder ayudarte.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Interface en java

Publicado por Guillermo (14 intervenciones) el 13/06/2008 17:40:24
MI CODIGO ES ES SIGUIENTE. YO LO QUE QUIERO ES PODER HACER UNA PEQUEÑA APLICACION EN JAVA ( YA QUE ESTOY EMPEZANDO A TRABAJAR CON ESTE LENGUAJE ). CUANDO LO QUIERO COMPILAR ME SALE EL ERROR "FAILED TO LOAD MAIN-CLASS MANIFEST ATTRIBUTE FROM C:PRUEBA.JAR"

package PackVisual;

import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JTextField;
import java.awt.Rectangle;
import javax.swing.JButton;

public class ClaseVisual extends JFrame {

private static final long serialVersionUID = 1L;

private JPanel jContentPane = null;

private JPanel jPanel = null;

private JTextField campo = null;

private JButton boton = null;

/**
* This is the default constructor
*/
public ClaseVisual() {
super();
initialize();
}

/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300, 200);
this.setContentPane(getJContentPane());
this.setTitle("JFrame");
}

/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(new BorderLayout());
jContentPane.add(getJPanel(), BorderLayout.CENTER);
}
return jContentPane;
}

/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.add(getCampo(), null);
jPanel.add(getBoton(), null);
}
return jPanel;
}

/**
* This method initializes campo
*
* @return javax.swing.JTextField
*/
private JTextField getCampo() {
if (campo == null) {
campo = new JTextField();
campo.setBounds(new Rectangle(92, 38, 88, 27));
}
return campo;
}

/**
* This method initializes boton
*
* @return javax.swing.JButton
*/
private JButton getBoton() {
if (boton == null) {
boton = new JButton();
boton.setBounds(new Rectangle(105, 82, 67, 23));
boton.setText("Boton");
}
return boton;
}

}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Interface en java

Publicado por Rene Gonzalez (115 intervenciones) el 15/06/2008 08:34:28
Si solo es ese tu codigo, le falta el metodo main, probablemente el error se debe a que el compilador no encuentra la clase con este metodo. Agrega lo siguiente dentro de tu clase:

public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ClaseVisual().setVisible(true);
}
});
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Interface en java

Publicado por Guillermo (14 intervenciones) el 15/06/2008 21:20:40
gracias Rene por tus respuestas. Ya lo probe y anduvo. Ahora me quedaria saber como hago para ejecutar un .class, vos sabes??

Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Interface en java

Publicado por Rene Gonzalez (115 intervenciones) el 18/06/2008 08:25:19
Tienes que crear un .jar con las clases (o la clase) que quieras ejecutar. El fichero .class por si solo no se puede ejecutar. Si utilizas alguna ide como Eclipse o Netbeans podras encontrar herramientas que hacen esto de forma facil e indolora. Suerte.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar