I am an avid programmer but today is my first Java lesson.
public void Paint (Graphics g)
{
if(g instanceof Graphics2D)
{
Graphics2D g2d = (G
1) not possible directly paint to the JFrame
, you can painting:
put there JPanel
getContentPane from JFrame
2) for Swing JComponents
is there paintComponent()
instead of paint()
, otherwise your painting couldn't be drawed corretly
3) another options are:
paint to the JFrame's RootPane
paint to the JFrame's GlassPane
4) more in 2D Graphics tutorial