Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   error: The local variable g may not have been initialized. (http://www.go4expert.com/forums/error-local-variable-g-initialized-t25400/)

firsttry 2Apr2011 00:21

error: The local variable g may not have been initialized.
 
Hi,

I try to do drawOval in the JFrame as below (I want it as simple as possible). However, it not works. Can you tell me what I am missing?

import javax.swing.*;
import java.awt.*;
public class MyFrameClass {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setSize(500,300);
frame.setVisible(true);
Graphics g;
g.drawOval(100,100,400,200); //error: The local variable g may not have been initialized.
}
}

virxen 7Apr2011 22:22

Re: error: The local variable g may not have been initialized.
 
try here--->http://www.java2s.com/Code/JavaAPI/j...hintheight.htm


All times are GMT +5.5. The time now is 08:46.