GWT - TOGGLEBUTTON WIDGET

Similar documents
GWT - PUSHBUTTON WIDGET

GWT - LABEL WIDGET. Following default CSS Style rule will be applied to all the labels. You can override it as per your requirements.

GWT - FLEXTABLE WIDGET

GWT - FORMPANEL WIDGET

GWT - DEBUGGING APPLICATION

GWT - CREATE APPLICATION

GWT - POPUPPANEL WIDGET

GWT - INTERNATIONALIZATION

GWT - RPC COMMUNICATION

GWT - LOGGING FRAMEWORK

GWT is an open source, completely free, and used by thousands of developers around the world. It is licensed under the Apache License version 2.0.

Google Web Toolkit Tutorial

GWT - QUICK GUIDE. Google Web Toolkit (GWT) is a development toolkit to create RICH Internet Application(RIA).

Google Web Toolkit Creating/using external JAR files

GWT - UIOBJECT CLASS

Creating GWT Applications in Eclipse

Pimp My Webapp (with Google Web Toolkit)

GWT MOCK TEST GWT MOCK TEST I

GWT and jmaki: Expanding the GWT Universe. Carla Mott, Staff Engineer, Sun Microsystems Greg Murray, Ajax Architect, Sun Microsystems

Cascading Style Sheets (CSS)

CSS: The Basics CISC 282 September 20, 2014

Introduction to CSS. Part 1: Simple Text Formatting. Source Files for this Exercise are available on the Course Website DW_CSS intro

CSS مفاهیم ساختار و اصول استفاده و به کارگیری

CSS: Cascading Style Sheets

Google Web Toolkit (GWT) Basics. Sang Shin Java Technology Architect & Evangelist Sun Microsystems, Inc.

GWT GWT. Label. Java GWT. com.google.gwt.user.client.ui package

INTRODUCTION TO CSS. Topics MODULE 5

Cascading Style Sheets Level 2

CSS.

ITNP43: HTML Lecture 4

Hands On: Dreamweaver CS3 NEW SPRY Widgets

Session 4. Style Sheets (CSS) Reading & References. A reference containing tables of CSS properties

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

CSS Cascading Style Sheets

The Benefits of CSS. Less work: Change look of the whole site with one edit

CSS Cascading Style Sheets

Introduction to CSS. 2 Sep 13. Derek Peacock. An introduction to defining CSS style rules using tags, classes and ids.

CS 350 Internet Applications I Name: Exam II (CSS) October 29, 2013

.hedgehog { background-image: url(backyard.jpg); color: #ffff99; height: 6in; width: 12in; } .tube {

Lecture B3 Style : Algorithmic Thinking. Computing and Art : Nature, Power, and Limits CC 3.12: Fall 2007

2. Write style rules for how you d like certain elements to look.

Unit 10 - Client Side Customisation of Web Pages. Week 5 Lesson 1 CSS - Selectors

Creating and Building Websites

Web Development & Design Foundations with HTML5, 8 th Edition Instructor Materials Chapter 3 Test Bank

Web Information System Design No.4 Put Style to Web Documents. Tatsuya Hagino

To illustrate how to set TAG styles the <body> and <h1> tags (for the BODY and the HEADING 1 styles) will be adjusted.

Connecting the Dots. Building Web Applications with PHP, HTML, CSS, and JavaScript

Web Design and Development Tutorial 03

UNIT -II. Language-History and Versions Introduction JavaScript in Perspective-

In the early days of the Web, designers just had the original 91 HTML tags to work with.

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

CSS: formatting webpages

To link to an external stylesheet, the link element is placed within the head of the html page:

Stamp Builder. Documentation. v1.0.0

Software Engineering for Ajax

Introduction to WEB PROGRAMMING

Basic CSS Lecture 17

Cascading Style Sheets (Part 3): Images and Text. Mike Hamilton V.P. Product Evangelism MadCap Software

INTRODUCTION TO CSS. Mohammad Jawad Kadhim

mgwt Cross platform development with Java

CSS. Lecture 16 COMPSCI 111/111G SS 2018

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

Introduction to using HTML to design webpages

Web Development & Design Foundations with HTML5

AIM. 10 September

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5

Web Development & Design Foundations with HTML5

So far, Wednesday, February 03, :47 PM. So far,

CSS Lecture 16 COMPSCI 111/111G SS 2018

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

CSCB20 Week 7. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017

Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style

CSS exercise - Part 1

Computer Science E-1. Understanding Computers and the Internet. Lecture 10: Website Development Wednesday, 29 November 2006

Adding CSS to your HTML

SCRIPT.ACULO.US - DRAG & DROP

Cascading style sheets, HTML, DOM and Javascript

Cascading Style Sheet. Styles as Tag Attributes. Syntax. <h1>: what font type/size is used? STYLE = SELECTOR {RULES} Attributes such as bgcolor

Unveiling the Basics of CSS and how it relates to the DataFlex Web Framework

CSE 154 LECTURE 3: MORE CSS

CS 1100: Web Development: Client Side Coding / Fall 2016 Lab 2: More HTML and CSS

The building block of a CSS stylesheet. A rule consists of a selector and a declaration block (one or more declarations).

Cascading Style Sheets for XML

Appendix D CSS Properties and Values

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2)

CSS Styles Quick Reference Guide

DAY 4. Coding External Style Sheets

Google Web Toolkit (GWT)

Web Structure and Style. MB2030 Section 2 Class 4

CSS Selectors. element selectors. .class selectors. #id selectors

Scripting for Multimedia LECTURE 5: INTRODUCING CSS3

Cooking with GWT: Recipes for the perfect dinner. Alberto Mijares Basel, Switzerland

