Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java GUI Swing Model Explanation

I've been working with Swing for a while now but the whole model/structure of JFrames, paint(), super, etc is all murky in my mind. I need a clear explanation or link that will explain how the whole GUI system is organized.

like image 758
Devoted Avatar asked Dec 16 '08 01:12

Devoted


People also ask

What is Java GUI Swing?

Swing in Java is a lightweight GUI toolkit which has a wide variety of widgets for building optimized window based applications. It is a part of the JFC( Java Foundation Classes). It is build on top of the AWT API and entirely written in java. It is platform independent unlike AWT and has lightweight components.

What is difference between JFrame and Swing?

A JFrame is a Swing component which is the newer one, well today's java GUI development uses mostly Swing as an advantage you can have a lot of community support on it. as far as I know Swing has LookAndFeel Feature that you can configure to change the look of your GUI with just few line of codes.


2 Answers

The same happened to me. Actually to this day I don't quite get 100% how all it works.

Swing is a very flexible framework - perhaps too flexible. With flexibility comes a lot of abstraction and with abstraction comes confusion. :)

I've found the following articles worth reading. They helped me to better understand the big picture of Swing.

  • A Swing Architecture Overview
  • The process of installing a UI delegate, which is just this image:

    The process of installing a UI delegate

They explain quite well how the model and the delegate work. It always drives me mad when I see those JLabel, LabelUI, ui.update, etc.

like image 75
OscarRyz Avatar answered Sep 22 '22 09:09

OscarRyz


Have you looked at the Java Swing Tutorial (click here)? It does a pretty good job of covering the basics of developing Swing applications.

like image 37
Elie Avatar answered Sep 24 '22 09:09

Elie