?????? endLine??=??getItemCount();
???? for??(int??i??=??beginLine;??i??<??endLine;??i++)??{
?????? boolean;
?????? if??(i??==??rowSel)
?????? selected??=??true;
?????? onPaint(gc,??i,??cx,??beginy??+??(i??-??beginLine)??*??lineHeight,
???????? selected);
???? }
???? }
?? });
?aà?òa×¢òaμ?ê?′óPaintEvent?D??è?μ?x,y,height,widthê?Dèòa????μ???óò£?x,yê?ò????tμ?×óé????a?-μ?μ?×?±ê?£?ú?ò??μ?3ìDò?D£??aá?D??ü?e??£??ò???è?ù?YDèòa????μ???óò????3?Dèòa????μ?DDêy£????????àó|μ?DD£???2?ê??????????t?????£?ò??3ìDò?Dó?μ?μ?onPaintó?óú????ò?DD?£
?ó??à′£??ò??òaè??ò??μ????t?ìó|?ü?ìé????ü??áD±í????DD?????£?ò??ò????òé??üμ?′|àí?aày£?ê×?èμ±ó??§°′á??òé??üê±£??ò??Dèòa??±?????£?2¢?ò?????éμ?oíD?μ????????£è?1???????ò??-μ?á?áD±íμ??¥2?£??ò???1Dèòaí?ê±1??ˉ1??ˉì??£
addListener(SWT.KeyDown,??new??Listener()??{
???? public??void??handleEvent(Event??event)??{
???? switch??(event.keyCode)??{
???? case??SWT.ARROW_UP:??//??′|àí?òé??ü
?????? if??(rowSel??!=??0)??{
?????? oldRowSel??=??rowSel;
?????? rowSel--;
?????? if??(oldRowSel??!=??rowSel)??{??//·¢?í???¢è????t????
???????? ((Canvas)??event.widget).redraw(cx,??(rowSel??+??cy
?????????? /??lineHeight)
?????????? *??lineHeight,??maxX,??lineHeight*2,??false);
?????? }
?????? if??(rowSel??<??-cy??/??lineHeight)??{??//è?1?Dèòa£?1??ˉ1??ˉì?
???????? ScrollBar??bar??=??((Canvas)??event.widget)
?????????? .getVerticalBar();
???????? bar.setSelection(bar.getSelection()??-??lineHeight);
???????? scrollVertical(bar);
?????? }
?????? selectionChanged();??//??·¢?íselectionChangedê??t
?????? }
?????? break;
???? case??SWT.ARROW_DOWN:??//??down??arror??key
?????? …
?????? break;
???? }
???? }
?? });
?a·¢Eclipse×??¨ò????t(3)
ê±??:2011-02-09 IBM áo?1
?ó??à′£??ò??òaè??ò??μ????t?ìó|êó±ê??áD±í????DD?????£ê×?è?ò??òa????3?êó±ê???Dμ?DDo?£?×¢òaMouseEvent?Dμ?y?μ??ê??à??óú???t×óé???μ?×?±ê£??ò??Dèòa?óé?1??ˉ3?á????tμ?2?·??£
addMouseListener(new??MouseListener()??{
???? public??void??mouseDoubleClick(MouseEvent??e)??{
???? }
???? public??void??mouseDown(MouseEvent??e)??{
???? int??row??=??(e.y??-??cy)??/??lineHeight;??//???????Dμ?DD
???? if??(row??>=??0)??{
?????? oldRowSel??=??rowSel;
?????? rowSel??=??row;
???? }
???? if??(oldRowSel??!=??rowSel)??{??//?????-?éμ?oíD?μ???????
?????? ((Canvas)??e.getSource()).redraw(cx,??(e.y??/??lineHeight)
???????? *??lineHeight,??maxX,??lineHeight,??false);
?????? ((Canvas)??e.getSource()).redraw(cx,??(oldRowSel??+??cy
???????? /??lineHeight)
???????? *??lineHeight,??maxX,??lineHeight,??false);
???? }
???? selectionChanged();
???? }
???? public??void??mouseUp(MouseEvent??e)??{
???? }
?? });
μ±?ò??μ????t??μ??1μ?ê±£????Dμ?áD±í??DèòaóDDé?ò±íê????tμ?μ??1μ??£μ±??μ??òê§è¥?1μ?ê?£??ò???aà???Dèòa?òμ¥μ?í¨?a???Dμ??????-?£
addFocu
|