-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access to ContenPane #7
Comments
Hi, with the current jGAF API (EZEnvironment et al. classes were written before Java introduces Generics), there is no other way than using cast... I understand this is quite "old school" ;-), but I never updated the API to use Generics, enabling a more generic use of various types of Component as the ContentPane... Patrick |
Hello Patrick, In the EZUIStarterImplem class, the EZFrame of JFrame is extended. Many greetings |
Hi Andreas, first of all: very sorry for the delay of my answer, but unfortunatelly I don't have much time to spend on this project as I would have (because of my current job position). However, I take the time ;-) to dig into the code. The way the API works is, for short: the framework handles the entire startup of the application and its main Frame, the one that is shown on screen. During that startup procedure, the developper (you, me, etc.) is supposed to populate the Frame with a content (a Component class) through the use of the getApplicationComponent() method (see for instance example: https://github.com/pgdurand/jGAF-Tutorial/blob/master/src/com/plealog/gaf4j/tutorial/part2/TutorialTwoUIStarter.java#L49). That method is not intended to be reused elsewhere, but only during startup. On the other hand, you can get the master application Frame using EZEnvironment.getParentFrame(). When I designed the API, I was a little confused: did I use Frame (AWT) or JFrame (Swing), did I use Component (AWT) or JComponent (Swing). I chose to rely the API on AWT components. But having in mind that getApplicationComponent() should returns a Swing component. This is my mistake in the design of jGAF. In your original post, maybe I misunderstood this : "This is done in a menu manager class in a switch case loop, in which I assign the component as a frame to a variable via EZEnvironment.getEZUIListener.getApplicationComponent()." As stated above, that method call is intended to be done by the framework, not by "you". For instance, in other softwares where I use jGAF API, if I need to access the content (usually a JPanel) of my master JFrame, I keep a reference to that object somehow. cheers, |
Hello,
I am programming a billing programme for my IT project and I am using jGAF.
I have developed an application interface that loads the appropriate JPanel via the respective menu selection.
This is done in a menu manager class in a switch case loop, in which I assign the component as a frame to a variable via EZEnvironment.getEZUIListener.getApplicationComponent().
But I can't get to the ContentPane of the frame via this. I have to convert this to a JFrame via a cast, from which I can add the panel to the interface via .getContentPane().add(new WorkPanel, BorderLayout.CENTER).
Of course, I would like to do this without a cast, because that can always lead to errors.
Is there another possibility, or can this functionality of accessing the ContentPane directly be included in the framework?
The text was updated successfully, but these errors were encountered: