Swing is a GUI toolkit packaged with the standard Java SDK since version 1.2.

learn more… | top users | synonyms

7
votes
1answer
106 views

Button-clicking UI for a game

I've been working on this game for a couple weeks now as a purely personal project to help myself learn Java. I'd like to know if I'm on the right track with my project. Items I'd like specific ...
-1
votes
0answers
14 views

How do I recognize which JButton was clicked in a separate Handler class? [closed]

This is my first class where I add the 2 JButtons and pass the object of MyHandler class handler to the 2 buttons. ...
7
votes
3answers
860 views

Simple Hangman game in Java

I'm teaching myself Java and I had some basic questions on how well I am writing my code for readability. I feel like sometimes I'm just writing code that works, and I'm not that proud of myself when ...
2
votes
1answer
70 views

Quiz program in Java

I have made this small quiz with 10 question and 40 JRadioButtons. One question and 4 JRadionButtons for each panel. So I had to ...
4
votes
0answers
58 views

Swing UI to display and edit terrain for a game

I would like someone to review my code and maybe give me some advice to maintain it because I'm still a beginner. ...
3
votes
2answers
62 views

Prime Number Calculator with GUI

I wrote a Java program with a Swing UI that calculates prime numbers. The primes are displayed into a listbox. I used a few optimizations to generate the primes faster. I’m using the NetBeans IDE, so ...
4
votes
1answer
36 views

Extremely Simple Paint Program in Java (Tips for making it run smoother?)

