<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FSWT_JFace_Eclipse%2FCanvas</id>
		<title>Java/SWT JFace Eclipse/Canvas - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FSWT_JFace_Eclipse%2FCanvas"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/Canvas&amp;action=history"/>
		<updated>2026-04-11T01:52:52Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/Canvas&amp;diff=5744&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/Canvas&amp;diff=5744&amp;oldid=prev"/>
				<updated>2010-06-01T05:57:55Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 05:57, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/Canvas&amp;diff=5743&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/Canvas&amp;diff=5743&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:43Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== A paint canvas. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/* &lt;br /&gt;
 * JFreeChart : a free chart library for the Java(tm) platform&lt;br /&gt;
 * &lt;br /&gt;
 *&lt;br /&gt;
 * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.&lt;br /&gt;
 *&lt;br /&gt;
 * Project Info:  http://www.jfree.org/jfreechart/index.html&lt;br /&gt;
 *&lt;br /&gt;
 * This library is free software; you can redistribute it and/or modify it &lt;br /&gt;
 * under the terms of the GNU Lesser General Public License as published by &lt;br /&gt;
 * the Free Software Foundation; either version 2.1 of the License, or &lt;br /&gt;
 * (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This library is distributed in the hope that it will be useful, but &lt;br /&gt;
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY &lt;br /&gt;
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public &lt;br /&gt;
 * License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
 * License along with this library; if not, write to the Free Software&lt;br /&gt;
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, &lt;br /&gt;
 * USA.  &lt;br /&gt;
 *&lt;br /&gt;
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. &lt;br /&gt;
 * in the United States and other countries.]&lt;br /&gt;
 *&lt;br /&gt;
 * -------------------&lt;br /&gt;
 * SwtPaintCanvas.java&lt;br /&gt;
 * -------------------&lt;br /&gt;
 * (C) Copyright 2000-2007, by Object Refinery Limited.&lt;br /&gt;
 *&lt;br /&gt;
 * Original Author:  Henry Proudhon (henry.proudhon AT ensmp.fr);&lt;br /&gt;
 * Contributor(s):   David Gilbert (for Object Refinery Limited);&lt;br /&gt;
 *&lt;br /&gt;
 * Changes&lt;br /&gt;
 * -------&lt;br /&gt;
 * 04-Aug-2006 : New class (HP);&lt;br /&gt;
 * 25-Oct-2007 : Fixed Eclipse warnings (DG);&lt;br /&gt;
 * &lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.events.PaintEvent;&lt;br /&gt;
import org.eclipse.swt.events.PaintListener;&lt;br /&gt;
import org.eclipse.swt.graphics.Color;&lt;br /&gt;
import org.eclipse.swt.widgets.Canvas;&lt;br /&gt;
import org.eclipse.swt.widgets.ruposite;&lt;br /&gt;
/**&lt;br /&gt;
 * A paint canvas.&lt;br /&gt;
 */&lt;br /&gt;
