region.add(350, 0, 981, 51); region.add(circle(380,51,30)); region.add(circle(951,51,30)); region.add(380, 51, 571, 30); shell.setRegion(region); Rectangle rsize = region.getBounds(); cpyRegion.add(0, 0, 161, 51); cpyRegion.add(circle(28,51,28)); cpyRegion.add(28, 51, 133, 28); cpyLbl.setRegion(cpyRegion);
region.add(pixel);
Region region = new Region(); region.add(new int[] {3, 3, 20, 20, 3, 20}); Canvas c = new Canvas(this, SWT.NONE); c.setBounds(35, 35, 60, 60); c.setRegion(region); Menu menu = new Menu(this); c.setMenu(menu); MenuItem mntmProperties = new MenuItem(menu, SWT.NONE); mntmProperties.setText("Properties"); MenuItem mntmDelete = new MenuItem(menu, SWT.NONE); mntmDelete.setText("Delete");
public void handleEvent( Event event ) { event.detail &= ~SWT.HOT; GC gc = event.gc; Rectangle area = table.getClientArea(); /* * If you wish to paint the selection beyond the end of * last column, you must change the clipping region. */ int columnCount = table.getColumnCount(); if ( event.index == columnCount - 1 || columnCount == 0 ) { int width = area.x + area.width - event.x; if ( width > 0 ) { Region region = new Region(); gc.getClipping(region); region.add(event.x, event.y, width, event.height); gc.setClipping(region); region.dispose(); } } gc.setAdvanced(true); if ( gc.getAdvanced() ) gc.setAlpha(127); Rectangle rect = event.getBounds(); Color background = gc.getBackground(); gc.setBackground(display.getSystemColor(SWT.COLOR_RED)); gc.fillRectangle(0, rect.y, 500, rect.height); // restore colors for subsequent drawing gc.setBackground(background); }