import java.awt.*;
import javax.swing.JComponent;
public class HelloComponent {
class HelloComponent extends JComponent{
public void paintComponent( Graphics g) {
g.drawString("Hello,Java!", 125, 95);
}
}
- The error I get back is (The nested type "HelloComponent" cannot hide an enclosing type) I have tried changing the brackets around but I still get the same error back. I also tried to change my other class that contains the JFrame, from frame.add(text) ( text is my var for the label) to frame.add( new HelloComponent()); ( as the book Im reading instructed me to do, but I still get an error)) P.S. I am trying to make my JFrame text using drawString operation.
P.P.S. I started learning Java yesterday
P.P.P.S I already created a class for the actual Jframe