Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Canvas


    insertHolderLabel();
    insertPlayerSeatComposite(new SeatId(3));
    insertHolderLabel();
   
    for (int i = 0; i < playerSeatComposites.size(); i++) {
      Canvas chipsForPlayerArea = playerBetAreas.get(i);
      PlayerSeatComposite psc = playerSeatComposites.get(i);
      psc.setChipsArea(chipsForPlayerArea);
     
    }
    // Add a PaintListener for updating chips (redraw() and update())
View Full Code Here


 
  /**
   * Configures canvas where the chips in the pots are displayed
   */
  private void insertPotChipsCanvas() {
    potChipsArea = new Canvas(this, SWT.NONE | ClientGUI.COMPOSITE_BORDER_STYLE);
    GridData betAreaLayoutData = new GridData(SWT.CENTER, SWT.CENTER, true, true);
    betAreaLayoutData.widthHint = 5 * (ClientGUI.PREFERRED_CARD_WIDTH + 5);
    betAreaLayoutData.heightHint = 100;
    betAreaLayoutData.minimumWidth = 5 * (ClientGUI.MINIMUM_CARD_WIDTH + 5);
    betAreaLayoutData.minimumHeight = 50;
View Full Code Here

 
  /**
   * Insert an Area where chips can be displayed
   */
  private void insertBetArea() {
    Canvas betArea = new Canvas(this, SWT.NONE | ClientGUI.COMPOSITE_BORDER_STYLE);
    GridData betAreaLayoutData = new GridData(SWT.CENTER, SWT.CENTER, true, true);
    betAreaLayoutData.widthHint = 150;
    betAreaLayoutData.heightHint = 100;
    betAreaLayoutData.minimumWidth = 60;
    betAreaLayoutData.minimumHeight = 50;
    betArea.setLayout(new FillLayout());
    betArea.setLayoutData(betAreaLayoutData);
    playerBetAreas.add(betArea);
    betArea.setVisible(false);
  }
View Full Code Here

   */
  private void animateChips(final List<PlayerSeatComposite> pcs, final boolean toPot) {
    logger.debug("Starting animation");
    final int timerInterval = 10;
    final int steps = 30;
    final Canvas to = toPot ? getPotChipsArea() : pcs.get(0).getChipsArea();
   
    getDisplay().syncExec(new Runnable() {
     
      double i = 0;
     
      public void run() {
       
        i++;
       
        for (PlayerSeatComposite pc : pcs) {
          Canvas from = toPot ? pc.getChipsArea() : getPotChipsArea();
          Rectangle fromBounds = from.getBounds();
         
          Rectangle toBounds = to.getBounds();
          final double xStep = (double) (fromBounds.x - toBounds.x) / steps;
          final double yStep = (double) ((fromBounds.y + fromBounds.height) - (toBounds.y + toBounds.height))
              / steps;
         
          Rectangle newBounds = new Rectangle(fromBounds.x - (int) (i * xStep), fromBounds.y
              - (int) (i * yStep), fromBounds.width, fromBounds.height);
          Rectangle redrawArea = fromBounds.union(newBounds);
          from.setBounds(newBounds);
          redraw(redrawArea.x, redrawArea.y, redrawArea.width, redrawArea.height, false);
        }
        update();
        try {
          Thread.sleep(timerInterval);
View Full Code Here

        demoFormContentLayout.marginHeight = 0;
        demoFormContentLayout.marginWidth = 0;
        demoForm.setLayout(demoFormContentLayout);

        // A panel containing all of the filters
        Canvas filterPanel = new Canvas(demoForm, SWT.BORDER);

        // Set the layout for the panel containing all of the filters
        GridData filterPanelLayout = new GridData();
        filterPanelLayout.horizontalAlignment = GridData.FILL;
        filterPanelLayout.verticalAlignment = GridData.FILL;
        filterPanelLayout.grabExcessHorizontalSpace = true;
        filterPanelLayout.grabExcessVerticalSpace = true;
        filterPanel.setLayoutData(filterPanelLayout);

        // Set the layout for the contents of that panel
        GridLayout filterPanelContentLayout = new GridLayout(1, false);
        filterPanelContentLayout.marginHeight = 10;
        filterPanelContentLayout.marginWidth = 10;
        filterPanelContentLayout.verticalSpacing = 15;
        filterPanel.setLayout(filterPanelContentLayout);

        // Add the various filters
        Text filterText = createFilterText(filterPanel);
        final MatcherEditor<Issue> matcherEditor = new TextWidgetMatcherEditor<Issue>(filterText, new IssueTextFilterator());
        issuesTextFiltered.setMatcherEditor(new ThreadedMatcherEditor<Issue>(matcherEditor));
View Full Code Here

        issueLoader.setProject(Project.getProjects().get(0));
    }

    private Text createFilterText(Composite parent) {
        // A panel containing text filter
        Canvas textPanel = new Canvas(parent, SWT.NONE);

        // Set the layout for the panel containing the text filter
        GridData textPanelLayout = new GridData();
        textPanelLayout.horizontalAlignment = GridData.FILL;
        textPanelLayout.verticalAlignment = GridData.BEGINNING;
        textPanelLayout.grabExcessHorizontalSpace = true;
        textPanelLayout.grabExcessVerticalSpace = false;
        textPanel.setLayoutData(textPanelLayout);

        // Set the layout for the contents of that panel
        GridLayout textPanelContentLayout = new GridLayout(1, false);
        textPanelContentLayout.marginHeight = 0;
        textPanelContentLayout.marginWidth = 0;
        textPanelContentLayout.verticalSpacing = 5;
        textPanel.setLayout(textPanelContentLayout);

        // Create the Label first
        Label filterLabel = new Label(textPanel, SWT.HORIZONTAL | SWT.SHADOW_NONE | SWT.CENTER);
        filterLabel.setText("Text Filter");

        // Change the font
        FontData[] fontData = filterLabel.getFont().getFontData();
        fontData[0].setStyle(SWT.BOLD);
        //fontData[0].setHeight(fontData[0].getHeight() + 1);
        filterLabel.setFont(new Font(textPanel.getDisplay(), fontData));

        // Set the layout for the label
        GridData filterLabelLayout = new GridData();
        filterLabelLayout.horizontalAlignment = GridData.BEGINNING;
        filterLabelLayout.verticalAlignment = GridData.CENTER;
View Full Code Here

        return filterText;
    }

    private void createPrioritySlider(Composite parent, ThresholdList priorityList) {
        // A panel containing the priority slider
        Canvas priorityPanel = new Canvas(parent, SWT.NONE);

        // Set the layout for the panel containing the priority slider
        GridData priorityPanelLayout = new GridData();
        priorityPanelLayout.horizontalAlignment = GridData.FILL;
        priorityPanelLayout.verticalAlignment = GridData.BEGINNING;
        priorityPanelLayout.grabExcessHorizontalSpace = true;
        priorityPanelLayout.grabExcessVerticalSpace = false;
        priorityPanel.setLayoutData(priorityPanelLayout);

        // Set the layout for the contents of that panel
        GridLayout priorityPanelContentLayout = new GridLayout(2, false);
        priorityPanelContentLayout.marginHeight = 0;
        priorityPanelContentLayout.marginWidth = 0;
        priorityPanelContentLayout.verticalSpacing = 5;
        priorityPanel.setLayout(priorityPanelContentLayout);

        // Create the Label first
        Label priorityLabel = new Label(priorityPanel, SWT.HORIZONTAL | SWT.SHADOW_NONE | SWT.CENTER);
        priorityLabel.setText("Minimum Priority");

        // Change the font
        FontData[] fontData = priorityLabel.getFont().getFontData();
        fontData[0].setStyle(SWT.BOLD);
        //fontData[0].setHeight(fontData[0].getHeight() + 1);
        priorityLabel.setFont(new Font(priorityPanel.getDisplay(), fontData));

        // Set the layout for the label
        GridData priorityLabelLayout = new GridData();
        priorityLabelLayout.horizontalAlignment = GridData.BEGINNING;
        priorityLabelLayout.verticalAlignment = GridData.CENTER;
        priorityLabelLayout.horizontalSpan = 2;
        priorityLabel.setLayoutData(priorityLabelLayout);

        // Create the slider widget to control priority filtering
        Slider prioritySlider = new Slider(priorityPanel, SWT.HORIZONTAL);
        prioritySlider.setValues(0, 0, 100, 10, 1, 25);
        GlazedListsSWT.lowerThresholdViewer(priorityList, prioritySlider);
        GridData prioritySliderLayout = new GridData();
        prioritySliderLayout.horizontalAlignment = GridData.FILL;
        prioritySliderLayout.verticalAlignment = GridData.BEGINNING;
        prioritySliderLayout.horizontalSpan = 2;
        prioritySliderLayout.grabExcessHorizontalSpace = true;
        prioritySliderLayout.grabExcessVerticalSpace = false;
        prioritySlider.setLayoutData(prioritySliderLayout);

        // Create the lower end Label
        Label lowPriorityLabel = new Label(priorityPanel, SWT.HORIZONTAL | SWT.SHADOW_NONE | SWT.CENTER);
        lowPriorityLabel.setText("Low");

        // Change the font to bold
        FontData[] lowerEndFontData = lowPriorityLabel.getFont().getFontData();
        lowerEndFontData[0].setStyle(SWT.BOLD);
        lowPriorityLabel.setFont(new Font(priorityPanel.getDisplay(), lowerEndFontData));

        // Set the layout for the label
        GridData lowPriorityLabelLayout = new GridData();
        lowPriorityLabelLayout.horizontalAlignment = GridData.BEGINNING;
        lowPriorityLabelLayout.verticalAlignment = GridData.CENTER;
        lowPriorityLabel.setLayoutData(lowPriorityLabelLayout);

        // Create the higher end Label
        Label highPriorityLabel = new Label(priorityPanel, SWT.HORIZONTAL | SWT.SHADOW_NONE | SWT.CENTER);
        highPriorityLabel.setText("High");

        // Change the font to bold
        FontData[] higherEndFontData = highPriorityLabel.getFont().getFontData();
        higherEndFontData[0].setStyle(SWT.BOLD);
        highPriorityLabel.setFont(new Font(priorityPanel.getDisplay(), higherEndFontData));

        // Set the layout for the label
        GridData highPriorityLabelLayout = new GridData();
        highPriorityLabelLayout.horizontalAlignment = GridData.END;
        highPriorityLabelLayout.verticalAlignment = GridData.CENTER;
View Full Code Here

        highPriorityLabel.setLayoutData(highPriorityLabelLayout);
    }

    private void createUsersList(Shell shell, Composite parent) {
        // A panel containing tthe users list
        Canvas usersListPanel = new Canvas(parent, SWT.NONE);

        // Set the layout for the panel containing the users list
        GridData usersListPanelLayout = new GridData();
        usersListPanelLayout.horizontalAlignment = GridData.FILL;
        usersListPanelLayout.verticalAlignment = GridData.FILL;
        usersListPanelLayout.grabExcessHorizontalSpace = true;
        usersListPanelLayout.grabExcessVerticalSpace = true;
        usersListPanel.setLayoutData(usersListPanelLayout);

        // Set the layout for the contents of that panel
        GridLayout usersListPanelContentLayout = new GridLayout(1, false);
        usersListPanelContentLayout.marginHeight = 0;
        usersListPanelContentLayout.marginWidth = 0;
        usersListPanelContentLayout.verticalSpacing = 5;
        usersListPanel.setLayout(usersListPanelContentLayout);

        // Create the Label first
        Label usersListLabel = new Label(usersListPanel, SWT.HORIZONTAL | SWT.SHADOW_NONE | SWT.CENTER);
        usersListLabel.setText("User");

        // Change the font
        FontData[] fontData = usersListLabel.getFont().getFontData();
        fontData[0].setStyle(SWT.BOLD);
        //fontData[0].setHeight(fontData[0].getHeight() + 1);
        usersListLabel.setFont(new Font(usersListPanel.getDisplay(), fontData));

        // Set the layout for the label
        GridData usersListLabelLayout = new GridData();
        usersListLabelLayout.horizontalAlignment = GridData.BEGINNING;
        usersListLabelLayout.verticalAlignment = GridData.BEGINNING;
View Full Code Here

        prefStore.addPropertyChangeListener(prefListener);
       
        setUpdateIntervalInMS(prefStore.getInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL));
        showMax = prefStore.getBoolean(IHeapStatusConstants.PREF_SHOW_MAX);
   
        button = new Canvas(this, SWT.NONE);
        button.setToolTipText(WorkbenchMessages.HeapStatus_buttonToolTip);
       
    ImageDescriptor imageDesc = WorkbenchImages.getWorkbenchImageDescriptor("elcl16/trash.gif"); //$NON-NLS-1$
    gcImage = imageDesc.createImage();
    if (gcImage != null) {
View Full Code Here

        createControl(parent);
    }

    private void createControl(Composite parent) {
        dispose();
        canvas = new Canvas(parent, SWT.NONE);
        canvas.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
       
        // paint the border
        canvas.addPaintListener(new PaintListener() {
            private void drawLine (GC gc, int x1, int y1, int x2, int y2, boolean flipXY) {
                if (flipXY) {
                    int tmp = x1;
                    x1 = y1;
                    y1 = tmp;
                    tmp = x2;
                    x2 = y2;
                    y2 = tmp;
                }
               
                 gc.drawLine(x1, y1, x2, y2);
            }
           
            public void paintControl(PaintEvent e) {
                Canvas canvas = (Canvas)e.widget;
                Control child = canvas.getChildren ()[0];
               
                // Are we horizontally or vertically aligned
                boolean flipXY = false;               
                if (child instanceof ToolBar && (((ToolBar)child).getStyle() & SWT.VERTICAL) != 0)
                    flipXY = true;
                else if (child instanceof CoolBar && (((CoolBar)child).getStyle() & SWT.VERTICAL) != 0)
                    flipXY = true;
               
                Rectangle bb = canvas.getBounds();
                int maxX = bb.width-1;
                int maxY = bb.height-1;
                
                if (flipXY) {
                    int tmp = maxX;
                    maxX = maxY;
                    maxY = tmp;
                }
               
                Color white = e.gc.getDevice ().getSystemColor(SWT.COLOR_WHITE);
                Color shadow = e.gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
                RGB outerRGB = ColorUtil.blend(white.getRGB(), shadow.getRGB(), blend);
                Color outerColor = new Color(e.gc.getDevice(), outerRGB);
               
                // Draw the 'outer' bits
                e.gc.setForeground(outerColor);
               
                // Top Line and curve
                drawLine(e.gc, 1, 0, maxX-5, 0, flipXY);
                drawLine(e.gc, maxX-4, 1, maxX-3, 1, flipXY);
                drawLine(e.gc, maxX-2, 2, maxX-2, 2, flipXY);
                drawLine(e.gc, maxX-1, 3, maxX-1, 4, flipXY);
               
                // Bottom line and curve
                drawLine(e.gc, 1, maxY, maxX-5, maxY, flipXY);
                drawLine( e.gc, maxX-4, maxY-1, maxX-3, maxY-1, flipXY);
                drawLine(e.gc, maxX-2, maxY-2, maxX-2, maxY-2, flipXY);
                drawLine(e.gc, maxX-1, maxY-3, maxX-1, maxY-4, flipXY);
               
                // Left & Right edges
                drawLine(e.gc, 0, 1, 0, maxY-1, flipXY);
                drawLine(e.gc, maxX, 5, maxX, maxY-5, flipXY);
               
                // Dispose the color since we created it...
                outerColor.dispose();
               
                // Draw the 'inner' curve
                e.gc.setForeground (white);

                drawLine(e.gc, 1, 1, maxX-5, 1, flipXY);
                drawLine(e.gc, maxX-4, 2, maxX-3, 2, flipXY);
                drawLine(e.gc, maxX-3, 3, maxX-2, 3, flipXY);
                drawLine( e.gc, maxX-2, 4, maxX-2, 4, flipXY);
               
                drawLine(e.gc, 1, maxY-1, maxX-5, maxY-1, flipXY);
                drawLine(e.gc, maxX-4, maxY-2, maxX-3, maxY-2, flipXY);
                drawLine( e.gc, maxX-3, maxY-3, maxX-2, maxY-3, flipXY);
                drawLine(e.gc, maxX-2, maxY-4, maxX-2, maxY-4, flipXY);
               
                // Left and Right sides
                drawLine(e.gc, 1, 1, 1, maxY-1, flipXY);
                drawLine(e.gc, maxX-1, 5, maxX-1, maxY-5, flipXY);
            }
        });
       
        // provide a layout that provides enough extra space to
        // draw the border and to place the child conrol in the
        // correct location
        canvas.setLayout(new Layout() {

      protected Point computeSize(Composite composite, int wHint,
                    int hHint, boolean changed) {
                Control[] children = composite.getChildren();
               
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Canvas

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.