Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 7830c9da1488b9643bdd95569f722c1a065a658d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*******************************************************************************
 * Copyright (c) 2018 Red Hat and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Red Hat - initial API and implementation
 *******************************************************************************/
package org.eclipse.swt.tests.gtk.snippets;


import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;

public class Bug251354_TabItemToolTip {
  public void run() {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new GridLayout());
    shell.setText("Show ToolTips");
    shell.setToolTipText("Shell");
    create(shell);
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }
  private void create(Shell shell) {
    final TabFolder tabFolder1 = new TabFolder(shell, SWT.NONE);
    tabFolder1.setToolTipText("Tabfolder1");
    Text text = new Text(tabFolder1, SWT.BORDER);  
    text.setToolTipText("Text");
    for (int i = 0; i < 4; i++) 
    {
            TabItem item = new TabItem(tabFolder1, SWT.CLOSE);
            item.setText("Item "+i);
            item.setControl(text);
            item.setToolTipText("Item "+i);
    }

    final TabFolder tabFolder = new TabFolder(shell, SWT.NONE);
    TabItem one = new TabItem(tabFolder, SWT.NONE);
    one.setText("Tab 1");
//    one.setToolTipText("This is Tab 1.");
   
    TabItem two = new TabItem(tabFolder, SWT.NONE);
    two.setText("Tab 2");
//    two.setToolTipText("This is Tab 2.");
   
    TabItem three = new TabItem(tabFolder, SWT.NONE);
    three.setText("Tab 3");
    three.setToolTipText("This is Tab 3.");
   
    TabItem four = new TabItem(tabFolder, SWT.NONE);
    four.setText("Tab 4");
    four.setToolTipText("This is Tab 4.");
    
  }
  public static void main(String[] args) {
    new Bug251354_TabItemToolTip().run();
  }
}

Back to the top