Questions tagged [swing]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
9 votes
3 answers
32k views

How to reduce size of jar file?

I dont know how to reduce the size of jar file. When we normally code in Java Swing the jar file is created, is there any way to reduce the size of jar file? I can't remove the images and other stuff ...
9 votes
5 answers
8k views

How many classes are too many?

I'm making a Book Manager App using Java Swing that allows me to do a variety of things such as opening a txt list of books, searching for books, adding/removing books. There are different classes ...
3 votes
3 answers
13k views

What is good programming practice for structuring java project?

I have a Java project that is getting to be relatively large (a few thousand lines in all, I'd say). It's definitely a lot larger than what I've dealt with before, being that I am still a relatively ...
0 votes
1 answer
168 views

Exception handling with failure atomicity in desktop applications

When it comes to exception handling, there are many guidelines and best practices on the web. On of them is to throw early, catch late, or even Don't Catch. So when facing an exception, the current ...
2 votes
2 answers
318 views

MVC: Should my domain model look like this?

Consider the following GUI screen (Java Swing) with a list of persons where the user can select a person and delete it. According to MVC, the view observes (observer pattern) the model and updates ...
2 votes
1 answer
116 views

How to properly model an MVC model in this case?

I aim to understand pull model MVC. I'm stuck at defining a model for a simple color-guessing game in Java Swing I chose to practice it. I borrowed the model's initial version from an example which ...
-2 votes
1 answer
100 views

How can I transfer a users information in a dashboard page after he/she logs in?

I am developing a Bank Management Project. Now I am stuck in a point. I want to create a login page where a user will submit his/her username and password then after clicks on the login button, a new ...
1 vote
1 answer
246 views

Controller class for an input dialog

I am learning OOP, concretely Java, by developing a real life business application for aimed for repair shops. I have followed MVC pattern design for GUI elements of my application. I was wondering do ...
3 votes
8 answers
15k views

Frustration with Java Swing layout managers

I have been trying for years to master Swing layout managers with no success. Every time I need to do something with Swing, it is like pulling nails to get the visual components to line up the way I ...
-3 votes
1 answer
234 views

Java swing debugging [closed]

I have programmed a Java Swing application. I have some bugs in my program and I want to discover where in the code these errors occurs. With normal code (Non-GUI related code) I apply debugging for ...
4 votes
1 answer
13k views

Do threads delete themselves?

Let's say I was working on a Swing application. Most of it is run on the EDT using SwingUtilities.invokeLater() inside the main method, because I heard (please correct me if I'm wrong) that that's ...
-3 votes
2 answers
106 views

Determine image value by image name

I'm making a blackjack game, and I want to take my cards images and give each a value for the game. I'm not sure how to determine their value. Should I just do a big switch statement with all the ...
1 vote
1 answer
526 views

How to quickly present 1000s of pictures in a jlist

I need people opinions on how to improve a code I've written. Let's assume we have an application cataloging movies (~3500 of them) and actors (~1000, but I need to double-check this). Both actors ...
11 votes
3 answers
14k views

Using MVC in a Java app

I need to write a cross-platform GUI application to process (in multiple threads) and visualize fairly large quantities of data. Ideally the application should be relatively fast and look good. The ...
-1 votes
1 answer
760 views

MVC with several MVC-patterns and gameloop

I made a small program using several MVC-patterns. So far I havnt got to much stuff to put in the model so I havnt got any model yet. My idea is to make one MVC pattern for each panel. And looping ...
1 vote
3 answers
3k views

Is anybody using JavaFX

I'm very tempted to use it purely because of its neat Binding APIs, and now that you're able to use it in conjunction with Swing it feels like a natural progression. The only thing that I can seem ...
12 votes
5 answers
2k views

Why do Windows Forms / Swing frameworks favour inheritance instead of Composition?

Today a professor of mine commented that he found it odd that while SWT's philosophy is one of making your own controls by composition, Swing seems to favour inheritance. I have almost no contact ...
27 votes
1 answer
8k views

Is shipping a Clojure desktop app realistic?

I'm currently shipping a desktop Java application. It is a plain old Java 5 Java / Swing app and so far everything worked nicely. Java 5 was targetted because some users were on OS X version / ...
3 votes
0 answers
2k views

How to pass control between sub-controller to parent controller in Java MVC Design Pattern?

I'm pretty new in Java, but I've done plenty of research and I know what MVC is. However, to implement MVC in Java was a difficult task. I followed this tutorial, which helped me to realise that the ...
1 vote
3 answers
3k views

How can I write complex validation and business logic that can be reused in both direct data model changes and pending dialog changes?

I was hoping for some advice: I need to design a software solution for a medium-sized java / Swing application. The application will have about 200 use cases requiring complex data validation and ...
10 votes
2 answers
15k views

How to completely decouple Model from View/Controller in Java Swing

Is there a collection of commonly-agreed-upon design guidelines for separating the Model classes from the View/Controller classes in a Java Swing app? I'm not so concerned that the View/Controller ...
1 vote
2 answers
1k views

How to manage data flow between UI components?

I have been trying to use classes that implement ActionListener to respond to user input. I'm consistently noticing that for an action listener to communicate the event to other objects, it has to ...
0 votes
1 answer
214 views

Adding a graphical view to a system

I currently have an program in Java that simulates railway movements. Essentially, trains arrive on platforms, pick up and drop off passengers, and then proceed, respecting signalling where possible. ...
0 votes
1 answer
979 views

Architecture for my Java application [closed]

I try to create small Java tools to help me at my work every now and then. Usually these do not have to be pretty and I find myself coding a single, sometimes massive, Java class. However, now my plan ...
5 votes
1 answer
12k views

What is the advantage of 'SwingUtilities.invokeLater()' method?

