Adding tooltip for Img (Smart GWT) : Tooltip « GWT « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JDK 6
25.JNDI LDAP
26.JPA
27.JSP
28.JSTL
29.Language Basics
30.Network Protocol
31.PDF RTF
32.Reflection
33.Regular Expressions
34.Scripting
35.Security
36.Servlets
37.Spring
38.Swing Components
39.Swing JFC
40.SWT JFace Eclipse
41.Threads
42.Tiny Application
43.Velocity
44.Web Services SOA
45.XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Java » GWT » TooltipScreenshots 
Adding tooltip for Img (Smart GWT)
Adding tooltip for Img (Smart GWT)
   
/*
 * SmartGWT (GWT for SmartClient)
 * Copyright 2008 and beyond, Isomorphic Software, Inc.
 *
 * SmartGWT is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3
 * as published by the Free Software Foundation.  SmartGWT is also
 * available under typical commercial license terms - see
 * http://smartclient.com/license
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 */

package com.smartgwt.sample.showcase.client;


import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;

public class Showcase implements EntryPoint{

    public void onModuleLoad() {
       RootPanel.get().add(getViewPanel());
    }


    public Canvas getViewPanel() {
      Canvas canvas = new Canvas();
      ListGrid grid = new ListGrid();
      grid.setWidth("80%");
      grid.setHeight(84);
      grid.setLeaveScrollbarGap(false);
      grid.setHoverWidth(300);

      ListGridField commonNameField = new ListGridField("commonName""Animal");
      commonNameField.setHidden(true);

      ListGridField sceintificField = new ListGridField("scientificName""Scientific Name");
      ListGridField dietField = new ListGridField("diet""Diet");
      ListGridField informationField = new ListGridField("information""Interesting Facts");
      informationField.setShowHover(true);

      grid.setFields(commonNameField, sceintificField, dietField, informationField);

      grid.setData(new AnimalRecord[]{
              new AnimalRecord("Platypus""Ornithorhynchus Anatinus""Insects and Larvae""Were thought to be a hoax when first discovered. The male has a venemous spur on his hind legs.  Capable of many vocalizations including sounds like a growling puppy and a brooding hen."),
              new AnimalRecord("Elephant (African)""Loxodonta africana""Herbivore""The African Elephant is the largest of all land animals and also has the biggest brain of any land animal. Both males and females have ivory tusks. Elephants are also wonderful swimmers. Man is the only real enemy of the elephant. Man threatens the elephant by killing it for its tusks and by destroying its habitat."),
              new AnimalRecord("Alligator (American)""Allligator mississippiensis""Carnivore""In the 16th century, Spanish explorers in what is now Florida encountered a large formidable animal which they called \"el largo\" meaning \"the lizard\". The name \"el largo\" gradually became pronounced \"alligator\".")
      });
      canvas.addChild(grid);

      IButton button = new IButton("Close Issue");
      button.setDisabled(true);
      button.setTop(150);
      button.setPrompt("You cannot close this issue - see the owner");
      button.setHoverWidth(150);
      canvas.addChild(button);

      Img img = new Img("other/eyes.jpg"9047);
      img.setLeft(180);
      img.setTop(100);
      img.setPrompt("360px by 188px<BR>25k<BR>JPEG high quality");
      img.setHoverWidth(120);
      img.setHoverOpacity(75);
      img.setHoverStyle("interactImageHover");
      canvas.addChild(img);

      DynamicForm form new DynamicForm();
      form.setLeft(220);
      form.setTop(190);
      form.setWidth(200);
      form.setItemHoverWidth(200);
      form.setItemHoverStyle("interactFormHover");

      StaticTextItem severityField = new StaticTextItem();
      severityField.setName("severityLevel");
      severityField.setTitle("Severity Level");
      severityField.setDefaultValue("Severity 2");
      severityField.setPrompt("<b>Severity 1</b> - Critical problem<br>System is unavailable in production or " +
              "is corrupting data, and the error severely impacts the user's operations." +
              "<br><br><b>Severity 2</b> - Major problem<br>An important function of the system " +
              "is not available in production, and the user's operations are restricted." +
              "<br><br><b>Severity 3</b> - Minor problem<br>Inability to use a function of the " +
              "system occurs, but it does not seriously affect the user's operations.");

      form.setFields(severityField);
      canvas.addChild(form);

      return canvas;
  }


  class AnimalRecord extends ListGridRecord {

      public AnimalRecord(String commonName, String scientificName, String diet, String information) {
          setCommonName(commonName);
          setScientificName(scientificName);
          setDiet(diet);
          setInformation(information);
      }

      public void setCommonName(String commonName) {
          setAttribute("commonName", commonName);
      }

      public void setScientificName(String scientificName) {
          setAttribute("scientificName", scientificName);
      }

      public void setDiet(String diet) {
          setAttribute("diet", diet);
      }

      public void setInformation(String information) {
          setAttribute("information", information);
      }
  }
}

   
    
    
  
SmartGWT.zip( 9,880 k)
Related examples in the same category
1.Tooltip component for GWT
2.Add buttons to ToolStrip(ToolBar) (Smart GWT)Add buttons to ToolStrip(ToolBar) (Smart GWT)
3.Hovers Tooltips Sample (Smart GWT)Hovers Tooltips Sample (Smart GWT)
4.Adding tooltip for Button (Smart GWT)Adding tooltip for Button (Smart GWT)
5.HTML based tooltip (Smart GWT)HTML based tooltip (Smart GWT)
6.Adding tooltip based help information next to a field (Smart GWT)Adding tooltip based help information next to a field (Smart GWT)
7.Hover anywhere over the field to see what the current value means. (Smart GWT)Hover anywhere over the field to see what the current value means. (Smart GWT)
8.Adding tooltips for Button (Ext GWT)Adding tooltips for Button (Ext GWT)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.