Friday 6 December 2013

Open URL of PDF file in webview in andorid

In appcelerator PDF url is not open directly in webview.

So i suggest you some alternative here.

There are 2 alternative for this .

i hope any of this way may be helps you.

1) Prefer this link with the help of this you can open that PDF in appcelerator http://www.appcelerator.com/blog/2011/09/sharing-project-assets-with-android-intents/

2) Other Alternative

Titanium.Platform.openURL('https://docs.google.com/viewer?url=' + ATTACH YOUR PDF URL);


By this way you can open the PDF in android in Appcelerator or using native intent both ways you have.

Thanks,

Saturday 30 November 2013

GCM PushNotification in Android

Today we learn how to setup GCM push Notification in appcelerator for android.

In this whole process i divided in to 3 steps.

Here we go to start that how configure it.

1) First Step :
     Open this link https://developers.google.com/console/
     than login with you account. Create a new project

    i) "Creating a Google API Project",
    ii)"Enabling the GCM Service"
    iii)"Obtaining an API Key"


Image snap link : http://1.bp.blogspot.com/-AKAcUDtW0gg/UlK8rcpqUQI/AAAAAAAACuI/aq89OFZc2C4/s1600/all_steps.png

2) Second Step :
      Click on this link https://cloud.google.com/console#/project
     You can found you project that you already created.
     Just Click on that and you found the Example: Project Number: 91060sdsdgsd

3) Third Step :
    Now next step open this url https://my.appcelerator.com/apps
    Login with your appcelerator account where you want to configure this vcm.
    Click on your project than at the top side there are two option (Production/Development).
    Click on Development. Now the main menu box will open in that there is 2nd (Second) tab            click on that.
    Now you found in that page Android Push Configuration
    please fill this both fields
    i) Google Cloud Messaging(GCM) API Key:
    ii)Google Cloud Messaging (GCM) sender ID:


when you finish this process you can register use or create user with this code.

Code : ) https://github.com/dharmik/GCM-PushNotification

If any one need help in this please leave comment i will surely help you.

Thanks,
Dharmik

Thursday 14 November 2013

Implement Ti Jasmin in appcelerator

Hi,

I successfully implement Jasmin inappcelerator . i want to share code for implemented Jasmin.

Here the git link. it help you to implement it.


ABOUT IT :

Jasmine is a behavior-driven development framework for testing JavaScript code. It does not depend on any other JavaScript frameworks. It does not require a DOM. And it has a clean, obvious syntax so that you can easily write tests.

It helps me a lot for implement in my current project.

Some of helpful links : http://pivotal.github.io/jasmine/

Source Code Link : https://github.com/dharmik/TiJasmin

If any one face any problem to implement this just Comment your mail address i contact you as soon as possible.

Tuesday 8 October 2013

How to use sugar.js file in Appcelerator ?

// Sugar.js file is very useful in our developing process .

// Today I create one sample  code which contain sugar.js file and it help me a lot.

// Sugar is a Javascript library that extends native objects with helpful methods. It is designed to be intuitive, unobtrusive, and let you do more with less code.

// Sugar provides methods on strings like from, to, first, last, add, and remove to make modifying strings intuitive and readable, as well as others like each, chars, words, lines, paragraphs which allow iterating over chunks of text. Common escaping methods like escapeURL, escapeHTML, and escapeRegExp provide quick shortcuts for string escaping. Multilingual support is also enhanced with shortcut methods to Unicode script blocks, such as Kanji (Chinese and Japanese), Hiragana (Japanese), Hangul (Korean), Greek, Hebrew, and more. 

// sugar gives the Date class much love starting with the Date.create method which can understand dates in just about any format in 15 major languages, including relative formats like "1 hour ago".

// I create one sample project in appcelerator and i really happy to use this file .

And that project is available on Git. :)

https://github.com/dharmik/use-of-sugar.js-file

Helpful Link : )

sugarjs.com

 I hope this code helps you and solve your some problems. :)


Tuesday 1 October 2013

How to check the valid Youtube URL ?

// Here, The simple way to valid YouTube url in Appcelerator.

// Typically, the thing that most people want is the youtube video ID valid or not. 

// Some one also check that front part youtube.com/ that one very easy in appcelerator.

