I have override paintComponents
method, but when I am using it and run my program then it does not show any circle and lines. Recently frakcool said it is not paintComponents
method, it is paintComponent
method. I found out but I didn't get any paintComponent
method.
This picture shows that i have not got any paintComponent method:
Codes are here.
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SecondActivity frame = new SecondActivity();
frame.setBackground(Color.WHITE);
frame.paintComponents(null);
// frame.paint(null);
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
@Override
public void paintComponents(Graphics g) {
// TODO Auto-generated method stub
super.paintComponents(g);
Graphics2D g2d = (Graphics2D) g;
drawCircle(g2d,centerX,centerY,r);
drawLineAzim(g2d);
drawLineEle(g2d);
}