[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]:
[b]粗体[/b]:
[b]斜体[/b]:
[b]下划线[/b]:
[b]删除[/b]:
[b]前景色[/b]:
[b]背景色[/b]:
[b]上升[/b]:
[b]左对齐[/b]:
[b]居中[/b]:
[b]右对齐[/b]:
[b]拖拽[/b]:
[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]
[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]