From: SourceForge.net <no...@so...> - 2006-11-30 18:06:14
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=4038329 By: nobody Thanks for the reply. The problem fixed itself after I installed a right-click popup menu and set the DefaultModalGraphMouse.setMode(Mode) method. I'm glad you brought up the typecasting. I'm fairly new to Java and perhaps you can tell me the correct way to handle such situations. First let me explain what I'm trying to do. I have 3 custom vertex types that extend UndirectedSparseVertex: The hierarchy looks like this: UndirectedSparseVertex ..........| ..........| .......MonitorVertex .......|..........| .......|..........| ..ClientVertex...BrokerVertex Now I believe the fragile code you're referring to is this line: MonitorVertex v1 = (MonitorVertex) v; The reason for my downcast is that getDrawPaint and getFillPaint both have arguments of type Vertex. However, a requirement I have is that ClientVertex objects and BrokerVertex objects be displayed in different colours. BrokerVertex should be further colour-coded if it is active or not (determined using isActive()). The problem here is that the logic within getDrawPaint and getFillPaint depend on information available through my custom vertex objects -- information which is not contained in the standard Vertex class which is passed in to the methods. What is the correct way to handle this situation? A Vertex object is passed into getDrawPaint and getFillPaint, but my logic depends on info contained in ClientVertex and BrokerVertex (accessed through MonitorVertex). I appreciate the help. Thanks, NT ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=252062 |