Set value for Slider (Ext GWT) : Slider « 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.JavaFX
25.JDK 6
26.JDK 7
27.JNDI LDAP
28.JPA
29.JSP
30.JSTL
31.Language Basics
32.Network Protocol
33.PDF RTF
34.Reflection
35.Regular Expressions
36.Scripting
37.Security
38.Servlets
39.Spring
40.Swing Components
41.Swing JFC
42.SWT JFace Eclipse
43.Threads
44.Tiny Application
45.Velocity
46.Web Services SOA
47.XML
Java » GWT » Slider 




Set value for Slider (Ext GWT)
Set value for Slider (Ext GWT)
 

/*
 * Ext GWT - Ext for GWT
 * Copyright(c) 2007-2009, Ext JS, LLC.
 [email protected]
 
 * http://extjs.com/license
 */
 
 
package com.google.gwt.sample.hello.client;

import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Slider;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.layout.FillData;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.RootPanel;

public class Hello implements EntryPoint {
  public void onModuleLoad() {
    RootPanel.get().add(new SliderExample());
  }
}
class SliderExample extends LayoutContainer {

  private int margins = 30;

  @Override
  protected void onRender(Element parent, int pos) {
    super.onRender(parent, pos);
    setScrollMode(Scroll.AUTO);
    final Slider slider = new Slider();
    slider.setWidth(200);
    slider.setIncrement(1);
    slider.setMaxValue(200);
    slider.setClickToChange(false);
    add(slider, new FillData(margins));

    add(new Button("set value to 40"new SelectionListener<ButtonEvent>() {
      @Override
      public void componentSelected(ButtonEvent ce) {
        slider.setValue(40);
      }
    })new FillData(margins));

    final Slider slider2 = new Slider();
    slider2.setHeight(207);
    slider2.setVertical(true);
    add(slider2, new FillData(margins));

    add(new Button("set value to 40"new SelectionListener<ButtonEvent>() {
      @Override
      public void componentSelected(ButtonEvent ce) {
        slider2.setValue(40);
      }
    })new FillData(margins));

  }

}

   
  














Ext-GWT.zip( 4,297 k)
Related examples in the same category
1.Vertical/Horizontal Slider Sample (Smart GWT)Vertical/Horizontal Slider Sample (Smart GWT)
2.Drag the slider to change opacity (Smart GWT)Drag the slider to change opacity (Smart GWT)
3.Using Slider to control the width and sharpness of a shadow (Smart GWT)Using Slider to control the width and sharpness of a shadow (Smart GWT)
4.Using SliderItem to create slider (Smart GWT)Using SliderItem to create slider (Smart GWT)
5.Using Slider and SliderField (Ext GWT)Using Slider and SliderField (Ext GWT)
6.Vertical.Horizontal Slider (Ext GWT)Vertical.Horizontal Slider (Ext GWT)
7.Set Message for Slider (Ext GWT)Set Message for Slider (Ext GWT)
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.