Here , some code

 var _videoUrl = "youtube.com/watch?v=FhnMNwiGg5M";
 var _videoUrlNotValid = "go.com/watch?v=FhnMNwiGg5M";

var matches = _videoUrl.match(/((http|https):\/\/)?(www\.)?(youtube\.com)(\/)?([a-zA-Z0-9\-\.]+\/?/);

var matches = _videoUrlNotValid.match(/((http|https):\/\/)?(www\.)?(youtube\.com)(\/)?([a-zA-Z0-9\-\.]+)\/?/);

  if (matches) {
        alert('valid youtube URL');
    }else{
        alert('Not valid');
    }

Output :)

1) _videoUrl is valid
2) _videoUrlNotValid not valid

Hope it helps you , i use this in Appcelerator and it works for me.

Monday 30 September 2013

Very Simple use to MATH function in javascript

// This one is very simple blog to understand littlebit about MATH function in appcelerator.

// This one is very to easy but i want to share it because today i waste my 3 hour in one simple line code

// I just want to do one simple this like if i get value
3.5 it would be 4 same as,
4.1 it would be 4 same as,
4.9 it would be 5 same as.

It means simple ROUND .

But i didnt think about MATH function at that time . I just try it my own way that one is successful but here one simple mathod ROUND in MATH with the use of this function i easily get may goal.

Example : 
  1. var ratingInfo = Math.round(2.5);
  2. var ratingInfo = Math.round(3.9);
  3. var ratingInfo = Math.round(4.1);
  4. var ratingInfo = Math.round(2.7);
Output :)
  1. 3
  2. 4
  3. 4
  4. 3
This one is very easy in Appcelerator i use this function for Rating Functionality in my Application.

There are lots of other part method is available in MATH .

Like

1 ) Math.random() :  It return a random number between 0 and 1.

2 ) Math.max(15,10) : It return the number with the highest value of two specified numbers.

3) Math.min(25,40) : It return the number with the lowest value of two specified numbers.

That one really helpful me its very easy but it help me a lot so i share it with you.

I hope it helps to all.



 

Monday 16 September 2013

Text To Speech Available in Appcelerator MarketPlace

// Text To Speech is very good thing and i already create blog on that and many people like it.

// One day i decide to share that product with Appcelerator. i just send that to appcelerator that accept that and that product is now in marketplace.

// That product is available in Open Marketplace and that created in alloy. 

// Best thing of that code is that work fine in both platform .

// Same code works for both (iOS , android)

// Most Important Point in Text TO Speech  :)

"Google now requires an API Key to use Google Translate on your website and charges $20 USD per million characters. Question: Where do you add the key within the above URL in order not to get a 404 message from Google"

Here, i share with you marketplace link with the help of this link you can directly download that sample code and i hope that it will help you a lot.

Download Link :)  https://marketplace.appcelerator.com/apps/6518?837327809

Slider widget In Appcelerator Marketplace

// The slider like facebook is now available in appcelerator Open Marketplace. 

// And the best thing is that product is accepeted by appcelerator i really happy about this.

// That product is available in Open Marketplace and that created in alloy. 

// Best thing of that widget is that work fine in both platform .

// There is not difference in that widget look and feel and also in their how is works.

// Same code works for both (iOS , android)

Here, i share with you marketplace link with the help of this link you can directly download that sample widget and i hope that it will help you a lot.

Download Link :)  https://marketplace.appcelerator.com/apps/6373?2033952617

Friday 30 August 2013

How-to-use i18n(Internationalization) folder in Appcelerator

//  How-to-use i18n(Internationalization) folder

// Rather than hard-coding strings into your project, you can use localized strings. Localized strings are replaced at runtime with values appropriate to the user's language. Titanium relies on resources files and string placeholders to accomplish this task.

Example :)

 // Titanium provides two functions for obtaining a localized string from your resource files. Both take the key of the string requested as their first parameter. The L() macro is a short form for Ti.Locale.getString():


Helpful LINK :  https://wiki.appcelerator.org/display/guides/Internationalization

LIKE

var str1 = L('welcome_message');
var str2 = Ti.Locale.getString('welcome_message');
// str1 === str2

Sample code is available on GIT :) 
https://github.com/dharmik/How-to-use-i18n-folder--

