How would I make an In-game window?
So to put this simply, I'm making a game. the window for the game is not full screen, it is only 1000 by 800 pixels. for this game, i am making a blueprint class for in-game windows, so that i can have a window for inventories, stores, main menu, pretty much anything you can think of. So, I've tried using JDialogs
, but they are separate windows, and I kind of want it to be painted to the main panel... kind of like a JLabel
, but as a window. I've been doing a lot of google searches, and tried a lot of different things, such as the aforementioned dialog, and label, but I'm just not sure how to do this. All I need is an in-game window/menu. does anyone know how to do this? Thanks in advance!
Additinal info: if anyone has played Guild Wars 2, or World of Warcraft, you know what i'm talking about. Think about the separate inventory windows, and store windows, etc.
EDIT: I tried what the comments suggested, and here's how I initialized the new panel:
setSize(w, h);
setLayout(null);
setBackground(new Color(0, 0, 0, 0));
And I add this panel using mainFrame.add(new GameMenu());
and nothing happens. When I make the frame, in the main
method, I do it this way:
f = new Frame();
core.setFrame(f);
f.add(new GameMenu());
f.add(new Panel()); //panel is the main game panel
f.setVisible(true);
And it shows up and works just fine. So what is different about this, and why is my first way not working and the second work?