swing - Is it possible in Java Applet to apply mouseover in a particular cell not in all cells of a table? -
i quiet new swing.i have jtable 6 columns. 5th cell in row want mouseover. can't attach image because need @ least 10 reputation add image.
please me. in advance.
html code same thing want in java applet <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>simple css based pulldowns</title> <meta http-equiv="content-type" content="text/html; charset=windows-1256" /> <style type="text/css"> <!-- /* set menu style */ .menuhead { font-weight: bold; font-size: larger; background-color: #a9a9a9;} .menuchoices { background-color: #dcdcdc; width: 200px;} .menu {color: #000000; text-decoration: none;} .menu a:hover {text-decoration: underline;} /* position menus */ #menu1 {position: absolute; top: 10px; left: 10px; width: 200px;} #menu2 {position: absolute; top: 10px; left: 210px; width: 200px;} #menu3 {position: absolute; top: 10px; left: 410px; width: 200px;} --> </style> <script type="text/javascript"> <!-- /* we'll allow dom browsers simplify things*/ (document.getelementbyid ? domcapable = true : domcapable = false); function hide(menuname) { if (domcapable) { var themenu = document.getelementbyid(menuname+"choices"); themenu.style.visibility = 'hidden'; } } function show(menuname) { if (domcapable) { var themenu = document.getelementbyid(menuname+"choices"); themenu.style.visibility = 'visible'; } } //--> </script> </head> <body dir="rtl"> <div id="menu1" dir="rtl" class="menu" onmouseover="show('menu1');" onmouseout="hide('menu1');"> <div class="menuhead">moteur de recherche</div> <div id="menu1choices" class="menuchoices"> <a href="http://www.google.com">google</a><br /> <a href="http://www.yahoo.com">yahoo</a><br /> <a href="http://www.teoma.com">teoma</a><br /> <a href="http://www.msn.com">msn</a><br /> <a href="http://www.altavista.com">altavista</a><br /> </div> </div> <div id="menu2" dir="rtl" class="menu" onmouseover="show('menu2');" onmouseout="hide('menu2');"> <div class="menuhead">e-commerce</div> <div id="menu2choices" class="menuchoices"> <a href="http://www.ebay.com">ebay</a><br /> <a href="http://www.buy.com">buy</a><br /> </div> </div> <div id="menu3" dir="rtl" class="menu" onmouseover="show('menu3');" onmouseout="hide('menu3');"> <div class="menuhead">e-books</div> <div id="menu3choices" class="menuchoices"> <a href="http://www.javascript.com">javascriptref</a><br /> <a href="http://www.w3c.org">w3c</a><br /> <a href="http://www.pint.com">pint</a><br /> </div> </div> <script type="text/javascript"> <!-- /* don't hide menus js off , older browsers */ if (domcapable) { hide("menu1"); hide("menu2"); hide("menu3"); } //--> </script> </body> </html>
some action should perform
what kind of action?
you can add mousemotionlistener
table , handle mousemoved(...)
event:
point previouscell = new point(-1, -1); @override public void mousemoved(mouseevent e) { jtable table = (jtable)e.getsource(); int row = rowatpoint(e.getpoint()); int column = columnatpoint(e.getpoint()); point currentcell = new point(row, column); if (currentcell != previouscell) { //do previouscell = currentcell; } }
Comments
Post a Comment