Thursday 15 August 2013

How to use paint module and save that image in local . .

// In this blog we learn that how to use paint module in appcelerator

// This module is very easy to use.

// This paint module is available on appcelerator market place.

//Sample code is available here. :)

You can get module using this link

https://dl.dropboxusercontent.com/u/72783403/paint.zip


var Paint = require('ti.paint');

var win = Ti.UI.createWindow({
    backgroundColor : '#fff'
});
var paintView = Paint.createPaintView({
    top : 0,
    right : 0,
    bottom : 80,
    left : 0,
    strokeColor : 'black',
    strokeAlpha : 255,
    strokeWidth : 5,
    eraseMode : false
});
win.add(paintView);

var clear = Ti.UI.createButton({
    bottom : 40,
    right : 50,
    width : 75,
    height : 30,
    title : 'Clear'
});
clear.addEventListener('click', function() {
    paintView.clear();
});
win.add(clear);
var save = Ti.UI.createButton({
    bottom : 40,
    left : 50,
    width : 75,
    height : 30,
    title : 'Save'
});
save.addEventListener('click', function() {
    var filename = "sample.png";
    var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, filename);

    if (file.exists()) {
        file.deleteFile();
    }

    file.write(paintView.toImage());
    var path = file.nativePath;
    Ti.API.info('path of image' + path);
    alert('Image Save');
});
win.add(save);

win.open();




Sunday 11 August 2013

Different project structure

// Today we simply discuss some project structure.

// How to display menu in appcelerator in different style.


// Sample code is available on GIT :)

https://github.com/dharmik/MenuStructure


Pic :)

 
 



Drag Pin on MAP in Android device In Appcelerator

// Today we learn something different in appcelerator .

// In appcelerator we all kown that we drag pin on Map in iOS we can easily do that .

// In iOS there are some property is available like Dragabble .

// With the use of this property we can easily drag that pin on map in iOS

// But HOW to DRAG that PIN on MAP in ANDROID Device in Appcelerator ?

// Draggable property is only available in iOS not for ANDROID.  :( :( :(

Here one video is available on Youtube that really good and with the help of this URL i solve my problem and that i share wuth you.

http://www.youtube.com/watch?v=M4fUlqKWg7g
And that sample code is also available on GIT.. :)

https://github.com/dharmik/Drag-Pin-In-Android

Friday 2 August 2013

Text Field In ALERT BOX in Android in APPCELERATOR

Below is Simple code for TextField in ALERT BOX. 



app.js

//Helpful code :)

var win = Titanium.UI.createWindow({
    backgroundColor:'#fff'
});

var textfield = Ti.UI.createTextField({
    value : 'Hello :)'
});

var dialog = Ti.UI.createAlertDialog({
    title: 'Enter text',
    androidView: textfield,
    buttonNames: ['OK', 'cancel']
});
dialog.addEventListener('click', function(e){
    Ti.API.info(textfield.value);
});
dialog.show();

win.open();

Snap :)


Monday 22 July 2013

How to remove strip_tags in Appcelerator ?

// Here sample code to remove strip_tags from strings.

 Helpful Link : http://phpjs.org/functions/strip_tags/

 Code :

 var input = "<div>Sani</div>" // Static string
       
      strip_tags(input); // function

      function strip_tags(input) {
         var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi, commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
            return input.replace(commentsAndPhpTags, '').replace(tags, '');
        }


OutPut : Sani

Wednesday 10 July 2013

Appcelerator Titanium Business Application Development Cookbook Review .



Appcelerator Titanium Business Application Development Cookbook


What you will learn from this book :

I really thanks to  Benjamin Bahrenburg who is author of this book. This book helps me a lot and also very helpful to me. With the help of this book clear my douts and learn good things witch help me in code. 

With the help of this book i learn many thing like
 1) Location
 2) Passcode
 3) Notification
 4) LockScreen
 5) Analytics
 6) URL Schemes etc......

Approach :

Written in a cookbook style, this book offers solutions using a recipe-based approach. Each recipe contains step-by-step instructions followed by an analysis of what was done in each task and other useful information. The cookbook approach means you can dive into whatever recipes you want in no particular order.

Who this book is written for :

