本文整理匯總了Java中org.eclipse.swt.custom.StyledText.setWordWrap方法的典型用法代碼示例。如果您正苦於以下問題:Java StyledText.setWordWrap方法的具體用法?Java StyledText.setWordWrap怎麽用?Java StyledText.setWordWrap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.custom.StyledText
的用法示例。
在下文中一共展示了StyledText.setWordWrap方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: newTextArea
import org.eclipse.swt.custom.StyledText; //導入方法依賴的package包/類
public StyledText newTextArea(Composite composite, boolean editable, int sty) {
int style = SWT.MULTI | SWT.V_SCROLL;
if (!editable)
style |= SWT.READ_ONLY;
else
style |= SWT.WRAP;
StyledText d = new StyledText(composite, style);
d.setText("To be entered\ntest\n\test\ntest");
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 80;
gd.widthHint = 460;
gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
d.setEditable(editable);
d.setLayoutData(gd);
d.setFont(FontShop.textFont());
if (keyListener != null)
d.addKeyListener(keyListener);
d.setWordWrap(editable);
WidgetShop.tweakTextWidget(d);
return d;
}
示例2: intializeEditor
import org.eclipse.swt.custom.StyledText; //導入方法依賴的package包/類
private void intializeEditor(StyledText expressionEditor, JavaLineStyler javaLineStyler,Composite toolBarComposite) {
expressionEditor.setWordWrap(false);
expressionEditor.addLineStyleListener(javaLineStyler);
expressionEditor.setFont(new Font(null,"Arial", 10, SWT.NORMAL));
expressionEditor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 0, 0));
expressionEditor.getSize();
addDropSupport();
}
示例3: createCustomAreaWithLink
import org.eclipse.swt.custom.StyledText; //導入方法依賴的package包/類
/**
* Creates a control with some message and with link to the Binaries preference page.
*
* @param parent
* the parent composite.
* @param dialog
* the container dialog that has to be closed.
* @param binary
* the binary with the illegal state.
*
* @return a control with error message and link that can be reused in dialogs.
*/
public static Control createCustomAreaWithLink(final Composite parent, final Dialog dialog, final Binary binary) {
final String binaryLabel = binary.getLabel();
final String prefix = "The requested operation cannot be performed due to invalid '" + binaryLabel
+ "' settings. Check your '" + binaryLabel
+ "' configuration and preferences under the corresponding ";
final String link = "preference page";
final String suffix = ".";
final String text = prefix + link + suffix;
final Composite control = new Composite(parent, NONE);
control.setLayout(GridLayoutFactory.fillDefaults().create());
final GridData gridData = GridDataFactory.fillDefaults().align(LEFT, TOP).grab(true, true).create();
control.setLayoutData(gridData);
final StyleRange style = new StyleRange();
style.underline = true;
style.underlineStyle = UNDERLINE_LINK;
final StyledText styledText = new StyledText(control, MULTI | READ_ONLY | WRAP);
styledText.setWordWrap(true);
styledText.setJustify(true);
styledText.setText(text);
final GridData textGridData = GridDataFactory.fillDefaults().align(FILL, FILL).grab(true, true).create();
textGridData.widthHint = TEXT_WIDTH_HINT;
textGridData.heightHint = TEXT_HEIGHT_HINT;
styledText.setLayoutData(textGridData);
styledText.setEditable(false);
styledText.setBackground(UIUtils.getSystemColor(COLOR_WIDGET_BACKGROUND));
final int[] ranges = { text.indexOf(link), link.length() };
final StyleRange[] styles = { style };
styledText.setStyleRanges(ranges, styles);
styledText.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(final MouseEvent event) {
try {
final int offset = styledText.getOffsetAtLocation(new Point(event.x, event.y));
final StyleRange actualStyle = styledText.getStyleRangeAtOffset(offset);
if (null != actualStyle && actualStyle.underline
&& UNDERLINE_LINK == actualStyle.underlineStyle) {
dialog.close();
final PreferenceDialog preferenceDialog = createPreferenceDialogOn(
UIUtils.getShell(),
BinariesPreferencePage.ID,
FILTER_IDS,
null);
if (null != preferenceDialog) {
preferenceDialog.open();
}
}
} catch (final IllegalArgumentException e) {
// We are not over the actual text.
}
}
});
return control;
}