I have written a very basic paint program in java using awt and swing. I have separated the program into two different class files; one of them holds the JFrame and adds a custom panel (this custom ...
4
votes
3answers
143 views

Swing GUI in Java

I'm learning Java at the moment and I'm currently trying to make a GUI using Swing. I've done some reading and people usually prefer and advice to use composition instead of inheritance of e.g. ...
3
votes
1answer
64 views

Basic structure for interactive single window application

This is the basic structure I usually end up with whenever I'm writing a simple application. More recently I've learned about singletons and have started to incorporate them into my design, but other ...
1
vote
1answer
23 views

Animate an oval shape using Thread

I have this project that should continuously animating using for loop. Also I want to include variations on the position where the ball pass through. Can anyone please check my code if I am following ...
2
votes
0answers
89 views

Nice GUI for the sudoku solver in Java

I have implemented a GUI for my sudoku solver: You can use mouse for operating it, yet I have coded moving the cell cursor with keys wW/aA/sS/dD. My code ...
0
votes
0answers
23 views

Applying MVC design pattern to a Java SWING application

As the title says, for the last couple of hours, I've been trying to implement MVC design pattern into a project I've worked for a couple of days now. It took more time than expected and since the ...
3
votes
2answers
87 views

Basic TicTacToe game in java

I was assigned to create a simple Tic Tac Toe game in java for class, and here is what I got. I would like to know how the code could possibly be shortened without using really advanced topics since I ...
1
vote
1answer
34 views

Creating a new JFrame on label click

So I've been looking for examples on the internet for a while now and this seems the most common way everyone is suggesting, but now I ask is there a better way to make a new jframe pop up on click ...
3
votes
2answers
384 views

Medical diagnosis selector

Alright, so my code is 'all over' and missing some fundamentals as regarding to the MVC design pattern.I should separate my concerns and I don't have a model layer and i'm clueless to how to implement ...
5
votes
2answers
182 views

“I'm Listening”

For this next assignment, my job was to create a GUI with a button that changes text and color when clicked, and a slider that updates a label (with a TitledBorder) ...
5
votes
2answers
85 views

Create generic HTML calendar

I maintain our organizations intranet page as an additional duty. One thing that every department in the organization likes to use is calendars -- upcoming events, training, etc. At first I was only ...
0
votes
2answers
55 views

Java Swing Text Editor

Creating my first program in Swing and I was hoping to get some feedback. I'm looking for constructive criticism and tips for my swing code and my code in general. Don't really know what I'm doing so ...
3
votes
1answer
70 views

Java Swing Pong game

I recently created pong game using Java. This is my first time not copying any code from the internet or using any help. While it does work, my code feels well written but no streamlined or smooth ...
4
votes
1answer
50 views

Piano Tiles-like-Game: Mouse LorMorR

I'm currently trying to get somewhat familiar with swing and so I made a little game called "Mouse LorMorR" (Mouse Left or Middle or Right). The game consists of a timer, a score display and three ...
3
votes
1answer
39 views

Making use of Events in Java Swing and scaling shapes

I have this project that should respond to events. Can my code can be refactored and become shorter? Am I using actionListener properly? ...
3
votes
2answers
51 views

Conditional logic to determine if popup menu should be visible

I have this small piece of code written in a class. I am looking for a nicer way to write this, preferably avoiding nested if statements like what I currently have: ...
1
vote
1answer
45 views

Swing Food Menu

I want to know is it possible to re factor my code in such a way to remove duplication of almost identical statements, bar the variable name and what it is initialized to by using methods. Here is the ...
0
votes
2answers
68 views

JLabel formatting on GPA calculator

I am currently working on a GPA Calculator side project over holiday break to become more familiar with Swing, but I find the number formatting is more complicated than in regular Java. At the moment ...
7
votes
3answers
163 views

Swing UI for database-to-Excel tool

I'm just wondering what is the cleanest way you can write your GUI/Swing code? Right below is the code I have for my main frame. Could you guys let me know if it looks clean/understandable, and if ...
3
votes
1answer
52 views

Authentication program in Swing

It is a simple program which allows you to input a username an password. If the username/password is equal to the String it launches a JOptionPane that says ...
10
votes
1answer
199 views

Simon Says: “Optimizations!”

A while back I asked a question about my Simon Says game and did well on my assignment! But now we need to go back in a make some modifications to the game to be more advanced. I've done that as well, ...
3
votes
1answer
189 views

Monitor, read and display data from a dynamic log file

I am developing a plugin for intellij that basically monitors a log file and displays the data in a tool window within the IDE in real-time. I have managed to get it working but I would like to know ...
2
votes
2answers
99 views

Using actionPerformed() to call different methods per radio button selection

My Java is very rusty and I have been unlucky finding a better way to accomplish this task. I have two different methods which get called based on which radio button is selected. Is there a cleaner ...
3
votes
0answers
43 views

Change an identifier in a .csv file, based on another .csv file

I have only dabbled in Java before (my previous experience being mostly with PHP and JavaScript) but a request come through for a small application that seemed like a good chance to get some ...
3
votes
2answers
354 views

Java Temperature Converter GUI

Today is my first time working with GUI, so I'm really interested in the best ways of handling various events to get the best habits from the jump. Most of the GUI-related code for this project was ...
5
votes
2answers
38 views

Vertical JButton allignment

I have created a simple component in Swing that lets me place other components such as buttons on top of each other. They fill their parent horizontally but not vertically, which is exactly as I want ...
4
votes
1answer
716 views

Java Dice Roller with GUI

Three days ago I wrote about a Java Dice Roller I wrote. I've now added a GUI to that program. Here it is: DiceRollerGUI.java: ...
2
votes
1answer
57 views

Having graphics resize in line with the Frame in Swing

I have drawn a box within my JPanel so that it resizes appropriately when the JFrame is resized. This is how I implement it: ...
14
votes
2answers
201 views

Learning by translating - Follow the Rubberduck - Part 2: Beta

This project is my learning place for a few things: MVP (model view presenter) XML (parsing, editing and leveraging) deeper swing functionality Concerning the XML part I have already recieved a ...
3
votes
0answers
51 views

Swing Component Resizer Class

I've created a class to help resize Swing components while maintaining their aspect ratio within a container. The class works by creating an instance and adding a container's components to it, then ...
7
votes
1answer
241 views

Board-tile game click event OOP pattern

This is actually an old 'problem' that I never really knew how to improve, but I'm wondering now if there is a better approach for this problem. I'm creating MineSweeper with Java and struggling with ...
6
votes
1answer
43 views

Class managing queuing updates from another thread, Version 2

This is an updated version of: Class to manage updates coming in from another thread Managing updates from other threads into Swing is a hard problem. In MVC design, if you don't want to have the ...
5
votes
2answers
62 views

Class to manage updates coming in from another thread

Managing updates from other threads into Swing is a hard problem. In MVC design, if you don't want to have the Presenter be responsible for Thread safety, you can end up with deadlock issues, and also ...
4
votes
1answer
491 views

BMR (Basal Metabolic Rate) Calculator

Been working on a BMR calculator on and off for a while now. Created an interface and been over different ways to store user input, different ways to calculate BMR/TDEE etc. I created another class ...
6
votes
3answers
124 views

Java Swing Application - Roleplaying Aid

I've been working on this utility for a while now, and have since gone through a couple reworks to try and increase the readability and best practices, but since I don't usually work a lot with Swing, ...
6
votes
1answer
370 views

Basic Java Swing Calculator

I am new to Java Swing and have decided to create a calculator to learn some of the basic. I would like someone to look over my code to see if they can give me any improvements. I have 6 classes and ...
7
votes
2answers
763 views

Basic game with moving objects in Swing

This is a simulation attempt of an "old-style game", where a "car" (nothing more than a red rectangle) must dodge some "obstacles" (blue squares) falling from the upper edge of the frame. If an ...
1
vote
0answers
37 views

Removing JLabels by pressing JButtons which disable if in excess

The goal of this code is to move some JLabels from (JLabel[] pileone) off a JFrame when a ...
0
votes
1answer
58 views

TableCellEditor for multiple columns

I am wanting to use a cell editor and a DocumentFilter to prevent the user from entering certain characters into the table cells. The columns are as follows: ...
6
votes
2answers
127 views

Classic two-player memory game

This is a classic memory game with a points counter for the two players. The app works fine, but since this is my first project in Swing, I would appreciate the critical opinion of some expert, as ...
6
votes
3answers
2k views

Get initials from full name

Going through a book, I encountered the following assignment: Write an application that asks for the user’s first, middle, and last names and replies with the user’s initials. Are there any ...
4
votes
1answer
81 views

GUI SQL interface for select insert and remove

This is my final project for my second Java class! I would like to get some feedback on it to see where and what I can improve. There are five class files: ...
4
votes
1answer
1k views

MVC Calculator Implementation with Java Swing

I know this might be a relatively large amount of code, but I'm just looking for any improvement, big or small, on my coding as I can. As part of my self-study in programming, I decided to make a ...
3
votes
2answers
304 views

Computing age in days with a graphical tool in Java

I was in the mood for doing some GUI coding, and eventually I came with this simple program: you enter a date, press the button, and the program tells you temporal difference in days between the input ...