I am having two problems: 1.) My MenuBar with Menus containing MenuItems behaves inconsistently. On NT the menus are drop down whereas when I come home and work on my 98 box they drop up. I know it sounds crazy and I wouldn't even care except the menu rises up off the screen! This was totally unexpected unwelcome and I don't know what to do about it. 2.) Are you guys using the method pack of class Frame? Whenever I do it causes some bizarre problems whenever I refresh my screen as a result of a booking. Without it, no problems, with it, problems that I don't know how or where they come from. When I refresh there will be partial writing but it LOOKS as though (although it's not true) another window has been moved in front of a part of my GUI and then the GUI has not refreshed. Very bizarre. If you guys/gals aren't packing, then what ARE you doing?
Matt, 1) it seems you have done more than the assignment spec. requires. We do not need to implement any menubar in our flight table reservation window, do we? 2) can you rephrase your problem? Rudy
posted 19 years ago
I don't think I've done more than what has been asked, I have the bare minimum actually, it's just the way I chose to make my GUI, everyone can do their GUI however they like. Functionally, it does exactly what it must and nothing more. To clarify. I have a menu bar at the top, and then withi the menu bar are menus. When you click on a menu a drop down box pops up with the items you can select. On NT it does drop down. However, on 98 it goes UP. instead of starting at the menu bar and going down, it starts at the menu bar and the choice go up. So they go up off the screen. I've never seen anything like it. The other problem appears to be in how my GUI refreshes. It's strang because sometimes when I update a view There will be a blank square (that spans several rows and columns) and it cuts off in the middle of a row or column sometimes so that you see half a word or part of data. It's as if a window has been moved in front of my GUI and then removed, but the GUI didn't refresh (but of course that's not that case, but it's like what hapens to an applet that a window has been\ moved in front of but the applet has not been refreshed.
With regard to the problem of blank squares, I have also experienced it a few times but it is tolerable. I have experimented with different layout schemes (in non-SCJD assignments)- and I find that certain complex combination and nestings of layout managers don't work especially when using GridBagLayout. Even otherwise the Swing gui is demanding on the system resources. I don't know about the specs of your computer, but maybe this problem will not occur if you are using PIII750 with oodles of RAM and a powerful graphics card. Also Swing is not threadsafe- Are you accessing components using the Event Dispatch thread (using invokeLater()/invokeAndWait() of SwingUtilities). I am using pack(); show(), without any problems. The menu behaviour is funny. Maybe it is sending a message - not to take life tooo seriously - because you will never get out of it alive.
posted 19 years ago
Rathul, <laugh> Good advice and good sense of humor. Some of this is true, and the opportunity to chuckle at how serious I take things in light of the fragility and uncertainty of life is refreshing. Thank you. But I can have at whilst I discuss... I don't think that it's system resources although this diagnosis makes sense. I can see it (it being the cleared area) on an NT box 700 MHz with 256 MB RAM. If that is a limiting factor, then to hell with Swing <laugh>. Some of the other things you say aren't clear to me but it's not because you didn't speak clearly, it's because I'm uneducated on those topics. I'll remedy that situation and investigate further. Your suggestions are very gratefully received. With Respect, Matt
Hi Matt, This is what I came accross in JawaWorld (1999-12) article: "...The other problem is that Swing doesn't correctly update the menu bar as items are added to and removed from it in all situations..." Alen Holub (famous by his threading series) presents his solution to this problemm. May be its related to what you are experiencing. Regards, Ihor