Chapter 7 Typography, Style Sheets, and Color. Mrs. Johnson

Let's see a couple of examples

Creating and Building Websites

Reading 2.2 Cascading Style Sheets

JSF - H:INPUTSECRET. Class name of a validator that s created and attached to a component

Wanted! Introduction. Step 1: Styling your poster. Activity Checklist. In this project, you ll learn how to make your own poster.

The Google Web Toolkit Donna Griffin

READSPEAKER ENTERPRISE HIGHLIGHTING 2.5

Transcription:

GWT - TOGGLEBUTTON WIDGET http://www.tutorialspoint.com/gwt/gwt_togglebutton_widget.htm Copyright tutorialspoint.com Introduction The ToggleButton widget represents a stylish stateful button which allows the user to toggle between up and down states. Class declaration Following is the declaration for com.google.gwt.user.client.ui.togglebutton class: public class ToggleButton extends CustomButton CSS style rules Following default CSS Style rules will be applied to all the ToggleButton widget. You can override it as per your requirements..gwt-togglebutton-up {.gwt-togglebutton-down {.gwt-togglebutton-up-hovering {.gwt-togglebutton-down-hovering {.gwt-togglebutton-up-disabled {.gwt-togglebutton-down-disabled { Class constructors S.N. 1 Constructor & Description ToggleButton Constructor for ToggleButton. 2 ToggleButtonImageupImage 3 ToggleButtonImageupImage, ClickListenerlistener Creates a ToggleButton with up state image and clicklistener. 4 ToggleButtonImageupImage, ImagedownImage 5 ToggleButtonImageupImage, ImagedownImage, ClickListenerlistener 6 ToggleButtonjava. lang. StringupText

Creates a ToggleButton with up state text. 7 ToggleButtonjava. lang. StringupText, ClickListenerlistener Creates a ToggleButton with up state text and clicklistener. 8 ToggleButtonjava. lang. StringupText, java. lang. StringdownText Creates a ToggleButton with up state and down state text. 8 ToggleButtonjava. lang. StringupText, java. lang. StringdownText, ClickListenerlistener Creates a ToggleButton with up state, down state text and click listener. Class methods S.N. 1 Function name & Description boolean isdown Is this button down? 2 protected void onclick Called when the user finishes clicking on this button. 3 void setdownbooleandown Sets whether this button is down. Methods inherited This class inherits methods from the following classes: com.google.gwt.user.client.ui.uiobject com.google.gwt.user.client.ui.widget com.google.gwt.user.client.ui.focuswidget com.google.gwt.user.client.ui.customwidget java.lang.object ToggleButton Widget Example This example will take you through simple steps to show usage of a ToggleButton Widget in GWT. Follow the following steps to update the GWT application we created in GWT - Create Application chapter:

Step Description 1 Create a project with a name HelloWorld under a package com.tutorialspoint as explained in the GWT - Create Application chapter. 2 Modify HelloWorld.gwt.xml, HelloWorld.css, HelloWorld.html and HelloWorld.java as explained below. Keep rest of the files unchanged. 3 Compile and run the application to verify the result of the implemented logic. Following is the content of the modified module descriptor src/com.tutorialspoint/helloworld.gwt.xml. <?xml version="1.0" encoding="utf-8"?> <module rename-to='helloworld'> <!-- Inherit the core Web Toolkit stuff. --> <inherits name='com.google.gwt.user.user'/> <!-- Inherit the default GWT style sheet. --> <inherits name='com.google.gwt.user.theme.clean.clean'/> <!-- Specify the app entry point class. --> <entry-point class='com.tutorialspoint.client.helloworld'/> <!-- Specify the paths for translatable code --> <source path='client'/> <source path='shared'/> </module> Following is the content of the modified Style Sheet file war/helloworld.css. body{ text-align: center; font-family: verdana, sans-serif; h1{ font-size: 2em; font-weight: bold; color: #777777; margin: 40px 0px 70px; text-align: center;.gwt-togglebutton-up { color:green;.gwt-togglebutton-down { color:blue;.gwt-togglebutton-up-hovering { color:pink;.gwt-togglebutton-down-hovering { color:aqua;.gwt-togglebutton-up-disabled { color:lime;.gwt-togglebutton-down-disabled { color:maroon; Following is the content of the modified HTML host file war/helloworld.html. <html> <head>

<title>hello World</title> <link rel="stylesheet" href="helloworld.css"/> <script language="javascript" src="helloworld/helloworld.nocache.js"> </script> </head> <body> <h1>togglebutton Widget Demonstration</h1> <div ></div> </body> </html> Let us have following content of Java file src/com.tutorialspoint/helloworld.java which will demonstrate use of ToggleButton widget. public class HelloWorld implements EntryPoint { public void onmoduleload() { //create toggle buttons ToggleButton togglebutton = new ToggleButton("Click Me!"); ToggleButton togglebutton1 = new ToggleButton("Click Me!"); //disable a toggle button togglebutton1.setenabled(false); //add a clicklistener to the toggle button togglebutton.addclickhandler(new ClickHandler() { @Override public void onclick(clickevent event) { Window.alert("Hello World!"); ); // Add toggle button to the root panel. VerticalPanel panel = new VerticalPanel(); panel.setspacing(10); panel.add(togglebutton); panel.add(togglebutton1); RootPanel.get("gwtContainer").add(panel); Once you are ready with all the changes done, let us compile and run the application in development mode as we did in GWT - Create Application chapter. If everything is fine with your application, this will produce following result:

When you click Click Me button, it will show an alert message Hello World! You can see color of button text will change with your interaction. Hover over the button, color will be pink. Press the button, color will be blue. Release the button, button will remain down. Loading [MathJax]/jax/output/HTML-CSS/jax.js