#Swing and AWT Help

1 messages · Page 1 of 1 (latest)

rotund zenith
#

So, I have a really tall order. I've been trying to learn Swing and AWT for roughly five hours through Youtube, Oracle, etc and I'm struggling pretty hard. A lot of the tutorials I found tell you what to do to achieve certain outcomes, but don't explain what they actually did, which is leading to clashes with any advice I try to take later on.

Right now, I'm working on trying to use the Graphics class to create an oval (I'm working on a program that proves the ducks in a circular pond statistics question) and I honestly do not understand what the guides want, nor what an abstract class really is. I'm really looking for good tutorials on how to use this class or similar to create what I'm looking for (a blue oval with yellow dots in it) in Java. Any tutorials on Swing API structure in general would be REALLY appreciated.

For greater context (that isn't relevant to the overall question and can be skipped), I'm pretty much a mess of a CS junior who had some pretty bad introductory Java courses that screwed me over. My first Java project in a not-training-wheels IDE was created last week was for an Intro to AI class, and it hit me REALLY hard. A lot of my previous classes involved very little code and taught us Data Structures and other things conceptually, so I don't have a lot of code in my pocket. So, for all intents and purposes, I'm pretty much doing junior level projects with baby knowledge in actually working with Java. I might be pretty dense to explain these topics to, and I apologise in advance.

runic lichenBOT
#

This post has been reserved for your question.

Hey @rotund zenith! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

rotund zenith
#

Here's what I have right now in my main class, and my weird "Pond Graphics" class I don't know how to make work. I'm looking for more general tutorials since I don't think I even have enough to fix anything at the moment, but I thought I should post this anyways!

alpine plover
#

so i aassume you're just seeing an empty window at the moment

rotund zenith
#

yeah, i am

#

i'll try to implement that, would that make an unfilled oval show up?

alpine plover
#

should do; give it a try

rotund zenith
#

also, I did need 3 more buttons other than this, should I use the JPanel Gridlayout i got set up or is there something better? can you add a JPanel to a JPanel? Also, doing that right now, thank you

#

oh okay i actually got something this time!!! thank you!

alpine plover
#

yeh it works for me too

rotund zenith
#

kind of! that would work since i'm kinda willing to shove anything in this and call it a day suddenly

#

i'm currently figuring out how to draw ducks and a line in the pond, but i think i actually figured that out (maybe.) im drawing a scratchy sketch just to make 1000% sure I know what I'm doing.

alpine plover
#

the jframe has a borderlayout, then in the SOUTH of the borderlayout we have a 0, 3 gridlayout

rotund zenith
#

wait wait so, if I wanted it to the right of the screen, could I add the pond panel to the west and a grid to the east?

alpine plover
#

let's think

rotund zenith
#

if so that would be REALLY helpful and what I'm going for, but im unsure it's possible

alpine plover
#

so you still want the graphics to be in the CENTER

#

but the gridlayout then becomes a 3, 0 and would be in EAST not SOUTH

#

3 being rows, 0 being cols

rotund zenith
#

ah, alright! that makes sense

#

if i wanted it to look somewhat like a side bar, could i edit that to 0, 3?

alpine plover
#

not sure what you mean by sidebar but 3,0 will give you 3 buttons stacked on top of one another

rotund zenith
#

that's what I mean

alpine plover
#

or SHOULD give 3 stacked on top of one another

#

give it ag o

rotund zenith
#

i will in a short bit! still sorting out things with the pond, and i need to get breakfast and run off in a few

#

i really, really appreciate this help by the way

alpine plover
#

no probs