






Classifcation and dynamic gui creation
Dynamic Interface:
Our purpose is to be able to dynamically recreate GUI interfaces, while still keeping functionality of old Guis linked up together. More or else what this will do is be a
general tool that should eventually remake almost any type of GUI suited to the user while still holding all functionalities of the orginal GUI.
What I have been able to accomplish:
Well for now, I have been able to recognize different swing components on a particular
GUI and than re-draw the GUI dynamically while trying to keep the events linked with the new Gui.
what I have not been able to do:
I have not been able to, keep both the test gui and the dynamically linked by events.
Workings of the program:
what I do is I have made my test.java as a parent as I inherit from it.
I keep an instance of the class test to first find out what components it actually
contains.
this is done throught the classificationprint method which prints out all the components
of the parent class
then I store the components in a tree like data structures using classify method.
here is what it is like:
I use my own little data structure called cholder
it contains an object and a vector.
So my main data structure is like this
Vector ————————————–
cholder | cholder | cholder | cholder
|
each cholder contains one component as an object and a vector
of any subcomponents in that components which are also stored
in data structure type of cholder.
if a component does not have any subcomponents it's vector in cholder will just be blank
Than I traverse through this tree like data structure identifying each component
and recreate each component from top level to bottom with the graphical changes
e.g if there is button we get info about button settings from the variable and create
our new button with color or size changes.
I have done only implemented some simple things buttons and text area's as I have arrived to some problems. which I will discuss.
Problems:
I am assuming that I am using action performed as my basic event handler as I don't
know how to incorporate a generic handler for each different program.
what I do, is after recreating my Gui i just call super.actionperformed(event e)
so that I can map exactly the mapping with test GUI. this seems to work fine for most things.
But for example, if I click a button and I want to print out what was in my text area, since I am using the parent actionperformed, in which I just say the local textare.getText(); and then print it out, this does not work as in the tool I am
automagically making the text area so therefore my actionperformed is referencing the wrong variable I have to look into it to see how to get around this.
Solution: to this problem is to make your own subclass of Jbutton and override some of the doclick methods.
I was not able to, to implement this as I did not quite know with what to override the
Swing components.
Discoveries found out when using this program
If I add a component such as button, or things that can't have subcomponents to my
rootpane() aka the frame, java automatically puts them in a panel and then adds that panel to the root pane. What this does is that it further confuses me how to handle which panel which button. I can tell that a panel contains a button and vice versa but not the specific position.
If I continue to figure out new ways to find exaclty which panel contains what I think
I can recreate any application that is made in a frame.
As far as eventhandling goes I think that where the limitation is in trying to recreate the program must know what type of handler is being used.
The serializing of objects, I have not explored this option as much as I don't have enough knowledge but can look into it if desired as it may be a better way of creating
the tool than what I have already.
note the attached files:
cholder.java
cholder.class
classtool.class
classtool.java
test.class
test.java