<?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_Tutorial%2FSWT%2FSash</id>
		<title>Java Tutorial/SWT/Sash - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_Tutorial%2FSWT%2FSash"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_Tutorial/SWT/Sash&amp;action=history"/>
		<updated>2026-04-21T12:51:55Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_Tutorial/SWT/Sash&amp;diff=3119&amp;oldid=prev</id>
		<title> в 17:44, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_Tutorial/SWT/Sash&amp;diff=3119&amp;oldid=prev"/>
				<updated>2010-05-31T17:44:26Z</updated>
		
		<summary type="html">&lt;p&gt;&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;Версия 17:44, 31 мая 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>
			</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_Tutorial/SWT/Sash&amp;diff=3120&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_Tutorial/SWT/Sash&amp;diff=3120&amp;oldid=prev"/>
				<updated>2010-05-31T15:20:57Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==  Make Split Dragger slim ==&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;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.layout.FormAttachment;&lt;br /&gt;
import org.eclipse.swt.layout.FormData;&lt;br /&gt;
import org.eclipse.swt.layout.FormLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Sash;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
import org.eclipse.swt.widgets.Text;&lt;br /&gt;
public class SashSlimDragger {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setText(&amp;quot;Sash One&amp;quot;);&lt;br /&gt;
    shell.setLayout(new FormLayout());&lt;br /&gt;
    Sash sash = new Sash(shell, SWT.VERTICAL);&lt;br /&gt;
    FormData data = new FormData();&lt;br /&gt;
    data.top = new FormAttachment(0, 0); // Attach to top&lt;br /&gt;
    data.bottom = new FormAttachment(100, 0); // Attach to bottom&lt;br /&gt;
    data.left = new FormAttachment(50, 0); // Attach halfway across&lt;br /&gt;
    sash.setLayoutData(data);&lt;br /&gt;
    Text one = new Text(shell, SWT.BORDER);&lt;br /&gt;
    data = new FormData();&lt;br /&gt;
    data.top = new FormAttachment(0, 0);&lt;br /&gt;
    data.bottom = new FormAttachment(100, 0);&lt;br /&gt;
    data.left = new FormAttachment(0, 0);&lt;br /&gt;
    data.right = new FormAttachment(sash, 0);&lt;br /&gt;
    one.setLayoutData(data);&lt;br /&gt;
    Text two = new Text(shell, SWT.BORDER);&lt;br /&gt;
    data = new FormData();&lt;br /&gt;
    data.top = new FormAttachment(0, 0);&lt;br /&gt;
    data.bottom = new FormAttachment(100, 0);&lt;br /&gt;
    data.left = new FormAttachment(sash, 0);&lt;br /&gt;
    data.right = new FormAttachment(100, 0);&lt;br /&gt;
    two.setLayoutData(data);&lt;br /&gt;
    shell.pack();&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;
}&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;
==  Making a Sash Stick ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;The default behavior of the sash allows dragging, but you must write code to make the sash stay.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;You implement an event handler to adjust the FormAttachment object associated with the sash&amp;quot;s movable direction.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;For a vertical sash, adjust the left FormAttachment.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;For a horizontal sash, adjust the top FormAttachment.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;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;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.events.SelectionAdapter;&lt;br /&gt;
import org.eclipse.swt.events.SelectionEvent;&lt;br /&gt;
import org.eclipse.swt.layout.FormAttachment;&lt;br /&gt;
import org.eclipse.swt.layout.FormData;&lt;br /&gt;
import org.eclipse.swt.layout.FormLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Sash;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
import org.eclipse.swt.widgets.Text;&lt;br /&gt;
public class SashFormSticker {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setText(&amp;quot;Sash One&amp;quot;);&lt;br /&gt;
    shell.setLayout(new FormLayout());&lt;br /&gt;
    final Sash sash = new Sash(shell, SWT.VERTICAL);&lt;br /&gt;
    FormData data = new FormData();&lt;br /&gt;
    data.top = new FormAttachment(0, 0); // Attach to top&lt;br /&gt;
    data.bottom = new FormAttachment(100, 0); // Attach to bottom&lt;br /&gt;
    data.left = new FormAttachment(50, 0); // Attach halfway across&lt;br /&gt;
    sash.setLayoutData(data);&lt;br /&gt;
    Text one = new Text(shell, SWT.BORDER);&lt;br /&gt;
    data = new FormData();&lt;br /&gt;
    data.top = new FormAttachment(0, 0);&lt;br /&gt;
    data.bottom = new FormAttachment(100, 0);&lt;br /&gt;
    data.left = new FormAttachment(0, 0);&lt;br /&gt;
    data.right = new FormAttachment(sash, 0);&lt;br /&gt;
    one.setLayoutData(data);&lt;br /&gt;
    Text two = new Text(shell, SWT.BORDER);&lt;br /&gt;
    data = new FormData();&lt;br /&gt;
    data.top = new FormAttachment(0, 0);&lt;br /&gt;
    data.bottom = new FormAttachment(100, 0);&lt;br /&gt;
    data.left = new FormAttachment(sash, 0);&lt;br /&gt;
    data.right = new FormAttachment(100, 0);&lt;br /&gt;
    two.setLayoutData(data);&lt;br /&gt;
    &lt;br /&gt;
    sash.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        // Reattach to the left edge, and use the x value of the event to&lt;br /&gt;
        // determine the offset from the left&lt;br /&gt;
        ((FormData) sash.getLayoutData()).left = new FormAttachment(0, event.x);&lt;br /&gt;
        // Until the parent window does a layout, the sash will not be redrawn in&lt;br /&gt;
        // its new location. So, force a layout.&lt;br /&gt;
        sash.getParent().layout();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    shell.pack();&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;
}&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;
==  Sashes ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Sashes, also called splitters&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;Sashes can be horizontal or vertical;&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;The type is determined at construction time, and cannot be changed.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;The default is vertical.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Passing SWT.HORIZONTAL or SWT.VERTICAL to the constructor determines the type:&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;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;
Sash horizontalSash = new Sash(shell, SWT.HORIZONTAL); // Horizontal sash&lt;br /&gt;
Sash verticalSash = new Sash(shell, SWT.VERTICAL); // Vertical sash&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;
==  Sash: implement a simple splitter (with a 20 pixel limit) ==&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;
 * Copyright (c) 2000, 2004 IBM Corporation and others.&lt;br /&gt;
 * All rights reserved. This program and the accompanying materials&lt;br /&gt;
 * are made available under the terms of the Eclipse Public License v1.0&lt;br /&gt;
 * which accompanies this distribution, and is available at&lt;br /&gt;
 * http://www.eclipse.org/legal/epl-v10.html&lt;br /&gt;
 *&lt;br /&gt;
 * Contributors:&lt;br /&gt;
 *     IBM Corporation - initial API and implementation&lt;br /&gt;
 *******************************************************************************/&lt;br /&gt;
