开发者

set cursor icon when mousemove on swt table coloumn

开发者 https://www.devze.com 2023-04-01 21:18 出处:网络
I want to add hyperlink on table item in swt but I can not find anymethod for it.NowI want to set cursor icon to hand icon when the cursor move on that particular item column..

I want to add hyperlink on table item in swt but I can not find any method for it.Now I want to set cursor icon to hand icon when the cursor move on that particular item column.. so that particular item feel like a hyperlink.tell me any suggestion or method of this..

public void drawTable(String[] str) {
    if (str != null) {
        TableItem it1 = new TableIt开发者_JS百科em(table, SWT.NONE);
        int i = str.length;
        String[] tmp = new String[i];
        tmp[0] = str[0];
        tmp[1] = str[1];
        int k = i - 1;
        for (int j = 2; j < i; j++, k--) {
            tmp[j] = str[k];
        }
        it1.setText(tmp);
        for (i = 2; i < str.length; i++) {
            it1.setForeground(i, display.getSystemColor(SWT.COLOR_BLUE));
        }
    }
}


If you want to add hyperlink to table cell, you'll have to write your own StyledCellLabelProvider see StyledCellLabelProvider snippet for details. It's also similar question to How to add Hyperlink in SWT Table`s column?.


Use table.addMouseMoveListener.


I found that there is no option for making item data as hyperlink. So i just colored my item data and check the coordinate of the point where user click and check that it is in the column or not, which i use as column for hyperlink and do my operation...

Thanks to all. code will paste soon.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号