From: Brett L. <wak...@ea...> - 2005-09-29 21:13:39
|
>> Nope, we don't have this problem anywhere else. It's >> specifically HexMap that's the problem. >I had lots of problems to get scrolling right in the Log window. >Now it is a JFrame containing a JPanel containing a JScrollPane >(which contains the JLabel which contains all the text). >Map Window is a JFrame containing a ScrollPane containing a JPanel >(HexMap, which contains all the small JPanels representing tiles). >I don't claim anything, I just wonder if adding a JPanel (as in LogWindow) >would help (so we would get JFrame/JPanel/JScrollPane/HexMap). I actually had that same idea at one point, but it didn't work. After a little more reading, it seems like the difference between 'heavyweight' and 'lightweight' objects is how they tie into the windowing system. AWT seems to do more things directly with the native windowing system whereas Swing doesn't hook as deeply into the native windowing system. This is what makes Swing objects look significantly better and take up less resources regardless of the platform the code is running on. I'm not really sure what is causing HexMap to be considered 'heavyweight'. As far as I can tell, it's comprised of only lightweight objects. >> Argh. I really gotta stop using Java 1.5 on my systems. I >> apologize for that. >> >> What do you mean by the tiles being clipped? >That the borders are not visible, only the center part. >Or is that specific to me? >I can't believe that *that* is caused by Java version >differences, but you never know.... Ahh... I'm pretty sure I know what that is. In the paint() method for each GUIHex, you'll notice a call to g2.setClip(hexagon) This sets the clipping boundary for each hex to be the size and dimensions of the hexagon. This is probably cutting out the borders on the hexes. However, the reason we need to setClip() is because otherwise the clickable area for each hexagon would be a bunch of overlapping rectangles that cause problems for detecting which hex a click triggers. ---Brett. |