當前位置: 首頁>>代碼示例>>Java>>正文


Java List.setToolTipText方法代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.List.setToolTipText方法的典型用法代碼示例。如果您正苦於以下問題:Java List.setToolTipText方法的具體用法?Java List.setToolTipText怎麽用?Java List.setToolTipText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.widgets.List的用法示例。


在下文中一共展示了List.setToolTipText方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createTemplateControl

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
   * Creates a list element containing available templates (system and user)
   * and a text area next to it for showing description about the selected template
   * 
   * @param composite the parent container
   */
  private void createTemplateControl(Composite composite) {
      // add list for templates
      templateList = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
templateList.setItems(ProjectTemplateManager.loadTemplateNames());
      templateList.setLayoutData(new GridData(GridData.FILL_VERTICAL));
      templateList.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTemplateTooltip"));
      templateList.addSelectionListener(new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
          	attributes.setTemplate(templateList.getSelection()[0]);
          	updateEntries();
          }});
      
      templateList.setSelection(0);
      // this has to be done, because setSelection() doesn't generate an event
      attributes.setTemplate(templateList.getItem(0));

      
      // add TextField for the selected template's description
      descriptionField = new Text(composite, SWT.MULTI | SWT.BORDER);
      descriptionField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTemplateDescriptionTooltip"));
      descriptionField.setLayoutData(new GridData(GridData.FILL_BOTH));
      descriptionField.setEditable(false);
  }
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:30,代碼來源:TexlipseProjectCreationWizardPage.java

示例2: initFloatShell

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private void initFloatShell() {
      Point p = txtCurrentSelection.getParent().toDisplay(txtCurrentSelection.getLocation());
      Point size = txtCurrentSelection.getSize();
      Rectangle shellRect = new Rectangle(p.x, p.y + size.y, size.x, 0);
      shell = new Shell(MultiSelectionCombo.this.getShell(), SWT.NO_TRIM);
      
      GridLayout gl = new GridLayout();
      gl.marginBottom = 2;
      gl.marginTop = 2;
      gl.marginRight = 2;
      gl.marginLeft = 2;
      gl.marginWidth = 0;
      gl.marginHeight = 0;
      shell.setLayout(gl);

      list = new List(shell, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
      list.setToolTipText("Click and hold or use Ctrl to select multiple items");
      for (String value: textItems) {
    	  if(value!=null){
    		  list.add(value);
    	  }	 
         
      }

      if(currentSelection.length > 0){
    	  if(currentSelection[0]!=0){
    		  list.setSelection(currentSelection);
    	  }
      }
      

      GridData gd = new GridData(GridData.FILL_BOTH);
      list.setLayoutData(gd);

      shell.setSize(shellRect.width, 200);
      shell.setLocation(shellRect.x, shellRect.y);

      list.addMouseListener(new MouseAdapter() {

         @Override
         public void mouseUp(MouseEvent event) {
            super.mouseUp(event);
            if(list.getSelectionIndices().length > 0){
            	currentSelection = list.getSelectionIndices(); 
            } else {
            	currentSelection = new int[] { 0 };
            }
                       
            if ((event.stateMask & SWT.CTRL) == 0) {
//               displayText();
               parentComp.start = 0;
               parentComp.findText();               
               shell.dispose();
               
            }
         }
      });

      shell.addShellListener(new ShellAdapter() {

         public void shellDeactivated(ShellEvent arg0) {
            if (shell != null && !shell.isDisposed()) {
               if(list.getSelectionIndices().length > 0){
            	   currentSelection = list.getSelectionIndices(); 
               } else {
            	   currentSelection = new int[] { 0 };
               }
//               displayText();
               parentComp.start = 0;
               parentComp.findText();
               shell.dispose();
            }
         }
      });      
      shell.open();
      
   }
 
開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:78,代碼來源:MultiSelectionCombo.java


注:本文中的org.eclipse.swt.widgets.List.setToolTipText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。