Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.GC.drawString()


    gc.setForeground(chan[i].fg);
    gc.drawString(chan[i].name, 50, 10 + (step * i));
      }
  }
  gc.setForeground(chan[0].fg);
  gc.drawString(myStatus, 200, 10);

  // gc.drawString(string, x, y)
  gc.dispose();
  return TheImage;
    }
View Full Code Here


            String text = item.getName();
            String info = getInfo();

            GC gc = e.gc;
            gc.setForeground(Colors.getTextColor(gc.getBackground()));
            gc.drawString(text, 2, 2, true);
            Point extent = gc.stringExtent(text);
            gc.drawString(info, 2, extent.y + 1, true);

            e.gc.setForeground(oldForeground);
            e.gc.setBackground(oldBackground);
View Full Code Here

            GC gc = e.gc;
            gc.setForeground(Colors.getTextColor(gc.getBackground()));
            gc.drawString(text, 2, 2, true);
            Point extent = gc.stringExtent(text);
            gc.drawString(info, 2, extent.y + 1, true);

            e.gc.setForeground(oldForeground);
            e.gc.setBackground(oldBackground);
        }
View Full Code Here

                    int y = (size.y / 2) + (int) (radius / 1.2 * Math.sin(-angleRad));

                    String label = String.format("%,.2f%%", (double) slice.getValue() / total * 100); //$NON-NLS-1$
                    Point extend = gc.stringExtent(label);
                    gc.setForeground(Colors.getTextColor(slice.getColor()));
                    gc.drawString(label, x - extend.x / 2, y - extend.y / 2, true);

                    // label
                    x = (size.x / 2) + (int) ((radius + 10) * Math.cos(-angleRad));
                    y = (size.y / 2) + (int) ((radius + 10) * Math.sin(-angleRad));

 
View Full Code Here

                    extend = gc.stringExtent(slice.getLabel());
                    if (x < centerX)
                        x -= extend.x;

                    gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
                    gc.drawString(slice.getLabel(), x, y - extend.y / 2, true);
                }

                startAngle += arcAngle;
            }
View Full Code Here

    gc.setFont(JFaceResources.getDefaultFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    int stringWidth = fontMetrics.getAverageCharWidth() * string.length();
    int stringHeight = fontMetrics.getHeight();
    gc.setForeground(m_messageColor);
    gc.drawString(string, (rect.width - stringWidth) / 2, (rect.height - stringHeight) / 2, true);

    gc.dispose();
  }

  private void setStatusColor(GC gc) {
View Full Code Here

    FontMetrics fontMetrics = gc.getFontMetrics();
    final String msg= getCurrentMessage();
    int stringWidth = fontMetrics.getAverageCharWidth() * msg.length();
    int stringHeight = fontMetrics.getHeight();
    gc.setForeground(m_messageColor);
    gc.drawString(msg,
                  (rect.width - stringWidth) / 2,
                  (rect.height - stringHeight) / 2,
                  true);
  }

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.