This book is for any developer who possesses some JavaScript or web development knowledge and wishes to take a leap into building native applications for both the iPhone and Android. No knowledge of Objective C and Java is required. Using this book he/she easily understand about Appcelerator and very helpful to create Application in Android, Tablet, iPhone, iPad, etc .

Book Is Available:

Appcelerator Titanium Business Application Development Cookbook 

Examples : 

With the help of this book you can easily develop some good example in appcelerator in both OS android as well as iOS. :)

1)   Use of Google Analytics in your application.
2)   Opening PDF documents in Android and iOS.
3)   AES encryption using JavaScript
4)   Using the LinkedIn Contacts API  
5)    Passcode

This all are the basic examples are available in this book. And its really helpful to me. 


I show you some snapshot of my application that i create with the help of this book.

First snap of PassCode. :)
And 
Second snap of PDF viewer. :)



 





Monday 8 July 2013

How to use iOS DocumentViewer .

// iOS DocumentViewer is very helpful to open .pdf file in appcelerator in iOS.

Prefer below link it gives whole description of iOS DocumentViewer.

// http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.iOS.DocumentViewer

For example, an email program might use this class to allow the user to preview attachments and open them in other apps. Use this class to present an appropriate user interface for previewing or printing a specified file. 

Sample Code  :)

app.js 

var win1 = Titanium.UI.createWindow({
    title : 'win 1',
    backgroundColor : '#fff'
});
var modalWin = Ti.UI.createWindow();

var navmodal = Ti.UI.iPhone.createNavigationGroup({
    window : modalWin
});
win1.add(navmodal);

var b2t = Titanium.UI.createButton({
    title : 'Open PDF'
});
modalWin.RightNavButton = b2t;

var b1t = Titanium.UI.createButton({
    title : 'Share PDF',
    height : 40,
    width : 200,
    top : 270
});
win1.add(b1t);

z = Ti.UI.iOS.createDocumentViewer({
    url : 'GettingStarted.pdf' // Name of PDF file and path is simply in iphone folder
});

b1t.addEventListener('click', function() {
    z.show({
        animated : false,
        view : b2t
    });
});

b2t.addEventListener('click', function() {
    z.show();
});
win1.open();

Snap :)







Wednesday 3 July 2013

Titanium Mobile Create a Sliding Menu for iOS

// Titanium Mobile Create a Sliding Menu for iOS

In  this link tutorial is available for Sliding Menu, that code is simple code not in Alloy.

http://mobile.tutsplus.com/tutorials/appcelerator/titanium-mobile-create-a-sliding-menu-for-ios/


// I just use same code that give in this tutorial but only difference is my code is in Alloy.

// If any one need that code in alloy that person take code from GIT. :)

// That Alloy Code is available on Git.

Here the Link. :)

https://github.com/dharmik/Sliding-Menu-for-iOS-in-Alloy 

Helpful Link :)

http://mobile.tutsplus.com/ 




(Alloy) Slider Like Facebook working in both android and iOS

// Slider like facebook working in both Android and iOS .

// Code is in alloy .

// Code is working fine in both os.

// Slider is smoothly working.

// Code is available on GIT :)

https://github.com/dharmik/Slider-Like-Facebook-working-in-both-android-and-iOS

Here snap of iPhone simulator. and this slider working fine in android device.

Snap :)




Monday 1 July 2013

Use Emoji In Appcelerator

// How to use Emoji in appcelerator ?

//It is very easy to create Emoji in appcelerator.

//What is Emoji ?

// ANS : Emoji started in Japan so many of the icons are closely tied to the Japanese culture. Some of them are quite foreign.

//Prefer below link it very helpful to you to understand what is Emoji and how to use it.


http://hasseg.org/blog/post/546/use-unicode-emoji-as-image-free-icons-in-ios-web-apps/ 

http://hasseg.org/blog/post/692/use-unicode-emoji-as-icons-in-native-ios-apps/

Sample code is available on Git.

Here git Link :)

https://github.com/dharmik/Use-Emoji

Snap :)


Friday 28 June 2013

Use of IPhone URL Schemes

// Here is the example of how to Use of IPhone URL Schemes.

// How to use it ?

// IPhone URL Schemes is very easy and very helpful to use.

