atarw / material-ui-swing

A modern, Material Design UI for Java Swing
MIT License
654 stars 86 forks source link

Add support mouser hover and multiple fix #62

Closed vincenzopalazzo closed 5 years ago

vincenzopalazzo commented 5 years ago

Hello @atarw,

This is my personal solution at the problems #58 #60

I changed some things, I seemed to add the MaterialUITimer as a listener since it is a native component and then I thought of adding a getMovement method to the MateriUIMovement class, so maybe to solve the problem even for those who do not have the possibility to use the add method.

therefore MaterialUiMovement hours could be used in the following two ways

//Test effect mouse over
//Setting default
JButton testButtonHoverOne = new JButton("Fly over me One");
testButtonHoverOne.setEnabled(false);
pn.add(testButtonHoverOne);

//ModSetting
JButton testButtonHoverTwo = new JButton("Fly over me Two");
testButtonHoverTwo.setBackground(MaterialColors.LIGHT_BLUE_500);
testButtonHoverTwo.setForeground(MaterialColors.WHITE);
testButtonHoverTwo.addMouseListener(MaterialUIMovement.getMovement(testButtonHoverTwo, MaterialColors.LIGHT_BLUE_200));
pn.add(testButtonHoverTwo);

using MaterialUIMvement in this way I should be able to solve also the problem reported in this issue

I took a look at your example and saw that when you hover over any button where the background color should change, this ONLY happens when you move the mouse away from the current button and hover over it again.

atarw commented 5 years ago

Sorry I haven't checked github recently I cracked my laptop screen and won't be able to fix it until next week :/

I haven't looked over the code thoroughly but I'll assume it works and will solve the issue lol.

vincenzopalazzo commented 5 years ago

@atarw Thanks for you confidence, I will active in this period for fixed my code in case it does not work, but I hope works :)

I'm sorry for your display, I hope you come back sooner stronger than before (like the Saiyan "Sorry the sarcasm") :)