SWT StyledText试用 [可下载项目代码]

[color=red][b]效果图 和 源代码:[/b][/color]
[url=http://www.iteye.com/upload/attachment/42205/f2c47d16-8b0d-3ee4-9014-5b2d677fb35c.jpg]效果图[/url]
[img]http://www.iteye.com/upload/attachment/42205/f2c47d16-8b0d-3ee4-9014-5b2d677fb35c.jpg[/img]

[url=http://lggege.iteye.com/topics/download/7a83264f-66f5-3728-8366-6442900f39bb]源代码[/url] 点击下载.
注: 代码在JDK1.5, Eclipse3.2 和 Eclipse3.4均可使用.
选择运行: TxtApplication.java 即可

[color=red][b]关键代码:[/b][/color]
[b]字体[/b]:
StyleRange.font = Font;


[b]粗体[/b]:
StyleRange.fontStyle = SWT.BOLD;


[b]斜体[/b]:
StyleRange.fontStyle = SWT.ITALIC;


[b]下划线[/b]:
StyleRange.underline = true;


[b]删除[/b]:
StyleRange.strikeout = true;


[b]前景色[/b]:
StyleRange.foreground = Color;


[b]背景色[/b]:
StyleRange.background = Color;


[b]上升[/b]:
StyleRange.rise = int;


[b]左对齐[/b]:
StyledText.setLineAlignment(startLine, length, SWT.LEFT);


[b]居中[/b]:
StyledText.setLineAlignment(startLine, length, SWT.CENTER);


[b]右对齐[/b]:
StyledText.setLineAlignment(startLine, length, SWT.RIGHT);


[b]拖拽[/b]:
		DropTarget dropTarget = new DropTarget(StyledText, DND.DROP_MOVE);
dropTarget.setTransfer(new Transfer[] { ObjectTransfer.getInstance() });
dropTarget.addDropListener(new DropTargetAdapter() {
public void drop(DropTargetEvent event) {
//...
}
});



[b][color=red]相关资料:[/color][/b]
[url=http://www.eclipse.org/articles/StyledText%201/article1.html]Getting Your Feet Wet with the SWT StyledText Widget[/url]

[url=http://www.eclipse.org/articles/StyledText%202/article2.html]Into the Deep End of the SWT StyledText Widget[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值