//package org.eclipse.swt.snippets;&lt;br /&gt;
/*&lt;br /&gt;
 * Sash example snippet: implement a simple splitter (with a 20 pixel limit)&lt;br /&gt;
 *&lt;br /&gt;
 * For a list of all SWT example snippets see&lt;br /&gt;
 * http://www.eclipse.org/swt/snippets/&lt;br /&gt;
 */&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.graphics.Rectangle;&lt;br /&gt;
import org.eclipse.swt.layout.FormAttachment;&lt;br /&gt;
import org.eclipse.swt.layout.FormData;&lt;br /&gt;
import org.eclipse.swt.layout.FormLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Button;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Event;&lt;br /&gt;
import org.eclipse.swt.widgets.Listener;&lt;br /&gt;
import org.eclipse.swt.widgets.Sash;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
public class Splitter20PixelLimit {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    final Shell shell = new Shell(display);&lt;br /&gt;
    Button button1 = new Button(shell, SWT.PUSH);&lt;br /&gt;
    button1.setText(&amp;quot;Button 1&amp;quot;);&lt;br /&gt;
    final Sash sash = new Sash(shell, SWT.VERTICAL);&lt;br /&gt;
    Button button2 = new Button(shell, SWT.PUSH);&lt;br /&gt;
    button2.setText(&amp;quot;Button 2&amp;quot;);&lt;br /&gt;
    final FormLayout form = new FormLayout();&lt;br /&gt;
    shell.setLayout(form);&lt;br /&gt;
    FormData button1Data = new FormData();&lt;br /&gt;
    button1Data.left = new FormAttachment(0, 0);&lt;br /&gt;
    button1Data.right = new FormAttachment(sash, 0);&lt;br /&gt;
    button1Data.top = new FormAttachment(0, 0);&lt;br /&gt;
    button1Data.bottom = new FormAttachment(100, 0);&lt;br /&gt;
    button1.setLayoutData(button1Data);&lt;br /&gt;
    final int limit = 20, percent = 50;&lt;br /&gt;
    final FormData sashData = new FormData();&lt;br /&gt;
    sashData.left = new FormAttachment(percent, 0);&lt;br /&gt;
    sashData.top = new FormAttachment(0, 0);&lt;br /&gt;
    sashData.bottom = new FormAttachment(100, 0);&lt;br /&gt;
    sash.setLayoutData(sashData);&lt;br /&gt;
    sash.addListener(SWT.Selection, new Listener() {&lt;br /&gt;
      public void handleEvent(Event e) {&lt;br /&gt;
        Rectangle sashRect = sash.getBounds();&lt;br /&gt;
        Rectangle shellRect = shell.getClientArea();&lt;br /&gt;
        int right = shellRect.width - sashRect.width - limit;&lt;br /&gt;
        e.x = Math.max(Math.min(e.x, right), limit);&lt;br /&gt;
        if (e.x != sashRect.x) {&lt;br /&gt;
          sashData.left = new FormAttachment(0, e.x);&lt;br /&gt;
          shell.layout();&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    FormData button2Data = new FormData();&lt;br /&gt;
    button2Data.left = new FormAttachment(sash, 0);&lt;br /&gt;
    button2Data.right = new FormAttachment(100, 0);&lt;br /&gt;
    button2Data.top = new FormAttachment(0, 0);&lt;br /&gt;
    button2Data.bottom = new FormAttachment(100, 0);&lt;br /&gt;
    button2.setLayoutData(button2Data);&lt;br /&gt;
    shell.pack();&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;
    display.dispose();&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>
		<author><name>Admin</name></author>	</entry>

	</feed>