gray = GUIResource.getInstance().getColorDarkGray(); widget.addPaintListener( new PaintListener() { @Override public void paintControl( PaintEvent pe ) {
parent.addPaintListener(borderPainter);
parent.addPaintListener(borderPainter);
public static void main(String[] args) { Display display = Display.getDefault(); Shell shell = new Shell(display, SWT.DIALOG_TRIM); shell.setLayout(new FillLayout()); Composite c = new Composite(shell, SWT.BORDER); c.setLayout(new FillLayout()); c.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.drawLine(0, 0, 100, 50); } }); Label lbl = new Label(c, SWT.NONE); lbl.setText("text"); shell.open(); while (!shell.isDisposed()) { if (display.readAndDispatch()) { display.sleep(); } } }
public static void main(String[] args) { Display display = Display.getDefault(); Shell shell = new Shell(display, SWT.DIALOG_TRIM); shell.setLayout(new FillLayout()); Composite c = new Composite(shell, SWT.BORDER); c.setLayout(new FillLayout()); c.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.drawLine(0, 0, 100, 50); } }); Label lbl = new Label(c, SWT.NONE); lbl.setText("text"); shell.open(); while (!shell.isDisposed()) { if (display.readAndDispatch()) { display.sleep(); } } }
Utils.addListenerAndChildren(cRow, SWT.MouseExit, listenerRow); cRow.addPaintListener(listenerRowPaint);
mainComposite.addPaintListener(new PaintListener() {
public static void debugLayout(final Composite c, final int color) { c.addPaintListener(e -> { Color save = e.gc.getForeground(); e.gc.setForeground(Display.getCurrent().getSystemColor(color)); e.gc.drawRectangle(1, 1, c.getBounds().width - 1, c.getBounds().width - 1); // e.gc.drawLine(1, 1, c.getBounds().width - 1, c.getBounds().height - 1); e.gc.setForeground(save); }); }
protected void highlight(final Composite parent, final Label labelControl, final Combo comboBox, final int color) { Object data= labelControl.getData(); if (data == null) { if (color != HIGHLIGHT_NONE) { PaintListener painter= new HighlightPainter(parent, labelControl, comboBox, color); parent.addPaintListener(painter); labelControl.setData(painter); } else { return; } } else { if (color == HIGHLIGHT_NONE) { parent.removePaintListener((PaintListener) data); labelControl.setData(null); } else if (color != ((HighlightPainter) data).fColor){ ((HighlightPainter) data).fColor= color; } else { return; } } parent.redraw(); }
if (color != HIGHLIGHT_NONE) { PaintListener painter= new HighlightPainter(); parent.addPaintListener(painter); labelControl.setData(painter); } else {
private void installCompositeListeners(Composite c) { if (!c.isDisposed()) { printAddListener(c, "PAINT"); //$NON-NLS-1$ c.addPaintListener(paintListener); printAddListener(c, "MOUSETRACK"); //$NON-NLS-1$ c.addMouseTrackListener(mouseTrackListener); printAddListener(c, "SWT.MenuDetect"); //$NON-NLS-1$ c.addListener(SWT.MenuDetect, compositeListener); printAddListener(c, "SWT.MouseDown"); //$NON-NLS-1$ c.addListener(SWT.MouseDown, compositeListener); printAddListener(c, "SWT.MouseDoubleClick"); //$NON-NLS-1$ c.addListener(SWT.MouseDoubleClick, compositeListener); } }
private void installCompositeListeners(Composite c) { if (!c.isDisposed()) { printAddListener(c, "PAINT"); //$NON-NLS-1$ c.addPaintListener(paintListener); printAddListener(c, "MOUSETRACK"); //$NON-NLS-1$ c.addMouseTrackListener(mouseTrackListener); printAddListener(c, "SWT.MenuDetect"); //$NON-NLS-1$ c.addListener(SWT.MenuDetect, compositeListener); printAddListener(c, "SWT.MouseDown"); //$NON-NLS-1$ c.addListener(SWT.MouseDown, compositeListener); printAddListener(c, "SWT.MouseDoubleClick"); //$NON-NLS-1$ c.addListener(SWT.MouseDoubleClick, compositeListener); } }
private void installCompositeListeners(Composite c) { if(!c.isDisposed()) { printAddListener(c, "PAINT"); //$NON-NLS-1$ c.addPaintListener(paintListener); printAddListener(c, "MOUSETRACK"); //$NON-NLS-1$ c.addMouseTrackListener(mouseTrackListener); printAddListener(c, "SWT.MenuDetect"); //$NON-NLS-1$ c.addListener(SWT.MenuDetect, compositeListener); printAddListener(c, "SWT.MouseDown"); //$NON-NLS-1$ c.addListener(SWT.MouseDown, compositeListener); printAddListener(c, "SWT.MouseDoubleClick"); //$NON-NLS-1$ c.addListener(SWT.MouseDoubleClick, compositeListener); } }
public void setControl(final Composite composite, Rectangle cellArea, boolean addListeners) { if (composite == null) { dispose(); this.composite = null; return; } this.composite = composite; this.cellArea = cellArea; if (addListeners) { composite.addPaintListener(this); composite.addMouseListener(this); composite.addMouseMoveListener(this); composite.addMouseTrackListener(this); } setForeground(-1, -1, -1); setText(null); setToolTip(null); composite.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { dispose(); } }); if (coreDataSource != null && !isDisposed()) { invokeVisibilityListeners(TableCellVisibilityListener.VISIBILITY_SHOWN, true); } }
border = new CSSBorderPropertiesImpl(); control.setData(CSSSWTConstants.CONTROL_CSS2BORDER_KEY, border); parent.addPaintListener(CSSSWTHelpers .createBorderPaintListener(engine, control));
border = new CSSBorderPropertiesImpl(); control.setData(CSSSWTConstants.CONTROL_CSS2BORDER_KEY, border); parent.addPaintListener(CSSSWTHelpers .createBorderPaintListener(engine, control));
parent.addPaintListener( new PaintListener(){
container.addPaintListener(e -> onPaint(e)); MenuManager manager = new MenuManager(); IMenuListener listener = manager1 -> contextMenuAboutToShow(manager1);
button.setSize(fIconSize + 4, fIconSize + 4); button.setLocation((index * (fIconSize + spacing) + spacing - fSpacing), 2); button.addPaintListener(e -> { if (fSelectedProvider == provider) { fSelectedProviderButton = button;
final Composite parent= labelControl.getParent(); PreferenceHighlight highlight= new PreferenceHighlight(parent, labelControl, mainControl); parent.addPaintListener(highlight);