• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help fixing bug related to JButton-->Mouse Adaptor-->Mouse Entered and Exited

 
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just run the following code and move the mouse next to the text of the button and you will see exactly what I am talking about. Anyway to prevent this continuous flash?

 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know... what do you expect to happen instead?

It looks to me like you have a design where when you mouse over a button, a form -- including that button -- disappears. And when you mouse away from the button, the form is supposed to reappear. Only problem is, how is the code supposed to tell when you mouse away from an invisible button? It's pretty clear to me that the code thinks that when the button disappears, you've moused away from it, and therefore it makes the form reappear right away. So that's why the flashing happens.

Problem is, the design doesn't quite make sense (because of what I described there). Can you describe what you actually wanted?
 
Charles Sexton
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:I don't know... what do you expect to happen instead?

It looks to me like you have a design where when you mouse over a button, a form -- including that button -- disappears. And when you mouse away from the button, the form is supposed to reappear. Only problem is, how is the code supposed to tell when you mouse away from an invisible button? It's pretty clear to me that the code thinks that when the button disappears, you've moused away from it, and therefore it makes the form reappear right away. So that's why the flashing happens.

Problem is, the design doesn't quite make sense (because of what I described there). Can you describe what you actually wanted?



I see what you are saying....Im trying to make it where when I mouse over a JComponent that a list of buttons is shown for selection. I pretty much used an undecorated Jframe to hold the list of buttons in which is hiding the parent frame and button.....
 
Charles Sexton
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

There are other design options for the interface I can do....this one I just wanted to really try.
 
Paul Clapham
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Charles Sexton wrote:Im trying to make it where when I mouse over a JComponent that a list of buttons is shown for selection. I pretty much used an undecorated Jframe to hold the list of buttons in which is hiding the parent frame and button.....



Okay, but making the whole application disappear seems like overkill to me. Here's what I would do: put the list of buttons into your application in a JPanel (with a suitable layout manager) from the very start, and make it not visible (i.e. call setVisible(false) on the JPanel). Then when you mouse over the component, just call setVisible(true) on the JPanel.

(Of course making that panel visible might cause the mouse-controller component to move as part of the redrawing, so you might still have a similar problem, so you should design your application's GUI so that doesn't happen.)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic