Skip to main content
gamedev.net
🔒 Locked

[java] Fullscreen drawing problem

Started by kratz Aug 15, 2006 at 4:03 PM 1 replies 650+ views
Original Post
kratz
kratz
Hey everyone. I'm new to this forum and new to Java in general. I'm hoping to get into some Java game programming as a hobby. I recently made a simple applet game and would like to turn it into a fullscreen application but I'm having some problems. My class signature looks like this

public class BallBuster extends JFrame implements Runnable, MouseListener, KeyListener, ActionListener, ItemListener
I'm getting a fullscreen window like this

(in constructor)
//Set up the display mode
DisplayMode displayMode = new DisplayMode(1024, 768, 32, 75);
		
//Get the graphicsDevice
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
		
device = environment.getDefaultScreenDevice();
		
//Set JFrame to fullscreen window
device.setFullScreenWindow(this);

//Set display mode
device.setDisplayMode(displayMode);	
I'm able to draw on the window just fine but I'm having problems placing Swing components in the window. I want to have a Start button and some radio buttons for difficulty level before the game starts along with with some primitive drawn text. If I add a button like this in my constructor //Set up button FlowLayout layout = new FlowLayout(); device.getFullScreenWindow().setLayout(layout); device.getFullScreenWindow().add(new JButton("START")); the button is drawn then immediately covered by my primitive drawing code in the paint() procedure. Can anyone help me out? Thanks
---------------------------Noobies have feelings too!!----------------------------
harakim
harakim
Are you ignoring repaint events? If so, I imagine that would be your problem. You could always make your own buttons by drawing a button and using a MouseListener.
kratz
kratz
Hey harakim thanks for your reply. I've been reading about the active rendering strategy for working in fullscreen exclusive mode. This seems to work part of the time but the other part, my Swing components are still getting painted over. I guess I'll have to separate my window into two panels, one for the swing components and one for the primitive drawing.
---------------------------Noobies have feelings too!!----------------------------

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.