javarower
02-26-2012, 04:39 PM
Hi, I am new to java programming and am trying to make a very basic game. I would like to make a full screen gui with the code:
JFrame frame = new JFrame();
frame.setIgnoreRepaint(true);
frame.setBounds(new Rectangle(new Point(0, 0), tk.getScreenSize()));
frame.setUndecorated(true);
frame.setVisible(true);
and then make the gui print our a graphic.
My problem is that the only way i know how to put stuff on the screen is with the paint(Graphics g) method and this forces me to put all my logic into the paint(Graphics g) method. I was wondering if there was a way to create a graphic outside of the paint method(with like drawImage(Image, int, int, ImageObserver)) and then feed it into the paint method. Thank you in advance for helping me.
JFrame frame = new JFrame();
frame.setIgnoreRepaint(true);
frame.setBounds(new Rectangle(new Point(0, 0), tk.getScreenSize()));
frame.setUndecorated(true);
frame.setVisible(true);
and then make the gui print our a graphic.
My problem is that the only way i know how to put stuff on the screen is with the paint(Graphics g) method and this forces me to put all my logic into the paint(Graphics g) method. I was wondering if there was a way to create a graphic outside of the paint method(with like drawImage(Image, int, int, ImageObserver)) and then feed it into the paint method. Thank you in advance for helping me.