The Source for Java Technology Collaboration

Home » java.net Forums » Java Desktop Technologies » SwingLabs

Thread: Starting point to understand inside Swing

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 2 - Last Post: May 22, 2008 8:14 AM by: aberrant
gusti_andika

Posts: 4
Starting point to understand inside Swing
Posted: May 21, 2008 9:41 PM
 
  Click to reply to this thread Reply

Hi guys,
Im very impressed and excited to found there are so many great swing component here. I'm an junior programmer in one of software company in japan and hoping someday could hack into swing to making some advance component based on swing.
What do i have to studying as a starting point to understand the mechanism inside swing? and what thing we have to studying to be able create swingx like component.

Thank, any commet would be very appreciated.

Best Regards
Gusti

desibel

Posts: 7
Re: Starting point to understand inside Swing
Posted: May 22, 2008 2:08 AM   in response to: gusti_andika
 
  Click to reply to this thread Reply

Swing is based on model-view-controller(MVC), so in order to understand swing you have to understand MVC. This is the way Swing controls what to display, how to display it and eventually what will happen to it. All swing components have a GUI and a model + different types of listeners that have to be implemented in order to create an action when something happens in the model or GUI. So basically swing says: don't update the GUI I will update it for you if you update the model. :) Swing needs an event to be fired in order to do this and in order to create advanced "new" components you have to make and fire that event in the model.

The more advanced underlying mechanisms such as Look & Feel that tells the GUI how to draw itself is a huge topic, and is something that gives swing the power to do "anything".

If you take a look at some of the UI classes in swing you will se that they implement som sort of logic that tells the component that uses the UI class how to be painted.

So to answer your question you have to understand at least:
-MVC
-Events and Actions
-Listeners
-How to paint a component (UI)
-Graphics + Graphics2D
-Interfaces

You can propably create swingx like components without understandig all above, but in order to make it work properly you have to have an understanding of all the above.

But as a starter, you should first learn how the existing swing components work :)

Cheers.

aberrant

Posts: 90
Re: Starting point to understand inside Swing
Posted: May 22, 2008 8:14 AM   in response to: gusti_andika
 
  Click to reply to this thread Reply

Welcome Gusti,

I would encourage you to read the Java Tutorial Trail: Creating a GUI with JFC/Swing (http://java.sun.com/docs/books/tutorial/uiswing/). It has a lot of the basics you are looking for. There is a tutorials forum if you have questions http://forums.java.net/jive/category.jspa?categoryID=65. Once you have the basics down Kirill Grouchnikov wrote a great piece on writing custom components. http://today.java.net/pub/a/today/2007/02/22/how-to-write-custom-swing-component.html

Good Luck,

Collin




 XML java.net RSS