public class SWTPaintCanvas extends Canvas {&lt;br /&gt;
    private Color myColor;&lt;br /&gt;
    &lt;br /&gt;
    /**&lt;br /&gt;
     * Creates a new instance.&lt;br /&gt;
     * &lt;br /&gt;
     * @param parent  the parent.&lt;br /&gt;
     * @param style  the style.&lt;br /&gt;
     * @param color  the color.&lt;br /&gt;
     */&lt;br /&gt;
    public SWTPaintCanvas(Composite parent, int style, Color color) {&lt;br /&gt;
        this(parent, style);&lt;br /&gt;
        setColor(color);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    /**&lt;br /&gt;
     * Creates a new instance.&lt;br /&gt;
     * &lt;br /&gt;
     * @param parent  the parent.&lt;br /&gt;
     * @param style  the style.&lt;br /&gt;
     */&lt;br /&gt;
    public SWTPaintCanvas(Composite parent, int style) {&lt;br /&gt;
        super(parent, style);&lt;br /&gt;
        addPaintListener(new PaintListener() {&lt;br /&gt;
            public void paintControl(PaintEvent e) {&lt;br /&gt;
                e.gc.setForeground(e.gc.getDevice().getSystemColor(&lt;br /&gt;
                        SWT.COLOR_BLACK));&lt;br /&gt;
                e.gc.setBackground(SWTPaintCanvas.this.myColor);&lt;br /&gt;
                e.gc.fillRectangle(getClientArea());&lt;br /&gt;
                e.gc.drawRectangle(getClientArea().x, getClientArea().y, &lt;br /&gt;
                        getClientArea().width - 1, getClientArea().height - 1);&lt;br /&gt;
            }&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the color.&lt;br /&gt;
     * &lt;br /&gt;
     * @param color  the color.&lt;br /&gt;
     */&lt;br /&gt;
    public void setColor(Color color) {&lt;br /&gt;
        if (this.myColor != null) {&lt;br /&gt;
            this.myColor.dispose();&lt;br /&gt;
        }&lt;br /&gt;
        //this.myColor = new Color(getDisplay(), color.getRGB());&lt;br /&gt;
        this.myColor = color;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Returns the color.&lt;br /&gt;
     * &lt;br /&gt;
     * @return The color.&lt;br /&gt;
     */&lt;br /&gt;
    public Color getColor() {&lt;br /&gt;
        return this.myColor;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    /**&lt;br /&gt;
     * Overridden to do nothing.&lt;br /&gt;
     * &lt;br /&gt;
     * @param c  the color.&lt;br /&gt;
     */&lt;br /&gt;
    public void setBackground(Color c) {&lt;br /&gt;
        return;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Overridden to do nothing.&lt;br /&gt;
     * &lt;br /&gt;
     * @param c  the color.&lt;br /&gt;
     */&lt;br /&gt;
    public void setForeground(Color c) {&lt;br /&gt;
        return;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    /**&lt;br /&gt;
     * Frees resources.&lt;br /&gt;
     */&lt;br /&gt;
    public void dispose() {&lt;br /&gt;
        this.myColor.dispose();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Canvas example snippet: implement tab traversal ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/******************************************************************************&lt;br /&gt;
 * Copyright (c) 1998, 2004 Jackwind Li Guojie&lt;br /&gt;
 * All right reserved. &lt;br /&gt;
 * &lt;br /&gt;
 * Created on Jan 24, 2004 3:03:14 PM by JACK&lt;br /&gt;
 * $Id$&lt;br /&gt;
 * &lt;br /&gt;
 * visit: http://www.asprise.ru/swt&lt;br /&gt;
 *****************************************************************************/&lt;br /&gt;
/*&lt;br /&gt;
 * Canvas example snippet: implement tab traversal (behave like a tab group)&lt;br /&gt;
 *&lt;br /&gt;
 * For a list of all SWT example snippets see&lt;br /&gt;
 * http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/dev.html#snippets&lt;br /&gt;
 */&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.graphics.GC;&lt;br /&gt;
import org.eclipse.swt.graphics.Image;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
public class CanvasExample {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    &lt;br /&gt;
    Image small = new Image(display, 16, 16);&lt;br /&gt;
    GC gc = new GC(small);&lt;br /&gt;
    gc.setBackground(display.getSystemColor(SWT.COLOR_RED));&lt;br /&gt;
    gc.fillArc(0, 0, 16, 16, 45, 270);&lt;br /&gt;
    gc.dispose();&lt;br /&gt;
    &lt;br /&gt;
    Image large = new Image(display, 32, 32);&lt;br /&gt;
    gc = new GC(large);&lt;br /&gt;
    gc.setBackground(display.getSystemColor(SWT.COLOR_BLUE));&lt;br /&gt;
    gc.fillArc(0, 0, 32, 32, 45, 270);&lt;br /&gt;
    gc.dispose();&lt;br /&gt;
    &lt;br /&gt;
    /* Provide different resolutions for icons to get&lt;br /&gt;
     * high quality rendering wherever the OS needs &lt;br /&gt;
     * large icons. For example, the ALT+TAB window &lt;br /&gt;
     * on certain systems uses a larger icon.&lt;br /&gt;
     */&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setText(&amp;quot;Small and Large icons&amp;quot;);&lt;br /&gt;
    shell.setImages(new Image[] {small, large});&lt;br /&gt;
    /* No large icon: the OS will scale up the&lt;br /&gt;
     * small icon when it needs a large one.&lt;br /&gt;
     */&lt;br /&gt;
    Shell shell2 = new Shell(display);&lt;br /&gt;
    shell2.setText(&amp;quot;Small icon&amp;quot;);&lt;br /&gt;
    shell2.setImage(small);&lt;br /&gt;
    &lt;br /&gt;
    shell.open();&lt;br /&gt;
    shell2.open();&lt;br /&gt;
    while (!shell.isDisposed()) {&lt;br /&gt;
      if (!display.readAndDispatch())&lt;br /&gt;
        display.sleep();&lt;br /&gt;
    }&lt;br /&gt;
    display.dispose();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demonstrates a Canvas ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//Send questions, comments, bug reports, etc. to the authors:&lt;br /&gt;
//Rob Warner (rwarner@interspatial.ru)&lt;br /&gt;
//Robert Harris (rbrt_harris@yahoo.ru)&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.events.*;&lt;br /&gt;
import org.eclipse.swt.graphics.*;&lt;br /&gt;
import org.eclipse.swt.layout.*;&lt;br /&gt;
import org.eclipse.swt.widgets.*;&lt;br /&gt;
/**&lt;br /&gt;
 * This class demonstrates a Canvas&lt;br /&gt;
 */&lt;br /&gt;
public class SimpleCanvas {&lt;br /&gt;
  /**&lt;br /&gt;
   * Runs the application&lt;br /&gt;
   */&lt;br /&gt;
  public void run() {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setText(&amp;quot;Canvas Example&amp;quot;);&lt;br /&gt;
    createContents(shell);&lt;br /&gt;
    shell.open();&lt;br /&gt;
    while (!shell.isDisposed()) {&lt;br /&gt;
      if (!display.readAndDispatch()) {&lt;br /&gt;
        display.sleep();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    display.dispose();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates the main window&amp;quot;s contents&lt;br /&gt;
   * &lt;br /&gt;
   * @param shell the main window&lt;br /&gt;
   */&lt;br /&gt;
  private void createContents(Shell shell) {&lt;br /&gt;
    shell.setLayout(new FillLayout());&lt;br /&gt;
    // Create a canvas&lt;br /&gt;
    Canvas canvas = new Canvas(shell, SWT.NONE);&lt;br /&gt;
    // Create a button on the canvas&lt;br /&gt;
    Button button = new Button(canvas, SWT.PUSH);&lt;br /&gt;
    button.setBounds(10, 10, 300, 40);&lt;br /&gt;
    button.setText(&amp;quot;You can place widgets on a canvas&amp;quot;);&lt;br /&gt;
    // Create a paint handler for the canvas&lt;br /&gt;
    canvas.addPaintListener(new PaintListener() {&lt;br /&gt;
      public void paintControl(PaintEvent e) {&lt;br /&gt;
        // Do some drawing&lt;br /&gt;
        Rectangle rect = ((Canvas) e.widget).getBounds();&lt;br /&gt;
        e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_RED));&lt;br /&gt;
        e.gc.drawFocus(5, 5, rect.width - 10, rect.height - 10);&lt;br /&gt;
        e.gc.drawText(&amp;quot;You can draw text directly on a canvas&amp;quot;, 60, 60);&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * The application entry point&lt;br /&gt;
   * &lt;br /&gt;
   * @param args the command line arguments&lt;br /&gt;
   */&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    new SimpleCanvas().run();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>