How to Make a Text Adventure Game with GUI in Java P2 - Create the Title Screen

preview_player
Показать описание


In this video, we will create the title screen of the game by placing a title text and a start button on the window.

Using class:
JFrame
Container
JPanel
JLabel
Jbuton

#tutorial #gamedev #textadventure
Рекомендации по теме
Комментарии
Автор

I love his way of separating every sentence with "hmmm". He does it better than Henry Cavil XD

jankrajewski
Автор

And here it is, the most underrated channel in history

mousediscord
Автор

4 years later and this is still an awesome tutorial :D

JeremieDeWitt
Автор

This video is 5 years old but is better than newer tutorials out there. I always enjoy coding when I'm following your videos, definitely foolproof and beginner-friendly.

Rae
Автор

If you're following this tutorial and your text doesn't appear when you run the program, move window.setVisible(true); to the bottom on the Game() method.

I found that my text wasn't being drawn unless I re-sized the window, but when I made the change above it was fixed.

OfficialChappers
Автор

It seems the JLable text doesn't appear in some people's environment. If that happens, please try moving window.setVisible(true) to the bottom on the Game() method, just like chap pers suggested by his comment. Sorry for the inconvenience!

Also, using container is kind of an old practice that required in older versions of Java and it's not necessary anymore. So you can basically ignore it and add components to the window directly like this:
window.add(titleNamePanel);

RyiSnow
Автор

Thanks for the great tutorials RyiSnow. I've never had to use Java before and have to use it at University. I've learnt lots from watching your game tutorials. Hope to see more, keep up the great work.

michaelfowler
Автор

Nice tutorial, helping me a ton with my campus project.
Here's something a figured out, if you want your window to appear on the center of your screen go ahead and do this.


Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension size = toolkit.getScreenSize();
- window.getWidth()/2, size.height/2 - window.getHeight()/2);

vanrensburg
Автор

awesome tutorial. finally a worthy teacher

ankitg
Автор

Thank you RyiSnow for teaching me about Java.Specifically The gui side of things.Im a new java programmer so this series really taught me about the GUI and input/output side of java.

razzubi
Автор

These tutorials are fantastic. Thank you sir.

PaperNinjaMan
Автор

So far it's quite nice and easy. I've been using a method to scale it to resolution of the screen so that way when I later on add the ability to change resolution, everything will look nice. It's quite easy to implement and even with just basic knowledge of Java things like that help a lot.

TheUltimateRPGOfficial
Автор

Hi. I've been watching your videos and its helping 💙♥️

larrydennbarredo
Автор

In my version of Java, the background color for startbutton wasn't working until I added this after making the Jbutton:

kelleyau
Автор

Try the font Lucida Calligraphy and size 75 or 70

nano-ai
Автор

What is the point of the Container object? Can't you just add the JPanel to the JFrame directly by window.add(titleNamePanel);?

LGDism
Автор

I tried making the actual button on the panel but when I run the program, all of the text disappears. Why? Could you please help me?

Ranger_Jackal
Автор

If Anyone Has Any problems Put the 'window.setVisible(true);' Right At the end with the cons

kizzyplayz
Автор

Can I ask questions? I did the same thing, but in my window the white text on the JLabel does not get displayed. Its just the blue box without text. And when I resize the whole window with my mouse, then the text all of the sudden appears. Why is that, do you know?

lordkaiser
Автор

Hi, My start button text has a small text box around it. Any ideas how to get rid of that?

henrywitt
visit shbcf.ru