Swing is the name for the GUI toolkit that is packaged with the standard Java SDK. (since 1.2)
45
votes
6answers
16k views
File Browser GUI
FileBro is a basic GUI based File Browser.
FileBro Functionality
Directory tree - shows the file system roots at start-up, but is otherwise built lazily as the user browses around the file ...
15
votes
2answers
171 views
Tool for creating Code Review questions
Description
I have realized that there's a whole bunch of code I want to have reviewed, but copying file by file, selecting the code and pressing Ctrl + K is a slow process, and I want to remember ...
13
votes
2answers
779 views
Guessing game - am I using the concept of objects in Java properly?
I'm new to Java and find it hard to grasp the concept of objects. I wrote a simple guessing game to practice the concept of OO programming but I am not sure if I am doing it correctly.
The objective ...
12
votes
1answer
105 views
Follow-up to tool for posting Code Review questions
Description
This is a follow-up question to Tool for creating Code Review questions.
Things that has changed include:
Removed replacing four spaces with one tab, all tabs and all spaces in the ...
10
votes
1answer
671 views
Basic Calculator in Java with Swing
I used a standard calculator design from Java. I wanted to expand it so I created a class to create buttons for different operations, like +, ...
10
votes
2answers
68 views
Component-oriented implementation of JList
One of the main problems I have with JList is that no component is actually added to it. This means that things like ...
9
votes
3answers
7k views
Simple Java animation with Swing
Let me preface this by saying that I am new to this site as well as Java programming language. This site was recommended to my by a friend.
That aside, let me thank you for taking the time to read ...
9
votes
1answer
144 views
Organizing code in small Mario game
I have a little Mario game I started working on realize that it's format is very messy, can anyone critique my code on how to make it better, faster, neater, easier to access.
frame.java
...
9
votes
1answer
59 views
PanelScrollable - a reusable class for rendering a changeable number of panels
This class (PanelScrollable) is part of my view package, in an MVP designed Java Swing system. I am not using any MVP ...
8
votes
2answers
357 views
Swing calculator - first GUI program
I've recently made a calculator using Java and Swing. I'm okay with the results but I'm curious what are the major flaws I've made (assuming there are, because it is my first program making GUI). I ...
8
votes
1answer
515 views
What more can be done to add quality to Swing JPanel drawings?
I'm sorry if I have not worded the question title to well, so let me explain.
I am creating a game, actually a few and I see that most of the time when painting ect I use a JPanel, so I went and ...
8
votes
1answer
727 views
Approach to programmatically building hierarchical GUI components
At work I am developing an application using hand-coded Swing, and I've found that I have an easier time reading, writing, and maintaining hierarchical component creation using code blocks like:
...
7
votes
3answers
253 views
2048 game clone in Java
I made a 2048 game clone in Java for training, and I am trying to make it more efficient.
The problem I found is the paintComponent() method always resets all the ...
7
votes
1answer
712 views
Drawing a triangle and some concentric circles
For class, I had to use Java to draw a triangle and some concentric circles. Here's my code (questions follow):
...
7
votes
1answer
559 views
Java Calculator
I tried to make a calculator in Java and have added some stuff. I'm a beginner and have learned yesterday how to make buttons.
...
7
votes
1answer
303 views
Student administration application
I have set up a basic MVC project which is a student administration application based upon a CSV file as datastore. Each user has a specific role (student, lecturer, professor, leader of degree ...
7
votes
1answer
127 views
Card layout in Java
I have a JPanel (mainPanel) with CardLayout which contains 4 JPanels (childPanel).
Each childPanel contains:
a JPopupMenu ...
7
votes
1answer
88 views
Interacting with GUI class and Main class
Usually when I make mock-up programs (like this one), I look for things I can improve on in case the situation happens again.
Today I thought I'd brush up on basic OOP (I understand the concept of ...
6
votes
4answers
499 views
6
votes
3answers
99 views
Reducing repetition and utlizing EDT
I am working on the largest Java program I have undertaken to date and feel uncertain in my current code practices. I think that I state and repeat things that don't need to be which can become a ...
6
votes
2answers
628 views
Java GUI code with Swing Timer
I have the following questions for the below code:
Is there a simpler implementation of an on-screen counter?
I made CountTimer inner class since it's tightly ...
6
votes
1answer
209 views
Code Review for Pong in Java
I have recently written the following Pong game in Java:
Pong class:
...
6
votes
1answer
102 views
Refactoring code duplication so the same textArea is not used in 4 different classes
Looking for the best way to do this.
Currently in 4 different classes I have:
...
6
votes
1answer
106 views
Simple stop watch
I'd like my code to be solid and good. That's why I want someone a little more experienced to give me some feedback so I can improve. Here is the code for a simple stop watch that I created. I feel ...
5
votes
3answers
1k views
First Project: JFrame Class
This is my second "first" attempt at starting Java. My first was cut short when I had to go back to a PHP project that required my immediate attention. But perhaps that was a good thing. I learned ...
5
votes
3answers
274 views
Small notepad editor
I decided on making a small notepad editor in Java using Swing and I think it functions pretty well. Unfortunately, my skills in making my project tidy and organized has abandoned me; it looks like ...
5
votes
2answers
130 views
5
votes
1answer
313 views
GUI design in Java Swing
I am developing a GUI using Swing, but before my project gets too complex. I would like to have a good design structure. I have a few ideas and will use a simple example to illustrate. Some feedback ...
5
votes
1answer
191 views
A Program that Finds Empty Folders
I wrote a program that finds empty folders and subfolders in a directory. It's the first program I've ever written in Java, and I'd like some critique. I feel like I'm not utilizing classes in a very ...
5
votes
2answers
243 views
Splitting the GUI into smaller classes
I am currently working on a course project and have been assigned to write a GUI. I've written it and it's about 2000 lines of code. It will be bigger when I add the SQL codes and new panels. So, ...
5
votes
1answer
241 views
How can I make placing JButtons from an array more elegant?
I am trying to place JButtons from an array onto a JFrame. The way I'm doing it is having it test how many more buttons are ...
4
votes
2answers
114 views
How many squares can you see?
With a positive outlook, I posted this challenge at Programming Puzzles & Code Golf. I tried to come up with my own solution to the challenge which is as follows:
The output is displayed (not ...
4
votes
2answers
54 views
Executing a file through a swing button
I am making a Swing application for light local database management and I have the button Run XAMPP.
When that button is pressed this code is executed:
...
4
votes
3answers
202 views
Readable code with many components (Swing)
Please help me to make more readable and simple code like this. What if I had 20 components? Is it right to organize code like this?
...
4
votes
2answers
92 views
Long Thread & EDT
I’m trying to make a simple gui app that starts a “long” process that can be started and stopped. The process generates random numbers and displays them in a JList. As numbers are being displayed ...
4
votes
2answers
65 views
Did I properly encapsulate this package?
My goal is to make File_Path_Handler constructor the only thing a user can access. Oh, is it too coupled? but the main question is: is File_Path_Handler the only accessible part of this package?
...
4
votes
1answer
535 views
Pubsub implementation using a Singleton
Is using a singleton to represent a Publish-subscribe message system a bad design choice?
Background
Im thinking about writing a pubsub implementation (using the singleton pattern) to allow for ...
4
votes
1answer
2k views
How to separate logic and GUI
I'm writing a program to build and solve a Maze using DFS and backtracking using Java Swing. The code was a mess when I have to put my logic into my JPanel in order to show animation via the call to ...
4
votes
1answer
265 views
Execute multiple query from a text file
I am just wondering if this is a correct way to execute multiple query from a text file.
...
4
votes
1answer
247 views
MouseListener Lag in Piano Tiles game
I was attempting to write my own simple version of the Piano Tiles game app in Java just as a fun exercise.
GameLogic.java
...
4
votes
1answer
107 views
Winning Loop Connect 4
I am writing a fully functional single player Connect 4 game. I am working on the second player and the while loop that tells the player who won.
GUI
...
4
votes
1answer
107 views
Correctly implementing the Swing TreeModel
Ideally the Code Review would target the correctness of the approach implementing the Swing TreeModel.
In particular, is the structural separation[1], event message passing, threading[2], object ...
4
votes
1answer
299 views
Intercommunication Between Cards
I got some really good responses here last time, which really helped out quite a bit, so I thought I'd try again with a new batch.
Below is the second phase of my first Java project: ...
4
votes
1answer
169 views
Java/Swing GUI code/layout, am I doing this wrong?
I've never done Java GUI's before. After much trouble I've gotten my GUI to look how I want, however it feels as if my code is very inefficient, as if I'm going about this the wrong way?
...
3
votes
2answers
2k views
Number-guessing game in Java with Swing UI
I am trying not to pick up any bad habits while improving the way I write programs. Any suggestions on the following lines of code?
...
3
votes
1answer
4k views
3
votes
2answers
94 views
jInternalFrames code
I'm new to this page I want to ask you to critique my code on jInternalFrame. Basically the problem is that there is no complete example on using this, so I wrote this "template" but I don't know if ...
3
votes
2answers
629 views
First Java Swing program
This is my first forray into Java Swing and it's not exactly pretty. I have quite a few methods, and a lot of stuff going on (XML parsing, data conversion, etc) and I'm just wondering what kind of ...
3
votes
1answer
166 views
3
votes
1answer
156 views
Custom component organization system
I'm rewriting an old Swing project that I did a few months ago, a fairly simple copy-cat of MS paint. I've been doing a pretty good job of keeping the code maintainable and organized, but I've hit a ...