Atitit. button cursor over highlight toggle and other dynamic effect implementations css HTML js--attilax Summary
4. mouse over the dynamic picture switch implementation 1
4.1. Priority mode :: CSS mode ... 1
4.2. Second Mode 2:: Set the property mode. 1
4.3. final Pattern 3:: Write Mouse Listener 1
4. Mouse over the dynamic picture switch implementation 4.1. Priority mode:: CSS mode ...
C + + QT can use this mode
However, this pattern can only be backgroud,,, without an img SRC attribute:
Author :: Old Wow's paw attilax ayron, email:[email protected]
Reprint please indicate source: Http://blog.csdn.net/attilax
4.2. Second Mode 2:: Set the property mode.
Java does not support CSS mode, you can use attribute mode. However, the set of properties is much more, you can extract an extension class.
And a HTML5 LAN, IMG still does not support this mode.
4.3. Final mode 3:: Write Mouse Listener
HTML JS is implemented using jquery
$ ("#n3a_r2_c2"). Hover (function () {
$ (this). attr ("src", "images_hover/hove_splice_r2_c2.gif");
},
function () {
$ (this). attr ("src", "img_comm/3a_r2_c2.gif");
} );
Implementation of Java
Test
Public Static FinalColor button_foreground_color = color.white;
- Private Booleanhover;
the
* PublicRbutton () {
$SetFont (NewFont ("System", Font.plain,));
Panax Notoginseng setborderpainted (false);
-Setforeground (BUTTON_COLOR2);
thesetfocuspainted (false);
+ setcontentareafilled (false);
AAddmouselistener (NewMouseadapter () {
the@Override
+ Public voidmouseentered (MouseEvent e) {
-Setforeground (button_foreground_color);
$hover =true;
$repaint ();
- }
-
the @Override
- Public voidmouseexited (MouseEvent e) {
WuyiSetforeground (BUTTON_COLOR2);
thehover =false;
-repaint ();
Wu }
- });
About }
Reference
Atitit. GUI Picture Non-rule button and dynamic picture switch implementation Mode Summary java. NET C # C + + web HTML js-attilax column - blog channel -CSDN.NET.htm
JButton Big Makeover - a wen online-blogjava.htm
Atitit. The implementation of the button cursor over the highlight toggle and other dynamic effects css HTML JS--attilax summary