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

learn more… | top users | synonyms

2
votes
2answers
51 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 ...
-2
votes
0answers
36 views

Simple calculator using methods and JOptionPane [closed]

I'm new to java and while working on my simple calculator program. I'm learning about JOptionPane and I want to add JOptionPane messages instead of the console output. The problem I ran into is when ...
5
votes
1answer
183 views

Calculator in Java using JFrame

Today, I made a calculator in JFrame. The code is a little long but I'm still a beginner to Java. In the future I'm going to do some improvements on it, but here it is right now. This is the meat of ...
10
votes
3answers
808 views

Beginner GUI Calculator

I'm very new to Java and programming and I've written a calculator to put all the theory I've learned so far into practice. I'm sure there is a lot of room for improvement since I really just started ...
12
votes
1answer
106 views

Beginner temperature converter

I'm a beginner to Java and programming in general and since I'm on a holiday to the US, I thought it would be a fun idea to write a program for converting Fahrenheit to Celsius and the other way ...
8
votes
4answers
449 views

Java GUI 2-input Calculator

I have written this code for a two input calculator. Is there anything I can do to make this code more efficient? ...
5
votes
1answer
92 views

Delete item in List A will also delete corresponding items in List B

This Java Swing code consists of 2 JLists and a delete button. When I select an item from locationList, it will also delete ...
7
votes
2answers
165 views

Java calculator using Swing

This is a simple calculator where the user can type out the calculation and hit enter, and the calculator would determine if it is a valid calculation or not by attempting to carry out the ...
13
votes
2answers
142 views

Ultimatoe — 2. The model

The game model (Ultimatoe) consists of 9 instances of Tic-Tac-Toe (UltimatoeBoard) and some auxiliary information. As the number ...
11
votes
1answer
143 views

Ultimatoe — 1. GUI and general game interfaces

For the community challenge, I wrote ultimatoe. For me, the most interesting part is clearly the AI, but what I did so far is just a stupid Monte Carlo tree search, which isn't ready for a review yet ...
5
votes
1answer
86 views

Click! program in Java Swing

I've created a program where the user is, at first, presented with a window with a yellow circle (random size, random coordinates) and a Start button. Once the user presses Start, the circle, when ...
-1
votes
1answer
76 views

MVC Architecture Project

I'm trying to focus on learning so I can get an entry level position and the best way for me to learn right now is to have someone review and provide areas of improvement. This project isn't entirely ...
7
votes
2answers
56 views

Append user input to a database

This is my first time writing a Swing+Groovy application that successfully inserts data to SQL tables. It may look like example code, but it is more test code, as I will eventually expand this to a ...
2
votes
1answer
34 views

Managing Layouts in MigLayout

The following code creates a JFrame with a JTextField array in it. It also creates a ...
3
votes
1answer
82 views

Travelling Salesman Problem with visualisation in Java

For practicing purposes, I challenged myself to write a program that solves the TSP and visualises the results step by step. As for now, my program uses a simple nearest neighbour algorithm. I want ...
7
votes
1answer
90 views

Changing look and feel for all current frames

I am using JGoodies Looks to change the look and feel of the application I'm currently working on. I've just created a JMenu with some different themes options for ...
2
votes
0answers
57 views

Model view controller

I will be implementing MVC model in my program but before that, I have done a simple program based on my understanding of the MVC model. I have three pages: The user will enter a value in page one ...
1
vote
0answers
25 views

MVC Swing Application

I want to make sure this is a good implementation of MVC. I started earlier with this code found here and it was horrible compared to what it is now. If it is a good implementation of MVC what, are ...
7
votes
1answer
104 views

Switch-Bulb GUI program

Here is my switch bulb GUI program: ...
2
votes
1answer
65 views

mouseClicked method

The below code is placed in a method . But it seems too large and I would like to shorten it. Is there a better way to do what it does? ...
7
votes
2answers
67 views

Graphics in Conway's Game of Life in Java

I recently coded a program to stimulate Conway's Game of Life. Originally, my program just printed an array of 1's and 0's where the 1's represented the "live" cells, but I tried to teach myself some ...
5
votes
3answers
345 views

Login for desktop application

I am building a login using an API call to a URL that returns JSON data. The login works and is functional but in terms of "correctness" and "professionalism", I am looking to get input from some of ...
10
votes
2answers
103 views

Keyboard music maker

I enjoy making silly programs every once in a while. This is one of them. It makes nice sounding notes that vary slightly depending on the key being entered into a ...
6
votes
2answers
163 views

“Lights off” puzzle

Lights Off is a puzzle game consisting of an \$n\times n\$ grid of lights. At the beginning of the game, some of the lights are switched on. When a light is activated, it and its four neighbors in the ...
5
votes
2answers
146 views

Simple calculator in Java using Swing and AWT

I wrote a simple calculator with general operations. Give me please some advice, suggestions, and criticism about my code: code design, readability, mistakes. Calculator.java ...
1
vote
2answers
55 views

Display A Random Tic-Tac-Toe Board Using Java Swing

