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

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/View_Form&amp;diff=5714&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/View_Form&amp;diff=5714&amp;oldid=prev"/>
				<updated>2010-06-01T05:57:22Z</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://www.jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/View_Form&amp;diff=5713&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/View_Form&amp;diff=5713&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;== Demonstrates ViewForm ==&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.custom.*;&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 ViewForm&lt;br /&gt;
 */&lt;br /&gt;
public class Look {&lt;br /&gt;
  // Images used in the ViewForm&lt;br /&gt;
  private Image lookImage;&lt;br /&gt;
  private Image menuImage;&lt;br /&gt;
  // Counter for titles of ViewForms&lt;br /&gt;
  private int count = 0;&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;Look&amp;quot;);&lt;br /&gt;
    // Load the images&lt;br /&gt;
    lookImage = new Image(display, this.getClass().getResourceAsStream(&lt;br /&gt;
        &amp;quot;jexp.gif&amp;quot;));&lt;br /&gt;
    menuImage = new Image(display, this.getClass().getResourceAsStream(&lt;br /&gt;
        &amp;quot;jexp.gif&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;
    // We created the images, so we must dispose&lt;br /&gt;
    if (lookImage != null) lookImage.dispose();&lt;br /&gt;
    if (menuImage != null) menuImage.dispose();&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 parent the main window&lt;br /&gt;
   */&lt;br /&gt;
  public void createContents(Composite parent) {&lt;br /&gt;
    parent.setLayout(new GridLayout(1, false));&lt;br /&gt;
    // Pressing the &amp;quot;New Document&amp;quot; button will create a new ViewForm&lt;br /&gt;
    Button button = new Button(parent, SWT.PUSH);&lt;br /&gt;
    button.setText(&amp;quot;New Document&amp;quot;);&lt;br /&gt;
    // Create the composite that holds the ViewForms&lt;br /&gt;
    final Composite composite = new Composite(parent, SWT.NONE);&lt;br /&gt;
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));&lt;br /&gt;
    composite.setLayout(new FillLayout());&lt;br /&gt;
    // Add the event handler to create the ViewForms&lt;br /&gt;
    button.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        createViewFormHelper(composite, &amp;quot;Document &amp;quot; + (++count));&lt;br /&gt;
        composite.layout();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Helper function for creating the ViewForms&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the parent Composite&lt;br /&gt;
   * @param text the title text&lt;br /&gt;
   */&lt;br /&gt;
  private void createViewFormHelper(final Composite parent, String text) {&lt;br /&gt;
    // Create the ViewForm&lt;br /&gt;
    final ViewForm vf = new ViewForm(parent, SWT.BORDER);&lt;br /&gt;
    // Create the CLabel for the top left, which will have an image and text&lt;br /&gt;
    CLabel label = new CLabel(vf, SWT.NONE);&lt;br /&gt;
    label.setText(text);&lt;br /&gt;
    label.setImage(lookImage);&lt;br /&gt;
    label.setAlignment(SWT.LEFT);&lt;br /&gt;
    vf.setTopLeft(label);&lt;br /&gt;
    // Create the downward-pointing arrow to display the menu&lt;br /&gt;
    // and set it as the top center&lt;br /&gt;
    final ToolBar tbMenu = new ToolBar(vf, SWT.FLAT);&lt;br /&gt;
    final ToolItem itemMenu = new ToolItem(tbMenu, SWT.PUSH);&lt;br /&gt;
    itemMenu.setImage(menuImage);&lt;br /&gt;
    vf.setTopCenter(tbMenu);&lt;br /&gt;
    // Create the close button and set it as the top right&lt;br /&gt;
    ToolBar tbClose = new ToolBar(vf, SWT.FLAT);&lt;br /&gt;
    ToolItem itemClose = new ToolItem(tbClose, SWT.PUSH);&lt;br /&gt;
    itemClose.setText(&amp;quot;X&amp;quot;);&lt;br /&gt;
    itemClose.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        vf.dispose();&lt;br /&gt;
        parent.layout();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    vf.setTopRight(tbClose);&lt;br /&gt;
    // Create the content--a multi-line text box&lt;br /&gt;
    final Text textArea = new Text(vf, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);&lt;br /&gt;
    vf.setContent(textArea);&lt;br /&gt;
    /* Create the menu to display when the down arrow is pressed */&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    final Menu menu = new Menu(tbMenu);&lt;br /&gt;
    MenuItem clear = new MenuItem(menu, SWT.NONE);&lt;br /&gt;
    clear.setText(&amp;quot;Clear&amp;quot;);&lt;br /&gt;
    clear.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        textArea.setText(&amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    // Add the handler to display the menu&lt;br /&gt;
    itemMenu.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        // Place the menu right below the toolbar button&lt;br /&gt;
        Rectangle rect = itemMenu.getBounds();&lt;br /&gt;
        menu.setLocation(tbMenu.toDisplay(rect.x, rect.y + rect.height));&lt;br /&gt;
        menu.setVisible(true);&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 Look().run();&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;
== ViewForm Example ==&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;
 * All Right Reserved. &lt;br /&gt;
 * Copyright (c) 1998, 2004 Jackwind Li Guojie&lt;br /&gt;
 * &lt;br /&gt;
 * Created on 2004-4-9 15:43:00 by JACK&lt;br /&gt;
 * $Id$&lt;br /&gt;
 * &lt;br /&gt;
 *****************************************************************************/&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.custom.ViewForm;&lt;br /&gt;
import org.eclipse.swt.layout.FillLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Label;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
/**&lt;br /&gt;
 * &lt;br /&gt;
 */&lt;br /&gt;
public class ViewFormExample {&lt;br /&gt;
  Display display = new Display();&lt;br /&gt;
  Shell shell = new Shell(display);&lt;br /&gt;
  public ViewFormExample() {&lt;br /&gt;
    shell.setLayout(new FillLayout());&lt;br /&gt;
    &lt;br /&gt;
    final ViewForm viewForm = new ViewForm(shell, SWT.BORDER);&lt;br /&gt;
    Label label = new Label(viewForm, SWT.NULL);&lt;br /&gt;
    label.setText(&amp;quot;Top center&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    viewForm.setTopCenter(label);&lt;br /&gt;
    shell.setSize(400, 200);&lt;br /&gt;
    shell.open();&lt;br /&gt;
    //textUser.forceFocus();&lt;br /&gt;
    // Set up the event loop.&lt;br /&gt;
    while (!shell.isDisposed()) {&lt;br /&gt;
      if (!display.readAndDispatch()) {&lt;br /&gt;
        // If no more entries in event queue&lt;br /&gt;
        display.sleep();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    display.dispose();&lt;br /&gt;
  }&lt;br /&gt;
  private void init() {&lt;br /&gt;
  }&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    new ViewFormExample();&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>