I want to draw a battery meter. For this I am painting my panel with Filled Rectangles using AWT Graphics class. Is it possible that I can add a tooltip so that whenver a mouse is pointed on the top of the rectangle a text is displayed(which will be the value of the battery)?
gunjannigam
28
Junior Poster
Recommended Answers
Jump to PostHi,
You can add a mouse listener to your panel and use setToolTip() method for your Panel, like this:
// in JPanel constructor // ... addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent me){ mouseEnteredHandler(me); } }); // ... constructor ends // ... // private method private void …
All 4 Replies
AndreiDMS
0
Junior Poster in Training
gunjannigam
28
Junior Poster
AndreiDMS
0
Junior Poster in Training
gunjannigam
28
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.