From: Brett L. <wak...@ea...> - 2005-09-28 20:22:59
|
I've gotten ScrollBars on the Map window to work without drawing bugs. Here's the scoop on this badboy: For some reason that I haven't yet pinned down, HexMap is considered a HeavyWeight component. Most Swing objects (JPanel, JLabel, etc) are considered LightWeight components. So, when using JScrollPane with HexMap, the map hexes kept being drawn on top of the scroll bars. The reason being that HeavyWeight components are ALWAYS drawn on top of LightWeight components, regardless of Z-ordering. This has a bunch of legacy reasoning from back when Sun made the transition from AWT to Swing. This is why mixing lightweight and heavyweight components is not recommended. SO, the solution was to use AWT's ScrollPane rather than Swing's JScrollPane. ScrollPane is a heavyweight component because all of AWT's components are heavyweight components. Unfortunately, as you'll see if you examine MapWindow, this causes problems for MouseListeners. Swing objects will automatically pass events up to their parent objects. AWT objects won't. So, the MouseListener needs to be explicitly added to all levels of the hierarchy in order to function, as it is currently being done in MapWindow. For the future: If we can figure out how to make HexMap a lightweight component, I'd really like to do that. There are a lot of good things we gain if we can do it. For now, if you see any drawing weirdness with the MapWindow, this is the likely source. Be careful how you layer AWT and Swing objects. ---Brett. -----Original Message----- From: Brett Lentz <wak...@ea...> Sent: Sep 27, 2005 3:19 PM To: rai...@li... Subject: [Rails-devel] UI Updates I've just committed some UI reorganization and minor cleanups. Here's a rough list of what's changed: 1. We no longer draw every single window when a game starts. The StatusWindow opens, and if it's the beginning of a startRound, the StartRoundWindow opens. That's it. The Stock Market chart is only setVisible during stock rounds, and the Map is only setVisible during Operating Rounds. 2. I've added a series of drop-down menus to the Status Window. This includes an Options menu where you can open any of the other windows as you see fit. 3. I've added Mnemonics to all existing buttons, so now they can be accessed via ALT+key combinations if so desired. I'm still working on getting the MapWindow to correctly use ScrollBars. Hopefully that'll be working fairly soon. ---Brett. ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ Rails-devel mailing list Rai...@li... https://lists.sourceforge.net/lists/listinfo/rails-devel |