This is the problem: (Game: display a tic-tac-toe board) Display a frame that contains nine labels. A label may display an image icon for X or and image icon for O. What to display is randomly ...
2
votes
0answers
52 views

Knowledge Catalogue

All that the program does is query a database that I have setup, when the user selects the returned fields, which are populated based on the selection of the field above it. The application is ...
8
votes
4answers
524 views

Ballistics and arithmetic calculator

I'm a beginner to Java and OOP, and I would really like to learn how to better organize my code! Over the course of a month or two, I made a calculator program with little functions I thought of here ...
8
votes
2answers
123 views

GUI 'simple notepad'

Please give feedback on all aspects of the code, whether it be the commenting, usage of methods, semantics or anything that can be improved. This code looks flawless to me, so any suggestions for ...
2
votes
0answers
52 views

XML to JTree app needs Model/View/Controller refactoring

I'm developing a JavaSE-1.7 Swing application that displays XML files as a JTree. This will be the base for further work, e.g. filtering nodes. My questions, as a ...
7
votes
1answer
69 views

Conversion calculator using polymorphism and Swing

This is my first attempt at a program (outside of school) and I was trying to implement and learn polymorphism on a conversion calculator for volumes and weights. I found myself using long ...
3
votes
1answer
130 views

Printing the month name for the month number

This program asks a user to input any number equal to or between 1-12. It then converts the number to a message that will be printed (Copy the program to see it yourself). Is there a way to make the ...
5
votes
1answer
49 views

Platformer with collisions

Today I started to build my first platformer, first time working with collisions and stuff. Now, surprisingly, everything seems to work, but since this is my first time creating a platformer and I'm ...
2
votes
1answer
32 views

Check for collision with side of screen

I thought of a program where you move a square with the arrow keys. I created it and asked a question about it on Stack Overflow. I copied the last code block of the accepted answer and tried to ...
1
vote
1answer
82 views

Changing color via JRadioButtons and JButtons

I've got my full program working as expected. My full program looks like this: I'm posting a part of my code which changes the color of the circle. The user can change the color of the circle via ...
11
votes
2answers
209 views

Beginner Minesweeper game

I wrote a basic Minesweeper game for practice. It consist 3 classes: Main - only as launcher Cell - controling behavior of single cell Board - coordinating behavior of cells. The hardest part for ...
12
votes
4answers
674 views

Gravity model for a simulator

I am designing a planetary system simulator. The coordinates used are standard for JPanel (0,0 in the upper left corner). My model is based on a class Body: ...
7
votes
3answers
216 views

First 4-function Swing calculator

This is for a high school class I'm taking. Any tips/improvements? ...
0
votes
1answer
39 views

Asking for a number in Java Swing

Is it good way of asking for a number? Should that function return 0 if there is an error? ...
6
votes
1answer
220 views

Paint rectangles to canvas using mouse

Just wanted to post this here to see if anyone has any critiques of my code, if I'm drawing the background image most efficiently, or if I'm doing anything which could benefit from obvious ...
6
votes
2answers
199 views

Heavily nested anonymous classes for Swing UIs

Oftentimes, I write small little dialogs or forms without a UI builder. I usually find myself having a lot of "container" panel variables that just float around. I found this leads to time-wasting ...
5
votes
2answers
68 views

A S.I.N checker, using Luhn's Algorithm, and created in swing.

I have created a program to validate a Canadian S.I.N. using Luhn's Algorithm, and was wondering if there was any way to make it more efficient. From what i can tell, it is already extremely ...
4
votes
1answer
74 views

Implementing Mitchell's best candidate algorithm

I have written an implementation of Mitchell's best candidate algorithm. Mitchell’s best-candidate algorithm generates a new random sample by creating k candidate samples and picking the best of k. ...
11
votes
5answers
1k views

Simple Java calculator using Swing

This is a Java calculator I made for my programming class. I know there must be vast room for improvement. Please bear in mind the fact that this only accepts an integer, then an operator, then ...
3
votes
1answer
94 views

Full screen countdown display

As a part of a bigger application, I wrote code which creates a display for a countdown of a given time. It is nothing fancy, but I would still appreciate a review. I am especially concerned about: ...
5
votes
2answers
280 views

Length Converter

I have a Swing application that converts lengths. Inches to centimeter, feet to yard, etc. I’m wondering if I could make the super large HashMap a little smaller, or more efficient. Any other ...
7
votes
2answers
207 views

JPaint (Java painting app)

I have this painting app called JPaint in Java and I'm wondering if it could be improved. The variable declaration seems repetitive and long, and I think it might ...
3
votes
1answer
78 views

Cinema scheduling

Even though I have asked a question here related to my app using Swing and creating JPanel, I still have other ones about best practice making applications. I'm ...
4
votes
1answer
82 views

Drawing the appropriate shapes onto JFrames

To write a Java class that reads through a text file of drawing commands and draws the appropriate shapes onto JFrames, I have input instructions as follows: ...
2
votes
0answers
48 views

Action Event and checking buttons

I am creating a simple program with multiple buttons. Is this way of checking which button was pressed is ok? Is it better to use switch..case.. statement? ...