Ask coding questions

← Back to all posts
How to begin programming in Java Swing?
Zeune (16)

With the introduction of Java Swing to repl.it, it doesn't appear all that friendly. First, I created a project package, a Main file that creates an object of our Window (Which throws you off, because the window seems to be integrated to the development environment, so adding components to the window starts off as a challenge because I can't just say object.add(comp);

At the moment the pathing is configured properly with the programming operating in this manner:
Main > Window > UserInterface

When I run the project it will work, but no JTextField gets displayed. Any idea where my error is?
NOTE: No explicit error... Appears to a logic error.

Project: https://repl.it/@Zeune/Test-Swing-project

This is a repeat post from ~4 days ago. Repl.it doesn't provide the use of bumping threads. My apologies if this went against ToS

Answered by TheDrone7 (731) [earned 5 cycles]
View Answer
Commentshotnewtop
TheDrone7 (731)

You can see the repl.it example to get started. Also, in case you need more info on the JTextField here's an example I made - https://repl.it/@TheDrone7/NegligibleTrimFreesoftware

Although the problem you might be facing is that, in the integrated frame where the output window is displayed, the components that are very small don't get displayed, try resizing to a bigger size.

Zeune (16)

@TheDrone7 I appreciate this. Thank you for a timely reply as well :D.

TheDrone7 (731)

@Zeune you're welcome, Happy to help.

emosqueira (0)

@TheDrone7 I was trying to test a simple Swing program in repl.it but all the results seems to be the same: you can see your interface in a very dimmer and no interactive window and nothing seems to work at all.

Even your example, see the image. ¿this is normal?

TheDrone7 (731)

@emosqueira this is bug that's been occurring lately, it used to be fine earlier and I'm pretty sure the repl.it team is working on fixing it.

emosqueira (0)

@TheDrone7 Thanks! will wait then for the bug to be fixed...