Java Code Examples for org.eclipse.swt.custom.StyledText#setBackground()
The following examples show how to use
org.eclipse.swt.custom.StyledText#setBackground() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StyledTextCellEditor.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 初始化默认颜色、字体等 * @param textControl * ; */ private void initStyle(final StyledText textControl, IStyle cellStyle) { // textControl.setBackground(cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR)); textControl.setBackground(GUIHelper.getColor(210, 210, 240)); textControl.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); textControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING); textControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN); textControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN); textControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN); textControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN); // textControl.setLeftMargin(0); // textControl.setRightMargin(0); // textControl.setTopMargin(0); // textControl.setBottomMargin(0); textControl.setFont(JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT)); textControl.setIME(new IME(textControl, SWT.NONE)); }
Example 2
Source File: StyledTextCellEditor.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 初始化默认颜色、字体等 * @param textControl * ; */ private void initStyle(final StyledText textControl, IStyle cellStyle) { // textControl.setBackground(cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR)); textControl.setBackground(GUIHelper.getColor(210, 210, 240)); textControl.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); textControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING); textControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN); textControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN); textControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN); textControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN); // textControl.setLeftMargin(0); // textControl.setRightMargin(0); // textControl.setTopMargin(0); // textControl.setBottomMargin(0); textControl.setFont(JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT)); textControl.setIME(new IME(textControl, SWT.NONE)); }
Example 3
Source File: ScrolledTextEx.java From SWET with MIT License | 6 votes |
private StyledText createStyledText() { styledText = new StyledText(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); // SWT.WRAP GridData gridData = new GridData(); styledText.setFont( new Font(shell.getDisplay(), "Source Code Pro Light", 10, SWT.NORMAL)); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessVerticalSpace = true; styledText.setLayoutData(gridData); styledText.addLineStyleListener(lineStyler); styledText.setEditable(false); styledText .setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY)); return styledText; }
Example 4
Source File: ExportJavaViewer.java From http4e with Apache License 2.0 | 6 votes |
void createStyledText(Composite parent){ text = new StyledText(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); // text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); GridData spec = new GridData(); spec.heightHint = HEIGHT; spec.widthHint = WEIGHT; spec.horizontalAlignment = GridData.FILL; spec.grabExcessHorizontalSpace = true; spec.verticalAlignment = GridData.FILL; spec.grabExcessVerticalSpace = true; text.setLayoutData(spec); text.addLineStyleListener(lineStyler); text.setEditable(false); Color bg = Display.getDefault().getSystemColor(SWT.COLOR_WHITE); text.setBackground(bg); }
Example 5
Source File: CellEditor.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
@Override protected Control activateCell(Composite parent, Object originalCanonicalValue, Character initialEditValue) { if (originalCanonicalValue == null || !(originalCanonicalValue instanceof CellEditorCanonicalValue)) { return null; } StyledText textControl = createTextControl(parent); // init style IStyle cellStyle = getCellStyle(); textControl.setBackground(GUIHelper.getColor(210, 210, 240)); textControl.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); //textControl.setFont(cellStyle.getAttributeValue(CellStyleAttributes.FONT)); textControl.setLineSpacing(TmxEditorConstanst.SEGMENT_LINE_SPACING); textControl.setLeftMargin(TmxEditorConstanst.SEGMENT_LEFT_MARGIN); textControl.setRightMargin(TmxEditorConstanst.SEGMENT_RIGHT_MARGIN); textControl.setTopMargin(TmxEditorConstanst.SEGMENT_TOP_MARGIN); textControl.setBottomMargin(TmxEditorConstanst.SEGMENT_TOP_MARGIN); textControl.setIME(new IME(textControl, SWT.NONE)); setCanonicalValue(originalCanonicalValue); textControl.forceFocus(); return textControl; }
Example 6
Source File: ParamView.java From http4e with Apache License 2.0 | 6 votes |
void setEditable( boolean editable){ StyledText st = (StyledText) textView.getControl(); if (editable) { // bodyText.setFont(ResourceUtils.getFont(Styles.FONT_COURIER)); st.setForeground(ResourceUtils.getColor(Styles.GRAY_RGB_TEXT)); st.setBackground(ResourceUtils.getColor(Styles.BACKGROUND_ENABLED)); st.setEditable(true); attachManager.setEnabled(true); } else { // bodyText.setFont(ResourceUtils.getFont(Styles.FONT_COURIER)); st.setForeground(ResourceUtils.getColor(Styles.LIGHT_RGB_TEXT)); st.setBackground(ResourceUtils.getColor(Styles.PINK_DISABLED)); st.setEditable(false); attachManager.setEnabled(false); } }
Example 7
Source File: SeparatorPanel.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public void initComponents(String label) { GridLayout gridLayout = new GridLayout(2, false); setLayout(gridLayout); GridData layoutData = new GridData(); layoutData.grabExcessHorizontalSpace = true; layoutData.horizontalAlignment = GridData.FILL; setLayoutData(layoutData); // Text label StyledText gridLinesLabel = new StyledText(this, SWT.NONE); gridLinesLabel.setEditable(false); Display display = Display.getDefault(); FontData data = display .getSystemFont().getFontData()[0]; Font font = new Font(display, data.getName(), data.getHeight(), SWT.BOLD); gridLinesLabel.setFont(font); gridLinesLabel.setBackground(Display.getCurrent().getSystemColor (SWT.COLOR_WIDGET_BACKGROUND)); gridLinesLabel.setText(label); // Separator line Label separator = new Label (this, SWT.SEPARATOR | SWT.HORIZONTAL); GridData separatorData = new GridData(); separatorData.grabExcessHorizontalSpace = true; separatorData.horizontalAlignment = GridData.FILL; separatorData.horizontalIndent = 5; separator.setLayoutData(separatorData); }
Example 8
Source File: PWLabel.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * @see org.eclipse.nebula.widgets.opal.preferencewindow.widgets.PWWidget#build(org.eclipse.swt.widgets.Composite) */ @Override public Control build(final Composite parent) { if (getLabel() == null) { throw new UnsupportedOperationException("You need to set a description for a PWLabel object"); } labelWidget = new StyledText(parent, SWT.WRAP | SWT.READ_ONLY); labelWidget.setEnabled(false); labelWidget.setBackground(parent.getBackground()); labelWidget.setText(getLabel()); SWTGraphicUtil.applyHTMLFormating(labelWidget); return labelWidget; }
Example 9
Source File: EvalExpressionAction.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { GridData gd = new GridData(GridData.FILL_BOTH); StyledText text = new StyledText(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL); text.setLayoutData(gd); text.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); text.setText(this.text); return text; }
Example 10
Source File: DerivedSourceView.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override protected void inititalizeColors() { IPreferenceStore store = preferenceStoreAccess.getPreferenceStore(); getColorRegistry().addListener(this); StyledText textWidget = getSourceViewer().getTextWidget(); textWidget.setForeground( getColorFromStore(store, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, SWT.COLOR_WIDGET_FOREGROUND, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND)); textWidget.setBackground( getColorFromStore(store, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, SWT.COLOR_INFO_BACKGROUND, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)); lineNumberRulerColumn.setForeground( getColorFromStore(store, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR, SWT.COLOR_WIDGET_FOREGROUND, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR)); lineNumberRulerColumn.setBackground( getColorFromStore(store, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, SWT.COLOR_WIDGET_BACKGROUND, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)); lineNumberRulerColumn.setFont(getFont(getViewerFontName())); }
Example 11
Source File: ExpressionBuilder.java From birt with Eclipse Public License 1.0 | 5 votes |
private void updateStyledTextColors( StyledText styledText ) { if ( preferenceStore != null ) { styledText.setForeground( getForegroundColor( preferenceStore ) ); styledText.setBackground( getBackgroundColor( preferenceStore ) ); } }
Example 12
Source File: DetailsView.java From scava with Eclipse Public License 2.0 | 5 votes |
public void insert(Composite parent, int numberOfRow) { for (int i = 0; i < params.length; i++) { String param = params[i]; new Label(parent, SWT.NONE).setText(""); StyledText lbl = new StyledText(parent, SWT.FULL_SELECTION | SWT.READ_ONLY | SWT.WRAP); lbl.setAlwaysShowScrollBars(false); lbl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); if( param.matches("^[a-zA-Z0-9]+:\\/\\/.*$") ) { lbl.setFont(SWTResourceManager.getFont("Segoe UI", 7, SWT.UNDERLINE_LINK)); lbl.setForeground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND)); lbl.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_HAND)); lbl.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { eventManager.invoke(l -> l.onOpenInBrowserRequest(param)); } }); }else { lbl.setFont(SWTResourceManager.getFont("Segoe UI", 7, SWT.NORMAL)); } lbl.setText(param); if (numberOfRow % 2 == 0) { lbl.setBackground(SWTResourceManager.getColor(206, 234, 255)); } } }
Example 13
Source File: SuffixText.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Creates, configures and returns the suffix text control. */ private StyledText createSuffixText() { StyledText styledText = new StyledText(this, SWT.TRANSPARENT); styledText.setText(""); styledText.setForeground(INACTIVE_COLOR); styledText.setBackground(getDisplay().getSystemColor(SWT.COLOR_TRANSPARENT)); styledText.setEditable(false); styledText.setEnabled(false); styledText.setLeftMargin(0); return styledText; }
Example 14
Source File: TextDiffDialog.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private void createText(Composite parent, String value, String otherValue, Site site) { StyledString styled = new StyledString(value); new DiffStyle().applyTo(styled, otherValue, site, action); StyledText text = new StyledText(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP); text.setText(styled.toString()); text.setStyleRanges(styled.getStyleRanges()); text.setEditable(false); text.setBackground(Colors.white()); UI.gridData(text, true, true); }
Example 15
Source File: ParamView.java From http4e with Apache License 2.0 | 4 votes |
void setBackground( Color color){ StyledText st = (StyledText) textView.getControl(); st.setBackground(color); }
Example 16
Source File: CheckForUpdates.java From Rel with Apache License 2.0 | 4 votes |
/** * Create the composite. * * @param parent * @param style */ public CheckForUpdates(Composite parent, int style) { super(parent, style); GridLayout gridLayout = new GridLayout(1, false); gridLayout.marginHeight = 0; gridLayout.marginWidth = 0; gridLayout.verticalSpacing = 0; gridLayout.horizontalSpacing = 0; setLayout(gridLayout); setVisible(false); txtStatus = new StyledText(this, SWT.WRAP); txtStatus.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); txtStatus.setEditable(false); txtStatus.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK)); txtStatus.setBackground(getBackground()); txtStatus.setFont(FontSize.getThisFontInNewSize(txtStatus.getFont(), 10, SWT.NORMAL)); txtStatus.addMouseListener(mouseHandler); txtStatus.setCaret(new Caret(txtStatus, SWT.NONE)); setText("Rel updates?"); updateChecker = new UpdatesCheck(parent.getDisplay()) { @Override public void completed(SendStatus sendStatus) { CheckForUpdates.this.completed(sendStatus); } }; TimerTask checkForUpdates = new TimerTask() { @Override public void run() { if (CheckForUpdates.this.isDisposed()) return; getDisplay().asyncExec(() -> { if (CheckForUpdates.this.isDisposed()) return; setVisible(true); setText("Rel updates?"); System.out.println("CheckForUpdates: check for updates."); updateChecker.doCancel(); updateChecker.doSend(); }); } }; // Check for updates after 10 seconds, then every 12 hours Timer checkTimer = new Timer(); checkTimer.schedule(checkForUpdates, 1000 * 5, 1000 * 60 * 60 * 12); }
Example 17
Source File: JavaSourceViewer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
protected void initializeViewerColors() { if (fPreferenceStore != null) { StyledText styledText= getTextWidget(); // ----------- foreground color -------------------- Color color= fPreferenceStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT) ? null : createColor(fPreferenceStore, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, styledText.getDisplay()); styledText.setForeground(color); if (fForegroundColor != null) fForegroundColor.dispose(); fForegroundColor= color; // ---------- background color ---------------------- color= fPreferenceStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT) ? null : createColor(fPreferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, styledText.getDisplay()); styledText.setBackground(color); if (fBackgroundColor != null) fBackgroundColor.dispose(); fBackgroundColor= color; // ----------- selection foreground color -------------------- color= fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR) ? null : createColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR, styledText.getDisplay()); styledText.setSelectionForeground(color); if (fSelectionForegroundColor != null) fSelectionForegroundColor.dispose(); fSelectionForegroundColor= color; // ---------- selection background color ---------------------- color= fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_DEFAULT_COLOR) ? null : createColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR, styledText.getDisplay()); styledText.setSelectionBackground(color); if (fSelectionBackgroundColor != null) fSelectionBackgroundColor.dispose(); fSelectionBackgroundColor= color; } }
Example 18
Source File: IllegalBinaryStateDialog.java From n4js with Eclipse Public License 1.0 | 4 votes |
/** * 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.getOffsetAtPoint(new Point(event.x, event.y)); final StyleRange actualStyle = offset >= 0 ? styledText.getStyleRangeAtOffset(offset) : null; 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; }
Example 19
Source File: StyledTextDescriptor.java From n4js with Eclipse Public License 1.0 | 4 votes |
/** * Creates and returns with a new {@link StyledText styled text} instance hooked up to the given parent composite. * * @param parent * the parent of the styled text control. * @param style * style bits for the new text control. * @return a new styled text control initialized from the descriptor. */ default StyledText toStyledText(final Composite parent, final int style) { final StyledText text = new StyledText(parent, READ_ONLY | style); text.setText(getText()); text.setStyleRanges(getRanges()); text.setFont(getFont()); text.setEditable(false); text.setEnabled(false); final AtomicReference<Color> colorRef = new AtomicReference<>(); final IPreferenceStore prefStore = EditorsUI.getPreferenceStore(); if (null == prefStore || prefStore.getBoolean(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) { colorRef.set(getDefault().getSystemColor(COLOR_LIST_BACKGROUND)); } else { RGB rgb = null; if (prefStore.contains(PREFERENCE_COLOR_BACKGROUND)) { if (prefStore.isDefault(PREFERENCE_COLOR_BACKGROUND)) { rgb = getDefaultColor(prefStore, PREFERENCE_COLOR_BACKGROUND); } else { rgb = getColor(prefStore, PREFERENCE_COLOR_BACKGROUND); } if (rgb != null) { colorRef.set(new Color(text.getDisplay(), rgb)); } } } if (null != colorRef.get()) { text.setBackground(colorRef.get()); text.addDisposeListener(e -> { if (!colorRef.get().isDisposed()) { colorRef.get().dispose(); } }); } text.pack(); return text; }
Example 20
Source File: PromptSupportSnippet.java From nebula with Eclipse Public License 2.0 | 4 votes |
private static void createStyledText(final Group group) { group.setLayout(new GridLayout(2, false)); group.setText("StyledText widget"); final Label lbl0 = new Label(group, SWT.NONE); lbl0.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl0.setText("No prompt :"); final StyledText txt0 = new StyledText(group, SWT.BORDER); txt0.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); final Label lbl1 = new Label(group, SWT.NONE); lbl1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl1.setText("Simple text prompt :"); final StyledText txt1 = new StyledText(group, SWT.BORDER); txt1.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); PromptSupport.setPrompt("Type anything you want", txt1); final Label lbl2 = new Label(group, SWT.NONE); lbl2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl2.setText("Other style (bold) :"); final StyledText txt2 = new StyledText(group, SWT.BORDER); txt2.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); PromptSupport.setPrompt("Type anything you want in bold", txt2); PromptSupport.setFontStyle(SWT.BOLD, txt2); final Label lbl3 = new Label(group, SWT.NONE); lbl3.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl3.setText("Behaviour highlight :"); final StyledText txt3 = new StyledText(group, SWT.BORDER); txt3.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); PromptSupport.setPrompt("Type anything you want", txt3); PromptSupport.setFocusBehavior(FocusBehavior.HIGHLIGHT_PROMPT, txt3); final Label lbl4 = new Label(group, SWT.NONE); lbl4.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl4.setText("Change colors :"); final StyledText txt4 = new StyledText(group, SWT.BORDER); txt4.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); PromptSupport.setPrompt("Type anything you want", txt4); PromptSupport.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_YELLOW), txt4); PromptSupport.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_BLACK), txt4); final Label lbl5 = new Label(group, SWT.NONE); lbl5.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl5.setText("Change when widget is initialized :"); final StyledText txt5 = new StyledText(group, SWT.BORDER); txt5.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); txt5.setText("Remove what is typed..."); txt5.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_BLACK)); txt5.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_YELLOW)); PromptSupport.setPrompt("Type anything you want", txt5); PromptSupport.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE), txt5); PromptSupport.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_WHITE), txt5); }