Skip to content
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

Changed various components size / dimensions to some ratio of screen size #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kushagra-shukla
Copy link

Everyone device has different amount of pixels in screen and hence setting dimensions of components in terms of screen size should help make the GUI more responsive and make the UX more uniform across devices.

Issue: #1

…size (in pixels) of device, to create a more responsive GUI
@kushagra-shukla
Copy link
Author

Hey, @DarthFloopy
Can you add hacktoberfest-accepted lable to this PR in case you are occupied and then later on review and merge the PR in your own time.

@josephcagle
Copy link
Owner

Hmm... this looks good, but it's still too big on my 1080p screen. Can you try shrinking things a bit more?

You might try allowing things to change sizes, instead of setting the min and max sizes to the same value.

Also, please remove the new border on the reset button. ("BorderFactory.createSoftBevelBorder()")

Thanks!

(BTW this repo has the "hacktoberfest" label, so you're good to go.)

@kushagra-shukla
Copy link
Author

Okay, I'll remove the border and make the size a bit smaller. How small do you want it to be on a 1080p screen? 80% of screen or lesser?
I'll do this setPreferredSize(getPreferredSize()) and remove max and min sizes. It should allow sizes to change although I'm not sure.
This is my first time working with Swing and awt so correct / guide me wherever possible.

@josephcagle
Copy link
Owner

Yes, that's good. It would be nice if the buttons were small enough so they don't cover the reset button, and the window were easily shrinking down to 50% width and height.

@kushagra-shukla
Copy link
Author

I switched to Grid Layout to make sure

they don't cover the reset button

For some reason the Panels are getting stacked vertically rather than horizontally and I can't seem to get them in horizontal orientation.
However, it is way better this way for usability purposes. Now, it is possible to shrink/ resize the frame until the label of clocks itself starts to disappear. Reset button doesn't get covered at all. And it reduces lot of lines of code. Seems like a win-win.
Check it out ! See if it is to your liking. 😄

(BTW this repo has the "hacktoberfest" label, so you're good to go.)

I was talking about adding hacktoberfest-accepted label to this PR so that it is considered for Hacktoberfest.

@josephcagle
Copy link
Owner

Thanks! I like the grid layout. I think the reset button / middle section gets a bit too big though, so can we keep the BorderLayout and have the button be a fixed percent of the screen size? (I would suggest using a GridBagLayout instead, but that might be more work than it's worth.) Just change the fixed sizes/percents to something reasonable where everything is comfortably visible on most screens.

  • That would probably include the rigidAreas on the controlPanel.

Also, I'd like to keep the two time readouts horizontal. (BTW, you just needed to swap your GridLayout constructor args.)

I re-read the Hacktoberfest rules and labeled this PR as hacktoberfest-accepted. (I apologize if this doesn't count for Hacktoberfest because I did that after Oct 31. I think there is a 14-day window for maintainer review or something, so hopefully it still makes it.)

@kushagra-shukla
Copy link
Author

kushagra-shukla commented Nov 2, 2020

so can we keep the BorderLayout and have the button be a fixed percent of the screen size?

In GridLayout the button is expanding to occupy available space similar behavior can be seen in BordreLayout as we are setting button position as BorderLayout.CENTER. Thus, we need rigidArea. I'll add rigidArea back in again. So, all it would change is less code and same layout as it was previously + using screen pixel size to set the frame size of application.
However, it will not achieve what you said earlier that is upon resizing it should adapt or adjust the size of components. I tried to do this I failed. It had something to do with overriding functions defined in ComponentListener and ComponentAdapter. I tried but I broke the UI so reverted and ended up using GridLayout.

(BTW, you just needed to swap your GridLayout constructor args.)

My bad :D I swapped them in my head.

so hopefully it still makes it

It shows 3/4 PRs in my profile. So I don't think it is counting this one. But all the other 3 PRs are merged so maybe that's why idk. Doesn't matter now. I started very late, also this was my first Hacktober.

@josephcagle
Copy link
Owner

Sorry if this hasn't ended up going anywhere. Do you still want to work on this? (If not, I totally understand.)
Thanks for your work so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tweak some values to make the GUI better for lower-resolution screens
2 participants