Error de compilacion
import java.lang.*; import java.awt.*; import java.awt.event.*;
public class prog1 {
static Frame ventana= new Frame();
Graphics contextoGrafico=null;
contextoGrafico.drawLine(0,350,400,350);
public static void main(String[] args){
ventana.setTitle("mi programa");
ventana.setBackground(java.awt.Color.pink);
ventana.setSize(400,700);
ventana.setVisible(true);
ventana.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);} });
};
};
Me da el siguiente error:
prog1.java:10: <identifier> expected
contextoGrafico.drawLine(0,350,400,350);
^
1 error
A ver si alguien me lo soluciona gracias
public class prog1 {
static Frame ventana= new Frame();
Graphics contextoGrafico=null;
contextoGrafico.drawLine(0,350,400,350);
public static void main(String[] args){
ventana.setTitle("mi programa");
ventana.setBackground(java.awt.Color.pink);
ventana.setSize(400,700);
ventana.setVisible(true);
ventana.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);} });
};
};
Me da el siguiente error:
prog1.java:10: <identifier> expected
contextoGrafico.drawLine(0,350,400,350);
^
1 error
A ver si alguien me lo soluciona gracias
