Swing is the name for the GUI toolkit that is packaged with the standard Java SDK. (since 1.2)

learn more… | top users | synonyms

6
votes
1answer
82 views

Separating Logic from GUI

I am new to Java's Swing and built a test client that connects to a server. I was wondering if my use of a Controller class as a link between the classes ...
2
votes
0answers
40 views

Inefficient Stopwatch - revised

This is my revised code of Stopwatch: ...
4
votes
1answer
103 views

Inefficient Stopwatch

I have just finished a simple GUI stopwatch, but some of its code looks like it needs replacing. This is the code: Clock class (extends Thread): ...
1
vote
1answer
69 views

Simple Operations Calculator

I'm practicing Swing effects. Everything works but for some reason I get a ton of error messages in the command prompt when the fields are empty, despite my attempt to add some exception handling ...
6
votes
2answers
74 views

Basic Calculator using Java Swing and AWT

I created a basic desktop calculator using Java. Does anyone have any suggestions as far as coding best practices, readability issues, or just generic coding mistakes I might have missed? Any ...
6
votes
1answer
45 views

Rotating background using Swing: performance issues

In a jPanel, I'm displaying a 1203x1203 background that I rotate every 30ms. Problem is, Swing is known to be a slow library, and I assume rotating a huge picture at a quick rate would be quite ...
8
votes
2answers
389 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 ...
1
vote
0answers
38 views

Guessing game - user has 6 attempts, after 6th attempt it saves the record to a text file [closed]

I have got all my code working but I am unsure of how I am meant to code in the high score text file. I have been teaching myself and am not sure of what variables or instances to include for the ...
5
votes
3answers
291 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 ...
0
votes
2answers
58 views

Simple GUI using tabs to separate application windows

I'm designing a simple GUI using tabs to separate each 'window' of the application. There are 3 main tabs, each with 2 sub-tabs. In one class I create the entire hierarchy of panes and panels: ...
4
votes
1answer
412 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 ...
9
votes
1answer
159 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 ...
7
votes
3answers
285 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 ...
6
votes
1answer
122 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 ...
1
vote
1answer
93 views

MVC Layout - Which way to add listeners is better?

So I'm doing a basic MVC layout for a pretty basic game that I am making. The game requires the user to move up/down/left/right via buttons on the GUI. Since I'm using an MVC layout and my buttons are ...
4
votes
1answer
112 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 ...
7
votes
1answer
89 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
536 views

“Guess my number” game in Java Swing

Also posted at rgcsm.info/blog ...
4
votes
2answers
59 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: ...
9
votes
1answer
62 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 ...
10
votes
1answer
1k 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 +, ...
4
votes
2answers
66 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
2answers
117 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
1answer
127 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 ...
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 ...
6
votes
3answers
100 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 ...
4
votes
2answers
93 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 ...
7
votes
1answer
132 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
752 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): ...
12
votes
1answer
111 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 ...
17
votes
2answers
198 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 ...
7
votes
1answer
591 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. ...
0
votes
2answers
75 views

A whole bunch of JButtons

Please review this code. ...
6
votes
2answers
834 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 ...
5
votes
1answer
229 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 ...
1
vote
2answers
142 views

Shortening code to create a JFrame

I'm new to Java and have just started making JFrames. I wrote a program for a game project I'm working on and would like help on where I can improve. I'm not new to ...
5
votes
2answers
285 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
358 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 ...
2
votes
1answer
79 views

Create GUI components with states

I am asking about the right way to make a component that holds some state. This includes a Jbutton that saves a color in it, or a list item that saves a certain object. So when those GUI components ...
2
votes
1answer
124 views

Improving my “Guess Who?” game

I have a project in school. This is the game that I've created, but I need to make some improvements. I put a swing.timer inside the action event to create a ...
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
157 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 ...
5
votes
2answers
130 views

Table model code style

This is my table model code style: ...
0
votes
1answer
384 views

Best practice on implementing Java Swing Callback

I guess I am at the design stage and as such dont have actual code to review so this might be the wrong place to ask this in which case let me know and happy to close/move the question I am trying to ...
10
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 ...
3
votes
1answer
75 views

Guice custom behavior for testing, how is this solution?

I have a Java/Swing/Guice application that uses multiple frames. When the application runs normally, I just want some of these frames to hide (and the "master" frame can unhide them). When testing ...
0
votes
3answers
380 views

Eliminating global variables in GUI program

I'm just getting started on GUI programming using swing in Java, and I would love some critiques on my code. I understand there is a danger in using global variables. If someone can hint me on how to ...
0
votes
1answer
2k views

Stuck with Multi-Client Chat Application

I'm trying to make a MultiClient Chat Application in which the chat is implemented in the client window. I've tried server and client code for the same. I've got two problems: A. I believe the code ...
2
votes
2answers
486 views

Separating presentation from the GUI

I'm a novice at Java and just beginning with Swing. I’m trying to figure out how to separate event logic from the presentation logic. Look at the following classes: GUITest.java ...
1
vote
1answer
80 views

Single-player Pong game in Java

I recently created the following code, which is supposed to implement a Pong variation for one player. How can I improve or optimize my code? Pong class: ...