Download Enhanced Heap Visualization with GCspy
Transcript
Enhancements 38 The opaque pattern fills a tile with a single color. Color-interpolating visualization and all variants of enumeration visualization use this “pattern”. The vertical bar pattern draws a vertical bar with a specific relative height inside the tile. GCspy uses this mode exclusively for the vertical bar visualization mode. The invalid pattern draws a question mark on a red background inside the tile. This pattern is used to indicate tiles with invalid values, for example because the values is outside the stream’s boundaries. Figure 5.6 depicts the classes responsible for rendering tiles, including the FillPattern interface and three of its implementations. The interaction between these classes is characterized in the following. gcspy::vis TileComponent style tileFlags selected marked setTile(tile : Tile) paintComponent(g : Graphics) «interface» FillPattern «use» fill(g : Graphics,area : Rectangle) java::awt «realize» «realize» OpaquePattern HorizontalLinesPattern spacing thickness «use» «realize» DotsPattern Graphics spacing diameter «use» «use» setColor(c) fillRect(x,y,w,h) fillPolygon(points) fillOval(x,y,w,h) Figure 5.6: Diagram of classes responsible for rendering tiles As described earlier in Section 5.3, JList asks TileRenderer to provide a component for drawing a specific tile on the screen. TileRenderer returns a TileComponent instance that is configured to draw the tile in question. JList calls the paintComponent() method of TileComponent and passes a Graphics object that provides methods to perform the actual drawing. TileComponent in turn calls the fill() method of the appropriate FillPattern implementation and passes the Graphics object as well as the rectangular area that should be painted. TileComponent itself also draws additional