views:

119

answers:

1

I'm curious, how does a GUI builder/designer work? My guess ( for Java ), is that it actually creates a JFrame and overrides the events in some way. However, this is only a guess. Can you offer some insight?

+2  A: 

You are pretty much bang on ...

In Glade the fake-window that allows you to drag-and-drop components handles your mouse/keyboard events and makes the backend calls to put the GUI elements in place. These elements are then attached to handlers such as 'on click of button, goto the source element'

It is all pretty trivial when you think about it.

Looking at the glade source might give some insight into how that is done.

IIRC, Glade writes the XML and then renders that to the designer using libglade, rather than your d'n'ds actually creating the elements. Your events build XML files which contain the UI elements and internal designer handlers.

Good Luck

Aiden Bell