#Review my first gui

1 messages · Page 1 of 1 (latest)

supple stratus
upbeat graniteBOT
#

<@&987246883653156906> please have a look, thanks.

supple stratus
#

@somber ocean

somber ocean
#

decomposing is important. right now, everything is added to 1 panel, which is added to the frame

#

you should decompose it into multiple panels. have a numberPanel, a operatorPanel, etc..

#

null layout (absolute positioning) is something you wanna stray away from

supple stratus
#

break it into smaller more manageable parts

somber ocean
#

although it may look nice on your machine, it may look funky on others

#

instead, rely on actual layouts, which have dynamic sizing & positioning

supple stratus
#

i assume your a win 11 user ?

somber ocean
#

that way the UI looks good on all machines

#

i never ran it

#

just looking based on the code

#

ill run when i get home

#

but its not just platform, its screen resolution too

#

could be on the same platform, with a different resolution, and get different visual results

supple stratus
#

well yeah I think it would be a fun learning experiment just to see how different it looks

somber ocean
#

null layout is only good for a few things

supple stratus
#

that on my ubuntu 24.04 gnome

somber ocean
#

what you should do is use a GridLayout

#

or GridBagLayout if you want more control

#

cause thats what you got: grids

somber ocean
#

i broke up your UI into 3 sections

supple stratus
somber ocean
#

3 panels, each with some vertical space between

#

yup

#

easier to scale, easier to maintain

supple stratus
#

agreed 100%

somber ocean
supple stratus
#

in the hour it took me to write this I kindof got all googly eyed for swing

#

shes a pretty gal isnt she

somber ocean
#

nope

#

she ugly af

supple stratus
#

what ?

somber ocean
#

use JavaFX lmao

#

Swing is old, basically outdated

supple stratus
#

have you used wxWidgets ?

#

lol

somber ocean
#

its only included with the Standard Library cause Oracle wanted some kind of GUI toolkit included

#

the main problem with Swing, beyond performance, is its design

#

ever used a Window Builder?

#

people dont usually write GUIs by hand anymore. they use a drag-and-drop Window Builder

supple stratus
#

right

somber ocean
#

you can design your GUI like painting a picture

supple stratus
#

which does nothing to help me learn java

somber ocean
#

you still gotta code the actions

supple stratus
#

just like people dont "write" games anymore

somber ocean
#

you still gotta understand design

#

it helps you focus on the more important parts of software dev

supple stratus
#

yeah you click it together and script the events with some type of event handler

somber ocean
#

would be wild trying to write a GUI with assembly these days. the time it would take, just to get something less than basic

supple stratus
#

yeah

#

but the notches on your belt when you finished!

somber ocean
#

idk, you wind up learning about a lot of "how to wire swing stuff", which isnt that important these days

#

while neglecting the important stuff, like layouts & such

supple stratus
#

ok

somber ocean
#

which still play a huge role

supple stratus
#

so my goal is to become a profitable programmer

somber ocean
#

which means you cant spend time doing silly stuff

supple stratus
#

in all seriousness I want to be freelancing in two years

#

yeah I know 😦

somber ocean
#

first step would be straying away from null layout

supple stratus
#

I think I need a path

#

develope this,. then this, then this

somber ocean
#

Although it is possible to do without a layout manager, you should use a layout manager if at all possible. A layout manager makes it easier to adjust to look-and-feel-dependent component appearances, to different font sizes, to a container's changing size, and to different locales. Layout managers also can be reused easily by other containers, as well as other programs.

supple stratus
#

well if you say swing is done then i dont even want to hear her beautiful slutty name anymore

somber ocean
#

lmfao

#

JavaFX

#

new girl in town

supple stratus
#

dang

somber ocean
#

Scene Builder, better performance

supple stratus
#

yeah yeah I read the synopsis.... ahrdware accelerated blah blah

somber ocean
#

you thing wxWidgets is good? psh

supple stratus
#

ill look up her dress soon

somber ocean
#

imagine what FX has

supple stratus
#

no no no

#

i think wxWidgets is absolute nightmare garbage

#

the fat girl thats happy with a dry martini

somber ocean
#

Swing uses the LAF system (Look and Feel) for its vibe

#

and that is the biggest pain to deal with

#

most people ignore it & just create custom components by extending JComponent and overriding paintComponent

supple stratus
#

I need to take a step back and build a ladder to my goal

#

right now im stabbing in the dark

somber ocean
#

with JavaFX? CSS

somber ocean
supple stratus
#

I mean to get from a basic understanding of syntax to being a freelance coder

somber ocean
#

thats the start of the path

supple stratus
#

I dont care what api or library I use

somber ocean
#

it aint about just syntax though

#

this GUI design stuff aint just Java either

#

there are 2 parts of programming

#

you have the code, then you have the "problem domain"

#

the problem domain is the knowledge that you need for software, but isnt really code/syntax related

#

to make a network system, you gotta understand sockets and protocols

#

ports, hosts

#

none of that is really code related, its just knowledge

supple stratus
#

mmmmm sockets.cpp

somber ocean
#

you gotta understand the problem domain

#

and in this case (GUI), layouts are a big one

supple stratus
#

gets pencil and paper and starts writing notes and keywords from chat

somber ocean
#

you are basically giving layouts the finger by using null layout

#

especially if you plan on being a freelancer, gotta make sure your stuff works on many systems

#

different from having to target a single system within an in-house dev environment

supple stratus
#

absolutely no arguments

#

I completely get what you are saying I did it in a shit way, slapped it together in an hour with no experience and did what it would take me a week to do in c++ lol

#

absolutely not giving layouts the finger

#

am going to do a DEEEEEP dive into layouts on my next study session

#

maybe not a week

#

maybe 2.5 days

#

the point stands

#

I really appreciate your input

#

drop swing

#

learn JavaFX

#

but most importantly get a grasp of the problem domain and forget about null layout

#

what else can I add to my notes for my next study session ?

somber ocean
supple stratus
somber ocean
#

the layout thing should keep you busy for a bit

#

if youre still using null layout by the next session, ima just say the same

#

cause thats priority with this

supple stratus
#

the mother of my children are taking the kids for a week starting tomorrow. I plan to cram for 7 days straight

somber ocean
#

you found the right place

supple stratus
#

I may not even write code in the next session

#

I may just read

#

and take notes

somber ocean
#

baby mama drama is never fun, lets keep that under wrap. we are here for software

supple stratus
#

because I honestly barely know what you are talking about. But I know enough to know that I dont know

somber ocean
#

id recommend opening a new project, and playing around with GridLayout

#

from there, try adding another panel, maybe under or above (or next to) the panel with the grid

#

get some experience with layouts

#

from what i see, you have 3 panels

#

top panel contains the text field, doesnt really matter which layout it uses (FlowLayout is default)

#

middle panel, obviously a GridPanel

#

same with bottom

#

now you got 3 panels, how do you wire them up?

supple stratus
somber ocean
#

they'd all exist in a parent panel, which uses BorderLayout

supple stratus
#

lol jk

somber ocean
#

top panel would be BorderLayout.NORTH, then you got BorderLayout.CENTER

#

play around with that

supple stratus
#

I will definitely do that

#

thank you so much for taking the time to help me btw