Swing is the name for the GUI toolkit that is packaged with the standard Java SDK. (since 1.2)
1
vote
2answers
26 views
Game Of Life 3 in Java
I have this version of John Conway's Game Of Life in Java:
Frame class:
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import ...
0
votes
0answers
36 views
How to implement MVC on the application scale?
I'm developing a simple conferencing app with a Swing standalone client which connects to enterprise java beans. Users can create "sessions" (conferences) on the server, and then can join those ...
1
vote
1answer
46 views
Better Design Pattern For Terminal-Like GUI
I am working on a java swing project that looks like a Terminal (but with less functionality).
The GUI contains a jTextArea to display output and a jTextField for user input.
Here is an application ...
3
votes
1answer
76 views
Game of Life Animation Java
I have this Board class:
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import ...
-1
votes
0answers
23 views
GUI not working perfectely [closed]
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class tomeddle extends JFrame {
private JLabel label;
private JTextField textfield;
private JButton button;
private JCheckBox ...
1
vote
0answers
75 views
Need some advice how to proceed with my project
I have set up a basic MVC project which should be a student administration application based upon a CSV file as datastore. Each user has a specific role (student, lecturer, professor, leader of degree ...
2
votes
2answers
120 views
Space Invaders Game (Java/Swing)
Recently I have been working on a project in Java for a class in high school: a Space Invaders game. I was wondering if anyone could review it and point out anything I could change to help improve ...
2
votes
1answer
38 views
Applying DocumentListener on multiple JTextField
Say I have 5 JTextField: jTextField1, jTextField2...
Now I want them to behave the same on DocumentListener, so I decided to make only one DocumentListener and set it to the 5 components.
Meanwhile ...
1
vote
1answer
78 views
Some feedback on first attempt to write Java MVC app
I'm writing my first Java MVC application which should be a desktop student administration application with a swing gui. DAO is already implemented: Need some feedback - student administration ...
0
votes
1answer
96 views
Code review for my (incredibly simple) chat room Swing GUI
world. I need somebody to review and polish my GUI code for my very very simple chat client. I haven't built any of the server sockets, so I'll do that later, but for now I just want people to tell me ...
0
votes
1answer
47 views
Code Review/corrections on my Create Account program
I just finished a program that is simple Swing GUI. It takes in User Info, such as password & username, turns them into strings, and puts them in a text file called nuserInfo.txt. I just want ...
3
votes
0answers
66 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?
//main ...
0
votes
1answer
62 views
how do I encapsulate this List<Message> properly?
I know that Swing isn't true MVC:
Using this modified MVC helps to more completely decouple the model
from the view.
Leaving aside the veracity of the above claim, the problem I run into is ...
1
vote
1answer
186 views
How to update my Swing JTable dynamically. MVC Pattern
I have created a program using a version of MVC architecture. The purpose of the code is to scrape the h1 titles of a list of webpages and to return the results to a JTable.
So far I have the ...
2
votes
1answer
89 views
Design Pattern for Swing application
I have a Swing application with no real design pattern. I want to start learning to design Swing or any types of application properly. Here is the main JFrame class.
import java.awt.Component;
...
-1
votes
1answer
121 views
design classes for a JAVA swing application [closed]
I am very new in making JAVA swing applications..
My problem statement is to make a library management application,for which i designed classes as below.
Please tell me whether my design of classes ...
0
votes
2answers
115 views
Repetitive code in minesweeper - how to cure this?
I'm coding a minesweeper clone using Java and Swing. For my current knowledge, I manage to keep it working but two things give me nightmares. Namely, I have a VERY repetitive code so I suppose there ...
2
votes
3answers
114 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?
package newpackage.view;
import java.awt.GridLayout;
import ...
2
votes
0answers
55 views
Help making multi-platform and removing redundancies in “Auto-Updater”
I whipped up some code recently, but due to the way I make a process this can only be run on windows.... doesn't work QUITE how I want it to either. I would love to get some advice from a more ...
0
votes
1answer
81 views
Optimisation suggestions for swing project (NetBeans) [closed]
I was working on my uni project (Digital Clock) when I noticed that it gets really buggy.
I'm using NetBeans (as a requirement) and there is a LOT of code. I'm not that good as well, so I don't know ...
2
votes
1answer
89 views
Java Swing Panel layout
I am working on a Java project for college that involves us setting up a TCP Server and Client. I have that part working and now to add more of a feel to my project I want to add a GUI.
We have not ...
4
votes
1answer
157 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
111 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 left, and if buttons have been placed at the edge of the frame. The end ...
7
votes
1answer
191 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 ...
2
votes
2answers
122 views
Can you guys look at my java project and give me some tips?
So I feel like I'm a good coder, but that's from my point of view. Can you take a look at my code and give me some tips or criticize me on my code. Or give me some tips or things to add or make things ...
3
votes
1answer
162 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
3answers
618 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 ...
3
votes
1answer
640 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 ...
2
votes
0answers
640 views
Implementing a JtabbedPane with detached content pane
I'm working on answering Can I have a JTabbedPane with a JMenuBar?
I've written the Class TabOnlyTabbedPane which extends JTabbedPane so that it only displays the tabs of a JTabbedPane. Instead, when ...
0
votes
1answer
54 views
Is this Swing / Terminal console drop-in idiomatic?
How could this be improved style-wise (or is this good enough) when the need is just to have a console replacement for PrintWriter.format() with backwards compatibility.
class CCConsole // not to be ...
3
votes
2answers
441 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 ...
2
votes
1answer
205 views
How can i clean and organize up my View (MVC) better
So i got the grip on the basic MVC patterns in java using Observer / Observable method. Now in interest of keeping it clean and readable i would like some pointers before i move on regarding how to ...
5
votes
1answer
89 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:
textArea = new JTextArea(10, 55) {
{
setOpaque(false);
}
@Override
protected void ...
3
votes
1answer
151 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.
Connection conn = Utility.getConnection();
Statement stmt = null;
try{
JFileChooser chooser = new ...
1
vote
2answers
4k views
Bouncing ball - for swing event handling tutorial
This is a sample program that I intend to post as part of a series of beginner level Java tutorials. Please provide any feedback on improvements that would make example more clear or ...
1
vote
2answers
2k views
Drawing simple shapes by mouse dragging
i want to make figures of rectangle and circle.
How can i make the code more elegant?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class r extends JPanel
{
...
2
votes
2answers
371 views
Best practice with swing JFrame
From a design perspective, what is the preferred method of creating JFrames: to have a class that extends JFrame or to create a new instance of JFrame?
30
votes
5answers
7k 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 ...
3
votes
2answers
82 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 ...
7
votes
1answer
600 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:
...
9
votes
2answers
486 views
Guessing game - am I using the concept of Objects in Java properly?
I'am 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 ...

