-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved GUI #2
base: master
Are you sure you want to change the base?
Improved GUI #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making a pull-request, take a look at the review and make the requested changes after testing and ensuring that everything works well.
JButton standardGameButton = new JButton(Gui.getMessages().getString("standard")); | ||
JButton duelGameButton = new JButton(Gui.getMessages().getString("duel")); | ||
JButton gameInfoButton = new JButton(Gui.getMessages().getString("help")); | ||
//Construct new Components |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can notice that we use resource bundles instead of typing strings for the names of JLabels and other text field components. The reason we use the resource bundle (e.x. Gui.getMessages().getString("standard")
is to use multi-linguar in the program, in other words when a user has the Greek language he/she won't be able to see the text in Greek. So I suggest that you remove any hard coded string you typed and use the strings of the resource bundle. You can check which Strings are available in the bundle in the MessageBundle_en_US.properties file or in any other .properties file.
@@ -1,3 +1,4 @@ | |||
import javax.management.StandardEmitterMBean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This library is not used anyore in the code (Remove it if you don't need it)
//End | ||
|
||
|
||
title.setText("<html><font color=black size=45><b>Memory Game</b></html>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use HTML code just for one text-label, try and replace this with normal java code
gameInfoButton.setBackground(new Color(59, 89, 182)); | ||
gameInfoButton.setForeground(Color.WHITE); | ||
gameInfoButton.setFocusPainted(false); | ||
gameInfoButton.setFont(new Font("Tahoma", Font.BOLD, 12)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try and make one Font instance-Object and assign it to the components that use the same Font instead of making new ones each time (ensures code readability)
@@ -44,10 +76,12 @@ | |||
|
|||
GridLayout grid = new GridLayout(2, 0, 10, 20); | |||
|
|||
gameSelectionPanel.setLayout(grid); | |||
//Added Absolute Positioning | |||
gameSelectionPanel.setLayout(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikopetr
This is very weird because when I run it on my side I get this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you should test it with different screen sizes as well. Also, make sure to fix the other things mentioned.
So I just changed the Main Menu and just wanted to see if this is what you're looking for.