From: Rinalldo Y. <ry...@cs...> - 2004-10-17 09:39:33
|
Hi Christoph, thank you for your reply This is also the first time for me to convert a stand alone application into applet, so I am still working out the solution. In my previous experience in using applet, basically all you have to do is have a frame or anything that you want to display gets constructed properly in the applet class. Then make the applet class "show" that frame. Since tmNav has a frame called TMNavMainFrame in which every panels and menus are included (based on my understanding of the source code), I assume all I have to do is create a TMNavMainFrame class variable in the applet class and constructs it exactly like the TMNavMainFrame is constructed in the tmNav. I assumed that all I had to do was to set the TMNavMainFrame in TMNav not to show anything and show TMNavMainFrame which is inside the applet class instead, however I kept getting NullPointerException. Even after I put additional method in TMNav class called getFrame() which returns TMNavMainFrame inside TMNav class, it still wouldnt work. So I have the following: class myApplet extends Applet{ TMNavMainFrame test = null; TMNav application = null; // must have this //init must be overridden void init(){ //basically contains what is inside of the main function in TMNav //most important are: // application.getInstance().makeInstance(); // application.getInstance().show(); // if the show function is called, then TMNav runs on separate window // since i want the frame to be displayed in the applet, it was turned // off test = application.getInstance().getFrame(); test.show(); } } with this way, the getFrame() method is somehow returning null and hence I got the NullPointerException (it is supposed to return TMNavMainFrame inside TMNav) and since I called it after everything was constructed properly (that is, after the show() function is normally called in the main function), that I have no idea why it is returning null. any comments ? On Sun, 17 Oct 2004, Christoph Froehlich wrote: > Hi Rinalldo, > > I've never developed an applet so I'm just guessing, but I think that > you are on the right track. TMNav creates on startup a JFrame that is > used as its base container. > > I just had a look at the code and I think it shouldn't be too difficult > to make TMnav use a given java.awt.Container to use at its base > container. If it turns out to be fruitful, I would do a refactoring, to > enable the use of TMNav as an applet. > > Nevertheless, some questions come to my mind: > > When developing an applet, are you creating the basic container by your > own, or is it provided by the enviroment (browser, appletviewer)? > > What is about Menubars in applets. Are they supported? > > TMnav sometimes opens new frames for some features. (TologQuery, several > dialogs). How do you deal with the concepts of opening dialogs in > applets. I think you are not allowed to open a window from an applet, or > are you? > > > Hmm. I'm not really decided, whether it is possible to refactor TMNav > without extravagant expenses. What do you think? > > bye > c > > > PS: If your sole target is to get xtm displayed as a graph in an applet, > you may have a look a Jens Kaschniks Hypergraph-Project (for kings & > queens: http://hypergraph.sourceforge.net/examples_tm_kaq.html) > > > > Am So, den 17.10.2004 schrieb Rinalldo Yasahardja um 9:20: >> Hi, I am planning to make tmnav running on applet so I can share work on >> the server, that is, so my teammates can directly look at xtm files on the >> server using tmnav. The catch is, now tmnav runs on separate window. So >> when I viewed the applet using apppletviewer, the applet window said >> "Applet loaded" but tmnav is on its own window (which makes sense since it >> was a stand alone application anyway). Hence there are 2 windows opened. >> >> However, when i tested it with html page, the applet did not show anything >> on the webpage. Is it possible because of the fact that tmnav runs on its >> own window and NOT on the applet window ? >> >> anyone know how to fix this ? >> >> thanks heaps in advance >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: IT Product Guide on ITManagersJournal >> Use IT products in your business? Tell us what you think of them. Give us >> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more >> http://productguide.itmanagersjournal.com/guidepromo.tmpl >> _______________________________________________ >> Tm4j-tmnav-dev mailing list >> Tm4...@li... >> https://lists.sourceforge.net/lists/listinfo/tm4j-tmnav-dev > -- > Christoph Froehlich <cf...@fo...> > |