Questions tagged [swing]

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

Filter by
Sorted by
Tagged with
7
votes
1answer
1k 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 ...
5
votes
1answer
54 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
71 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
3k 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
181 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
2k 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 ...
8
votes
2answers
16k 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
48 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
132 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
1k 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 I'...
6
votes
3answers
23k 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 ...
2
votes
0answers
215 views

JAX-WS client to accept server certificates

I am building a JAX-WS client with a GUI that connects to a server by accepting self-signed server certificates (when it uses HTTPS). The accepting of the certificates is not automatic, it is similar ...
4
votes
1answer
164 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: ...
5
votes
1answer
9k 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
1k 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 ...
5
votes
1answer
35k 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
4answers
5k 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
1k 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
5k 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
171 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
2k 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 calculation....
14
votes
2answers
196 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
535 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
167 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
vote
1answer
431 views

CSV File Reader 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
108 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
147 views

Managing Layouts in MigLayout

The following code creates a JFrame with a JTextField array in it. It also creates a JMenuBar...
3
votes
1answer
1k 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 ...
8
votes
1answer
2k 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
420 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
212 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
2k views

Switch-Bulb GUI program

Here is my switch bulb GUI program: ...
1
vote
1answer
87 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? ...
8
votes
2answers
3k 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 ...
6
votes
3answers
3k 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 ...
11
votes
2answers
250 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
3k 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
5k 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
1k 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
69 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
1k 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 ...
9
votes
2answers
3k 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
789 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
896 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 ...
5
votes
3answers
62k 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
306 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
44 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
704 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 two ...
11
votes
2answers
41k 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
5k 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: ...

1
3 4
5
6 7
9