// This page centralizes code samples for URL schemes available in many iPhone applications, not only in Apple's but in many others. It also includes programming tips and references about implementing apps registering or consuming URL schemes. 

//Below link is very helpful to developer

 http://wiki.akosma.com/IPhone_URL_Schemes#SMS 

In example we can easily open below iPhone Application

            1)  Open Maps
            2)  Open SMS
            3)  Open Dialer
            4)  Open YouTube

            5)  Open App Store / Market
            6)  Open Skype
            7)  Open Gmail
            8)  Open Safari
            9)  Open Music
          10)  Open iBook


But for that we have application install in iPhone.

Otherwise it can not open.

Test that application in phone not a simulator because in simulator you get less idea compare to phone.

So check it in LIVE DEVICE.

Sample code for how to use  iPhone URL Schemes available on GIT : )

 https://github.com/dharmik/URLSchemes

i) snap :)


                                                       ii) snap :)
                                                                                                              iii) snap :)



Friday 21 June 2013

Use custom JSON file in ALLOY



// Here is sample code of how to use custom JSON file in alloy

// In this code there is simple map functionality is available in that map all the coordinates like

1) Longitude
2) Latitude
3) Name

All above parameter are coming from Custom JSON file.

So We can easily Create custom json file and also pin it to MAP.

Sample code is available on Git.

Here is LINK :)

https://github.com/dharmik/Custom-JSON-File

Snap-Shot :)

Tuesday 11 June 2013

Get Profile Detail With The Help Of Gravatar E-mail Address .

// With the help of Gravatar email address you can get its Profile Detail like
  • Name
  • Profile Pic
  • FamilyName
  • FullName
  • Location
 // So no need to take profile detail from user if user have gravatar account. :)

CODE :)
https://github.com/dharmik/Gravatar-ProfileDetails


Helpful Link :) 
https://en.gravatar.com/site/implement/profiles/json/

Tuesday 28 May 2013

Text to Speech in Appcelerator Using Google Translater(In Alloy)

// I just Test it in iOS But i think it also work fine in android  :)

// The Best part is in this example is   http://translate.google.com/translate_tts?tl=en&q=  . Google    provide us this link to easily convert any text in to speech .

index.xml

<Alloy>
    <Window class="container">
        <Label id="label" onClick="doClick">Sound Play with the use of google translater Click Here.</Label>
    </Window>
</Alloy>

index.tss

".container": {
    backgroundColor:"white"
},
"Label": {
    width: Ti.UI.SIZE,
    height: Ti.UI.SIZE,
    color: "#000"


index.js

function doClick(e) {
    var name = 'Appcelerator is Very Good Platform'; // You can write any thing here :)

    var googleUrl = 'http://translate.google.com/translate_tts?tl=en&q=' + name;
    var xhr = Titanium.Network.createHTTPClient();
    xhr.open("GET", googleUrl);
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.send();

    xhr.onerror = function(e) {
        alert('On Error');
    }

    xhr.onload = function() {
        var player = Ti.Media.createSound({
            url : googleUrl
        });
        player.play();
    }
}

$.index.open();

Screen Shot : )



Custom Html file open in webView in appcelerator(In Alloy)

// Its very simple create your own HTML file and you can easily add in appcelerator and open it in webView.

// I checked it in iOS .

// Try starting your HTML file with a simple <HTML> tag only. You don't need the doctype info in there. I had the same problem and that's how I fixed it.

index.js
 $.index.open();

var webview = Titanium.UI.createWebView({url:'index.html'}); // Path of html file
$.map.add(webview);


index.tss

".container": {
    backgroundColor:"white"
},
"Label": {
    width: Ti.UI.SIZE,
    height: Ti.UI.SIZE,
    color: "#000"


index.xml

<Alloy>
    <Window class="container">
        <View id="map"/>
    </Window>
</Alloy>

index.html file Dropbox link.

https://dl.dropboxusercontent.com/u/72783403/AtoZ/index.html

ScreenShot : )


Loading Style for iPhone in Appcelerator(In ALLOY)

index.xml

<Alloy>
    <Window class="container">
        <View id="backdrop"/>
        <View id="container">
            <ImageView id="loader"/>
            <Label id="message" textid="Loading..."/>
        </View>
    </Window>
