Java Code Examples for org.eclipse.swt.SWT#DOUBLE_BUFFERED
The following examples show how to use
org.eclipse.swt.SWT#DOUBLE_BUFFERED .
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: MiniBar.java From BiglyBT with GNU General Public License v2.0 | 6 votes |
protected final DoubleBufferedLabel createDataLabel(int width, boolean centered) { width = (int)(width * width_multiplier ); assertConstructing(); DoubleBufferedLabel result = new DoubleBufferedLabel(splash, (centered ? SWT.CENTER : SWT.NULL) | SWT.DOUBLE_BUFFERED ); result.setBackground(Colors.blues[Colors.BLUES_LIGHTEST]); result.setText(""); result.addMouseListener(this.mListener); result.addMouseMoveListener(this.mMoveListener); if (this.hSize == -1) { throw new RuntimeException("must add fixed text label first!"); } result.setSize(width, hSize); result.setLocation(this.xSize, 0); result.setMenu(this.menu); this.xSize += width + 3; return result; }
Example 2
Source File: TimelineComposite.java From nebula with Eclipse Public License 2.0 | 6 votes |
public TimelineComposite(Composite parent, int style) { super(parent, style); fResourceManager = new LocalResourceManager(JFaceResources.getResources(), this); final FillLayout layout = new FillLayout(); layout.marginHeight = 10; layout.marginWidth = 10; setLayout(layout); setBackground(ColorConstants.black); final Canvas canvas = new Canvas(this, SWT.DOUBLE_BUFFERED); canvas.setBackground(ColorConstants.black); final LightweightSystem lightWeightSystem = new LightweightSystem(canvas); fRootFigure = new RootFigure(fResourceManager); fRootFigure.setFont(parent.getFont()); lightWeightSystem.setContents(fRootFigure); // draw2d does not directly support mouseWheelEvents, so register on canvas canvas.addMouseWheelListener(new TimelineScaler(this)); }
Example 3
Source File: TextIconButton.java From swt-bling with MIT License | 5 votes |
public TextIconButton(Composite parent, int style, ColorPalette colorPalette, ButtonRenderer buttonRenderer, ButtonStyles buttonStyles) { super(parent, style | SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND); this.colorPalette = colorPalette; this.buttonRenderer = buttonRenderer; this.buttonStyles = buttonStyles; this.currentStyle = buttonStyles.getNormal(); initializeBackground(); addListeners(); }
Example 4
Source File: JUnitProgressBar.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
public JUnitProgressBar( Composite parent ) { super( parent, SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED | SWT.NO_FOCUS ); text = ""; textAlignment = SWT.LEFT; textAnimation = new TextAnimation( this, this ); registerListeners(); }
Example 5
Source File: AbstractScaleRotateExample.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * */ public AbstractScaleRotateExample(String title) { Display display = new Display(); shell = new Shell(display, SWT.SHELL_TRIM | SWT.DOUBLE_BUFFERED); shell.setText(title); shell.setBounds(0, 0, 640, 480); shell.setBackground( Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); // open the shell before creating the controllable shapes so that their // default coordinates are not changed due to the resize of their canvas shell.open(); shape = createShape(shell); shell.addPaintListener(this); shell.addMouseListener(this); shell.addMouseMoveListener(this); shell.addMouseWheelListener(this); shell.addListener(SWT.Resize, this); shell.redraw(); // triggers a PaintEvent platform independently while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
Example 6
Source File: AbstractIntersectionExample.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * */ public AbstractIntersectionExample(String title, String... infos) { Display display = new Display(); shell = new Shell(display, SWT.SHELL_TRIM | SWT.DOUBLE_BUFFERED); shell.setText(title); shell.setBounds(0, 0, 640, 480); shell.setLayout(new FormLayout()); shell.setBackground( Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); Label infoLabel = new Label(shell, SWT.NONE); FormData infoLabelFormData = new FormData(); infoLabelFormData.right = new FormAttachment(100, -10); infoLabelFormData.bottom = new FormAttachment(100, -10); infoLabel.setLayoutData(infoLabelFormData); String infoText = "You can..."; for (int i = 0; i < infos.length; i++) { infoText += "\n..." + infos[i]; } infoLabel.setText(infoText); // open the shell before creating the controllable shapes so that their // default coordinates are not changed due to the resize of their canvas shell.open(); controllableShape1 = createControllableShape1(shell); controllableShape2 = createControllableShape2(shell); shell.addPaintListener(this); shell.redraw(); // triggers a PaintEvent platform independently while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
Example 7
Source File: ImageContainer.java From nebula with Eclipse Public License 2.0 | 5 votes |
public ImageContainer(final Carousel parent, final int style) { super(parent, SWT.DOUBLE_BUFFERED); carousel = parent; slider = -1; addListener(SWT.Paint, e -> { final GC gc = e.gc; gc.setAntialias(SWT.ON); gc.setInterpolation(SWT.HIGH); if (image == null) { return; } final Rectangle clientArea = getClientArea(); if (slider == -1) { final Rectangle imageBounds = image.getBounds(); if (imageBounds.width > clientArea.width || imageBounds.height > clientArea.height) { // Image is too big final Point point = reduceImageSoItFits(image); final int newWidth = point.x; final int newHeight = point.y; gc.drawImage(image, 0, 0, imageBounds.width, imageBounds.height, (clientArea.width - newWidth) / 2, (clientArea.height - newHeight) / 2, newWidth, newHeight); } else { gc.drawImage(image, (clientArea.width - imageBounds.width) / 2, (clientArea.height - imageBounds.height) / 2); } return; } // Animation gc.drawImage(scrollImage, slider, 0, clientArea.width, clientArea.height, 0, 0, clientArea.width, clientArea.height); }); }
Example 8
Source File: SWTCustomScale.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public SWTCustomScale(SWTContainer<? extends Composite> parent, boolean horizontal) { super(new Composite(parent.getControl(), SWT.DOUBLE_BUFFERED), parent); this.horizontal = horizontal; this.maximum = DEFAULT_MAXIMUM; this.minimum = DEFAULT_MINIMUM; this.increment = DEFAULT_INCREMENT; this.mousePosition = new UIPosition(); this.selectionHandler = new UISelectionListenerManager(); this.addMouseDownListener(this); this.addMouseDragListener(this); this.addMouseWheelListener(this); this.getControl().addPaintListener(this); }
Example 9
Source File: ControlListItem.java From thym with Eclipse Public License 1.0 | 5 votes |
/** * Create a new instance of the receiver with the specified parent, style and info object/ * * @param parent * @param style * @param element */ public ControlListItem(Composite parent, int style, T element) { super(parent, style | SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED ); Assert.isNotNull(element); super.setData(element); setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); mouseListener = doCreateMouseListener(); registerChild(this); }
Example 10
Source File: SimpleSlider.java From gama with GNU General Public License v3.0 | 5 votes |
public Panel(final Composite parent, final Color color, final boolean lastFillerRegion) { super(parent, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND); gd = new GridData(lastFillerRegion ? SWT.FILL : SWT.BEGINNING, SWT.BEGINNING, lastFillerRegion, false); gd.minimumHeight = 4; this.color = color; setLayoutData(gd); addPaintListener(this); }
Example 11
Source File: GodClassInformationControl.java From JDeodorant with MIT License | 4 votes |
@Override protected void createContent(Composite parent) { toolTipCanvas = new FigureCanvas(parent,SWT.DOUBLE_BUFFERED); toolTipCanvas.setBackground(ColorConstants.white); }
Example 12
Source File: NebulaSlider.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * Constructs a new instance of this class given its parent and a style value * describing its behavior and appearance. * <p> * The style value is either one of the style constants defined in class * <code>SWT</code> which is applicable to instances of this class, or must be * built by <em>bitwise OR</em>'ing together (that is, using the * <code>int</code> "|" operator) two or more of those <code>SWT</code> style * constants. The class description lists the style constants that are * applicable to the class. Style bits are also inherited from superclasses. * </p> * * @param parent a composite control which will be the parent of the new * instance (cannot be null) * @param style the style of control to construct * * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the parent</li> * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed * subclass</li> * </ul> * * @see Widget#getStyle() */ public NebulaSlider(Composite parent, int style) { super(parent, checkStyle(style) | SWT.DOUBLE_BUFFERED); barInsideColor = getAndDisposeColor(225, 225, 225); barBorderColor = getAndDisposeColor(211, 211, 211); barSelectionColor = getAndDisposeColor(41, 128, 185); selectorColor = getAndDisposeColor(52, 152, 219); selectorColorBorder = getAndDisposeColor(224, 237, 245); selectorTextColor = getAndDisposeColor(255, 255, 255); arrowColor = getAndDisposeColor(153, 203, 237); selectionListeners = new ArrayList<>(); minimum = Integer.MIN_VALUE; maximum = Integer.MAX_VALUE; value = 0; xPosition = -1; textFont = createTextFont(); addPaintListener(e -> { paintControl(e.gc); }); addMouseListeners(); }
Example 13
Source File: ComponentRiskMonitor.java From arx with Apache License 2.0 | 4 votes |
/** * Creates a new instance * @param parent * @param controller * @param text * @param shortText */ public ComponentRiskMonitor(final Composite parent, final Controller controller, final String text, final String shortText) { // Images imageLow = controller.getResources().getManagedImage("bullet_green.png"); //$NON-NLS-1$ imageHigh = controller.getResources().getManagedImage("bullet_red.png"); //$NON-NLS-1$ // Layout GridLayout layout = SWTUtil.createGridLayout(1); layout.marginHeight = 0; layout.marginTop = 0; layout.marginBottom = 0; layout.verticalSpacing = 0; // Root this.root = new Composite(parent, SWT.NONE); this.root.setLayout(layout); this.root.setToolTipText(text); // Caption this.caption = new CLabel(root, SWT.CENTER); this.caption.setText(shortText); this.caption.setLayoutData(SWTUtil.createFillHorizontallyGridData()); this.caption.setToolTipText(text); this.caption.setImage(imageHigh); SWTUtil.changeFont(caption, SWT.BOLD); // Content Composite content = new Composite(root, SWT.NONE); content.setLayoutData(SWTUtil.createFillGridData()); content.setToolTipText(text); // Create meter Canvas canvas = new Canvas(content, SWT.DOUBLE_BUFFERED); canvas.setToolTipText(text); this.meter = new ComponentMeterFigure(); this.meter.setNeedleColor(XYGraphMediaFactory.getInstance().getColor(0, 0, 0)); this.meter.setValueLabelVisibility(true); this.meter.setRange(new Range(0, 100)); this.meter.setLoLevel(0); this.meter.setLoColor(XYGraphMediaFactory.getInstance().getColor(0, 150, 0)); this.meter.setLoloLevel(25); this.meter.setLoloColor(XYGraphMediaFactory.getInstance().getColor(255, 255, 0)); this.meter.setHiLevel(50); this.meter.setHiColor(XYGraphMediaFactory.getInstance().getColor(255, 200, 25)); this.meter.setHihiLevel(100); this.meter.setHihiColor(XYGraphMediaFactory.getInstance().getColor(255, 0, 0)); this.meter.setMajorTickMarkStepHint(50); LightweightSystem lws = new LightweightSystem(canvas); lws.setContents(this.meter); // Create label label = new CLabel(content, SWT.CENTER); label.setLayoutData(SWTUtil.createFillHorizontallyGridData()); label.setToolTipText(text); // Create responsive layout new ComponentResponsiveLayout(content, 100, 50, canvas, label); }
Example 14
Source File: FeatureEnviedMethodInformationControl.java From JDeodorant with MIT License | 4 votes |
@Override protected void createContent(Composite parent) { toolTipCanvas = new FigureCanvas(parent,SWT.DOUBLE_BUFFERED); toolTipCanvas.setBackground(ColorConstants.white); }
Example 15
Source File: BadgedLabel.java From nebula with Eclipse Public License 2.0 | 4 votes |
private static int checkStyle(final int style) { final int mask = SWT.BORDER | SWT.LEFT | SWT.RIGHT | SWT.TOP | SWT.BOTTOM; int newStyle = style & mask; newStyle |= SWT.DOUBLE_BUFFERED; return newStyle; }
Example 16
Source File: StarRating.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * Constructs a new instance of this class given its parent and a style * value describing its behavior and appearance. * <p> * The style value is either one of the style constants defined in class * <code>SWT</code> which is applicable to instances of this class, or must * be built by <em>bitwise OR</em>'ing together (that is, using the * <code>int</code> "|" operator) two or more of those <code>SWT</code> * style constants. The class description lists the style constants that are * applicable to the class. Style bits are also inherited from superclasses. * </p> * * @param parent a composite control which will be the parent of the new * instance (cannot be null) * @param style the style of control to construct * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the parent</li> * </ul> * */ public StarRating(final Composite parent, final int style) { super(parent, checkStyle(style) | SWT.DOUBLE_BUFFERED); sizeOfStars = SIZE.SMALL; currentNumberOfStars = 0; if ((style & SWT.VERTICAL) != 0) { orientation = SWT.VERTICAL; } else { orientation = SWT.HORIZONTAL; } stars = new ArrayList<Star>(); selectionListeners = new ArrayList<SelectionListener>(); setMaxNumberOfStars(DEFAULT_MAX_NUMBERS_OF_STARS); initListeners(); }
Example 17
Source File: FloatingText.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * Constructs a new instance of this class given its parent and a style value * describing its behavior and appearance. * <p> * The style value is either one of the style constants defined in class * <code>SWT</code> which is applicable to instances of this class, or must be * built by <em>bitwise OR</em>'ing together (that is, using the * <code>int</code> "|" operator) two or more of those <code>SWT</code> style * constants. The class description lists the style constants that are * applicable to the class. Style bits are NOT inherited from superclasses. * </p> * * @param parent a composite control which will be the parent of the new * instance (cannot be null) * @param style the style of control to construct * * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the parent * is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not * called from the thread that created the * parent</li> * <li>ERROR_INVALID_SUBCLASS - if this * class is not an allowed subclass</li> * </ul> * * @see SWT#SEPARATOR * @see SWT#SINGLE * @see SWT#MULTI * @see SWT#READ_ONLY * @see SWT#WRAP * @see SWT#LEFT * @see SWT#RIGHT * @see SWT#CENTER * @see SWT#PASSWORD * @see SWT#SEARCH * @see SWT#BORDER * @see SWT#H_SCROLL * @see SWT#V_SCROLL * @see SWT#LEFT_TO_RIGHT * @see SWT#RIGHT_TO_LEFT * @see SWT#FLIP_TEXT_DIRECTION * @see Widget#checkSubclass * @see Widget#getStyle */ public FloatingText(final Composite pParent, final int pStyle) { super(pParent, SWT.DOUBLE_BUFFERED | (pStyle & SWT.BORDER)); fStyle = pStyle; setLayout(createLayout(pStyle)); fLabel = createLabel(pStyle); fText = new Text(this, removeStyles(pStyle, SWT.BORDER, SWT.SEPARATOR)); fText.setLayoutData(getTextLayoutData()); fLabel.setBackground(fText.getBackground()); fLabel.setForeground(fText.getForeground()); fLabel.setLayoutData(getLabelLayoutData()); fText.addListener(SWT.FocusIn, e -> setLabelText(true)); fText.addListener(SWT.FocusOut, e -> setLabelText(false)); fText.addListener(SWT.Modify, e -> { if (!fText.getText().isEmpty() && fLabel.getText().isEmpty()) { fLabel.setText(fText.getMessage()); } if (fText.getText().isEmpty() && !fLabel.getText().isEmpty() && !(getDisplay().getFocusControl() == fText)) { fLabel.setText(""); } }); }
Example 18
Source File: TransferStatsView.java From BiglyBT with GNU General Public License v2.0 | 4 votes |
private void buildRouteComponent( int rows ) { boolean changed = false; boolean force = route_labels.length > 0 && route_labels[0][0].isDisposed(); if ( rows <= route_labels.length && !force ){ for ( int i=rows;i<route_labels.length;i++){ for ( int j=0;j<3;j++){ route_labels[i][j].setText( "" ); } } }else{ Control[] labels = route_comp.getChildren(); for (int i = 0; i < labels.length; i++){ labels[i].dispose(); } Label h1 = new Label( route_comp, SWT.NULL ); h1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL )); h1.setText( MessageText.getString( "label.route" )); h1.setBackground( Colors.white ); Label h2 = new Label( route_comp, SWT.NULL ); h2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL )); h2.setText( MessageText.getString( "tps.type.incoming" )); h2.setBackground( Colors.white ); Label h3 = new Label( route_comp, SWT.NULL ); h3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL )); h3.setText( MessageText.getString( "label.outgoing" )); h3.setBackground( Colors.white ); new Label( route_comp, SWT.NULL ); new Label( route_comp, SWT.NULL ); new Label( route_comp, SWT.NULL ); route_labels = new BufferedLabel[rows][3]; for ( int i=0;i<rows;i++ ){ for ( int j=0;j<3;j++){ BufferedLabel l = new BufferedLabel( route_comp, SWT.DOUBLE_BUFFERED ); GridData gridData = new GridData(GridData.FILL_HORIZONTAL ); l.setLayoutData(gridData); l.getControl().setBackground( Colors.white ); route_labels[i][j] = l; } } changed = true; } Point size = route_comp.computeSize(route_comp.getParent().getSize().x, SWT.DEFAULT); changed = changed || !route_comp.getSize().equals( size ); route_comp.setSize(size); if ( !changed ){ // sometimes things get layouted when not visibel and things don't work proper when visibilized ;( // look for something zero height that shouldn't be for ( int i=0;i<route_labels.length;i++){ for (int j=0;j<3;j++){ BufferedLabel lab = route_labels[i][j]; if ( !lab.isDisposed() && lab.getControl().getSize().y == 0 && lab.getText().length() > 0 ){ changed = true; } } } } if ( changed ){ route_comp.getParent().layout( true, true ); } route_comp.update(); }
Example 19
Source File: InternalGeoMap.java From nebula with Eclipse Public License 2.0 | 3 votes |
/** * Initializes a new <code>InternalGeoMap</code>. * * @param parent * SWT parent <code>Composite</code> * @param style * SWT style as in <code>Canvas</code>, since this class inherits * from it. Double buffering is always enabed. * @param mapPosition * initial mapPosition. * @param zoom * initial map zoom * @param cacheSize * initial cache size, eg number of tile-images that are kept in * cache to prevent reloading from the network. */ protected InternalGeoMap(Composite parent, int style, Point mapPosition, int zoom, int cacheSize) { super(parent, SWT.DOUBLE_BUFFERED | style); geoMapHelper = new GeoMapHelper(parent.getDisplay(), mapPosition, zoom, cacheSize); geoMapHelper.addGeoMapHelperListener(this); addDisposeListener(e -> InternalGeoMap.this.geoMapHelper.dispose()); addPaintListener(e -> InternalGeoMap.this.paintControl(e)); }
Example 20
Source File: LauncherLabel.java From nebula with Eclipse Public License 2.0 | 3 votes |
/** * Constructs a new instance of this class given its parent and a style * value describing its behavior and appearance. * <p> * The style value is either one of the style constants defined in class * <code>SWT</code> which is applicable to instances of this class, or must * be built by <em>bitwise OR</em>'ing together (that is, using the * <code>int</code> "|" operator) two or more of those <code>SWT</code> * style constants. The class description lists the style constants that are * applicable to the class. Style bits are also inherited from superclasses. * </p> * * @param parent a composite control which will be the parent of the new * instance (cannot be null) * @param style the style of control to construct * * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the parent</li> * </ul> * */ LauncherLabel(final Composite parent, final int style) { super(parent, style | SWT.BORDER | SWT.DOUBLE_BUFFERED); final Font original = super.getFont(); final Font defaultFont = new Font(getDisplay(), original.getFontData()[0].getName(), 18, SWT.BOLD); font = defaultFont; SWTGraphicUtil.addDisposer(this, defaultFont); addPaintListener(event -> { onPaint(event); }); }