This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi Everyone, I am a beginner with Swing and I have to complete a project that is due soon. So I would be grateful if somebody could help me out. I basically have a JFrame and a JPanel inside it to draw a few lines and circles. I am making a time graph inside the JPanel using raw x and y coordinates. I want to achieve the following: 1.I want to draw a small circle at the point where two lines meet. 2.I would also like to have a small pop up box with a message inside it when the user brings his mouse over this circle. I would not like to have a JOptionPane but instead a small window as I have lots of text (multiple lines)to display. When the user moves his mouse away from this circle, then the message box should close automatically. I have already done point 1. by having a public void paintComponent(Graphics g) method in which I am using the graphics object to draw lines and circles. PROBLEM: My main problem is in point 2, where I would like to add mouse listeners to this circle and somehow to implement this pop box. How can I achieve this? Can I have event handlers on a "circle" and that also inside the paintComponent method? Which swing component should I use for the popup window and how can I use it for my purpose? Any help in this regard (sample code)would be highly appreciated. Thanks in advance! Sanjit