</Alloy>

index.js

$.loader.images = [
    '/img/loading/load-cloud1.png',
    '/img/loading/load-cloud2.png',
    '/img/loading/load-cloud3.png',
    '/img/loading/load-cloud4.png',
    '/img/loading/load-cloud5.png',
    '/img/loading/load-cloud6.png',
    '/img/loading/load-cloud7.png',
    '/img/loading/load-cloud8.png',
    '/img/loading/load-cloud9.png'
];

$.start = function() {
    $.loader.start();
};

$.stop = function() {
    $.loader.stop();
};

$.setMessage = function(key) {
    $.message.text = "Loading...";
};

$.start();


$.index.open();

index.tss

'#container': {
    layout:'vertical',
    height:Ti.UI.SIZE
},

'#backdrop': {
    backgroundColor:'#232323',
    opacity:0.75
},

'#loader': {
    width:'75dp',
    height:'46dp'
},

'#message': {
    color:'#ebebeb',
    textAlign:'center',
    height:Ti.UI.SIZE,
    width:Ti.UI.SIZE,
    font: {
        fontSize:'12dp',
        fontWeight:'bold',
        fontFamily : "PFDinDisplayPro-Regular"
    }
}





All the images, pleases download from this dropbox link

https://dl.dropboxusercontent.com/u/72783403/loading.zip

Screen Shot :)


 

Friday 24 May 2013

Generate CSV file in Appcelerator

// In app.js file just write this code

Part i -

var csv = require('exportCsvData');
 
var win = Ti.UI.createWindow({
    backgroundColor:'#ccc',
    title:'CSV Import Module'
})
 
var createCsv = Titanium.UI.createButton({
    title:'CSV',
    top:'140',
    left:'110',
    height:'40',
    width:'115',
    color:'black'
});
win.add(createCsv);
 
createCsv.addEventListener('click', function(e){
   var input = [
     [" data 0", " place 1", " address 2", " name 3"],
     [" data 0", " place 1", " address 2", " name 3"],
     [" data 0", " place 1", " address 2", " name 3"],
     [" data 0", " place 1", " address 2", " name 3"]
   ];
   
   var op = csv.exportCsvData(input);
   alert("Output file path = "+ op);
});
 
 
win.open();
 
 
 

// Create on exportCsvData.js file 

Part ii -

exports.exportCsvData = function(input)
{
 
    var rowTxt = "";
    for(var i=0;i < input.length; i++){ // row iteration
        for(var j = 0; j < input[i].length; j++){ // column iteration
            rowTxt += '"' + input[i][j] + '"';
  
            if(j < (input[i].length-1))
            {
                rowTxt += ',';
            }
        }
        rowTxt += '\n';// adding new line at end of row
    }
 
    // creating output file in application data directory
    var outputFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'output.csv');
    // writing data in output file
        outputFile.write(rowTxt);
 
 
    if(outputFile.exists){
        alert("CSV generated!!!");
    }
     
    // return output file path
    return outputFile.nativePath;   
}

Thursday 23 May 2013

Android Intents Functionality

 
Ti.UI.backgroundColor = '#000000';
 
var win = Ti.UI.createWindow();
var label = Ti.UI.createLabel({
    text: 'Say Something!',
    color:'#eeeeee',
    font: {
        fontSize:'20dp',
        fontWeight:'bold'
},
    height:'auto',
    top:'5dp'
});
 
var textarea = Ti.UI.createTextArea({
    width:'90%',
    top:'44dp',
    bottom: '70dp',
    left:10,
    right:10
});
 
var button = Ti.UI.createButton({
    title:'Share',
    height:'auto',
    width:'auto',
    font: {
        fontSize:'24dp'
    },
    bottom:'10dp',
    right:10
});
 
button.addEventListener('click', function(e) {
    var intent = Ti.Android.createIntent({
        action: Ti.Android.ACTION_SEND,
        type: "text/plain"
    });
 
intent.putExtra(Ti.Android.EXTRA_TEXT, textarea.value);
intent.addCategory(Ti.Android.CATEGORY_DEFAULT);
Ti.Android.currentActivity.startActivity(intent);
});
 
win.add(label);
win.add(textarea);
win.add(button);
 
win.open();