I have been playing with the basic game loop class from the tutorials section.
As part of my game's GUI i want to be able to use forms to let the players controll the game.
For example, there will probably be a Shop or market screen that will let players buy and sell goods. I know how to make this as a jFrame form, but i'm unsure how to intergrate this with the actual game rendering prosess.
I have managed to get a jPanel form with lables and text boxes to render onto the game screen, but i cant get mouse events to pass to it (clicking buttons, dragging slideres etc)
Has anyone out there tryed this or got it to work? Is it even possible?
: Ok, I have a jPanel which shows the current date and time as a jLabel. It has a blue background, a border, and the opacity is set to true.
When I tell the component to paint during my render loop, it will ONLY show up if I use paintComponents(myGraphics);
This only paints the lable, not the background and border. If I use any of the other paint methods, nothing paints at all.
Whats going on here? :/
frame = new jFrame("My Game");
JPanel panel = (JPanel) frame.getContentPane();
gui_topMenu = new GameGUI.TopMenu();
public void render(Graphics2D g)
this.paint(g); this.paintComponent(g) this.paintComponents(g) }
I must admit that I am still new to using the jFrame and jPanel classes :/