For the below sample GUI program using javax.swing, public class UnResponsiveUI extends JFrame{ private boolean stop = false; private JTextField tfCount; private int count = 1; ...
4 votes
1 answer
876 views

Why 'JButton' is-a 'Container' in javax.swing?

As per the class hierarchy in java.awt.*, class Button & class Label is-a class Component, and Component is not a Container, which make sense to me. As per the redesign of class hierarchy in ...
5 votes
2 answers
804 views

Does having many duplicated methods and deep inheritance hierarchies in GUI APIs (Java Swing, Android SDK) violate the SOLID design principles?

For those unfamiliar with the SOLID principles you can start reading here: Wikipedia article. However, most of my understanding comes from: http://www.objectmentor.com/resources/publishedArticles.html ...
0 votes
1 answer
78 views

Is it fine for a class that creates objects to delegate them?

I have a large list of intercommunicating components; so I decided to have one class create all of them and then subsequently delegate them to other classes to facilitate finer tweaking and wiring ...
0 votes
1 answer
204 views

Is it fine to skip MVC?

I am building a pair of components that communicates in a one-way fashion: [ JButton ] --> data...process...process...out --> [ JTextField ] The JButton allows the user to select a file and ...
0 votes
1 answer
152 views

Where to put variables needed across classes?

I have 3 classes: a JButton extension, FButton; a JTextField; and a JPanel extension, FPanel, that would contain one instance of both. The FButton is supposed to open a file, and make the file name ...
2 votes
2 answers
967 views

Is there a way to not use the Observer pattern when creating GUI systems?

In Java, the Swing library implements the Observer/Subscriber-Publisher design pattern to design the way the program responds to events on the GUI (button clicks, etc). The programmer registers ...
4 votes
1 answer
2k views

Opensource showcase for MVC in Java Swing [closed]

I've allready created small desktop CRUD applications using Java/Swing. In hindsight I'm not quite sure if the overall design of these applications is good. I've also done some reading on MVC and ...
-1 votes
1 answer
297 views

Help in (re)designing my Swing application [closed]

I have developed a Swing application that controls execution of several scripts like jobs. I need to display the interim output of the jobs concurrently. I have followed MVC while writing the ...
1 vote
3 answers
324 views

GUI programming - who should be an owner

I know nothing about gui programming. I try to learn. I have simple question... For example, I have small program. I have class that extends JFrame with main Window (MyWindowClass) and my "logic" ...
0 votes
1 answer
3k views

How to manage a lot of Action Listeners for multiple buttons

I have this Tic Tac Toe game and I thought of this really cool way to draw out the grid of 9 little boxes. I was thinking of putting buttons in each of those boxes. How should I give each button (9 ...
2 votes
3 answers
2k views

Animation in Swing

I have a project written using Swing, and I want to make it more smoothly (like JavaFX is) by adding animation to some components(JButton, JScrollPane, JSplitPane) using javax.swing.Timer. UPD: That ...
5 votes
2 answers
3k views

Publish/subscribe, observer pattern implementation question

I'm developing desktop application in java/swing. I have a component that is registered as a subscriber to many panels and gets messages (my custom event) from them. That component is something like ...
3 votes
3 answers
3k views

Why doesn't Swing look native out of the box?

Java Swing GUI's don't look native by default (Except on Mac OS X for some reason). Swing uses it's own look and feel. You can get Swing to use the system look and feel by putting: javax.swing....
3 votes
3 answers
345 views

MVC seems to create dependencies that just "don't feel right"

I might be misunderstanding MVC, so forgive me if that is the case. This is my program structure (Java/Swing): I have a JTable (View) that is pointed to by a custom linked list (Model). When the user ...
2 votes
1 answer
448 views

Criteria for selecting MigLayout for GUI code?

It seems to be easier to use and more feature rich than standard swing layouts. It looks like a do it all replacement for all standard layouts. If you are making simple code to just show the time in a ...
1 vote
1 answer
427 views

Java Swing ActionListener design

I have a form that includes an area for putting in address information and a table that shows the addresses that have been added. I've separated out the ActionListener for the "add address" button on ...
14 votes
8 answers
14k views

Do you start migrating your Swing project to JavaFX [closed]

I have a 4 years old project which is written in Swing + SwingX. Currently, it is still alive and still kicking. However, as more GUI related feature requests coming in (For instance, a sortable tree ...
2 votes
1 answer
1k views

How to debug through a swing based application effectively

I am trying to understand how a radio button is created in a Dynamic field by reading from an XML using Netbeans 7.0. I know the radio button is created because of the XML being read from database, ...
2 votes
8 answers
5k views

Should Swing knowledge be required from Java programmers? [closed]

Swing is an integral part of the Java API. It is also the most popular GUI framework for Java. I still wonder, should every Java programmer still know, or at least be pretty familiar with, Swing (...
2 votes
1 answer
126 views

Statistics for and Details About Open Source Swing Projects

I'm looking for process-relative information on open-source Swing projects: how the task was described how many developers were involved how much time the solution was taken etc. Are there any open ...
11 votes
3 answers
13k views

What drawbacks does Java Swing GUI framework have? [closed]

I have used Java Swing for some desktop applications. But I haven't used other GUI frameworks that much so I can't compare them. There is definitely some things that I like with Swing and some that I ...
18 votes
2 answers
14k views

What are the best practices of Java Swing development?

While doing my pre-research for this question, I found that there isn't much well-organized information about Java Swing best practices out there on the Internet. So I figure I'll give Stack Exchange ...
2 votes
1 answer
197 views

Separating model from UI

I have a Swing application with a custom TreeModel that can refer to domain instances. I'm wondering what changes I could make if I consider moving to a web interface later on. Would a pluggable model ...
0 votes
1 answer
788 views

what is Docking Framework

I searching for undestanding Docking Framework concept in web, but I don't understand its concept and benefit. I see exist several 'Docking Framework' in java such as Netbeans Platform or MyDoggy or ...
4 votes
3 answers
8k views

Advantage of using Swing over AWT [closed]

Why is Swing preferred over AWT? Which Swing component could be used for playing a video on it?