06-15-2011, 02:06 PM,
(This post was last modified: 06-16-2011, 01:09 PM by kino.)
|
|||||
|
|||||
Getting Started1:Creating a Simple Applet: Hello World
One of the powers of the Curl language is that it combines the worlds of document markup, scripting, and object-oriented programming into a single language.
3 Languages in 1 Language Feature: Description Markup Language: Similar to HTML, it allows you to easily format text, tables, and lists Scripting Language: Similar to JavaScript, it allows you to create interface elements such as buttons and drop-down menus Programming Language: Similar to Java, it combines the flexibility of object-oriented programming Curl was specifically designed to have a gentle slope learning curve. At one end of the curve is a simple markup language and at the highest end of the curve is a feature rich programming language in which you can build object-oriented applications with 3-D graphics and other advanced tools. Starting at the beginning of the curve, the simplest element in an applet written in the Curl language is text. When you include text in a Curl applet, the browser displays that text that is displayed in the default font and point size. It treats spaces in the same manner as HTML does, by collapsing spaces that appear between words. In other words, if a number of consecutive spaces appear between words, the spaces are collapsed and only one space is displayed in the browser. Creating Hello World You will now learn how to write code for your first Curl applet; the all too familiar "Hello World" applet. We can create the applet content by adding the text after the herald declarations. In each Curl example, you will see the source code. You will see two lines of code at the top of the file that are present for the applet to properly run. Code: {curl 6.0, 7.0 applet} In this case: •The first line of code is called the herald. It indicates the Curl API version and the type of content (either applet, package, or script). •The second line of code indicates applet properties. In this case, compiler-directives specifies careful?=true which is the recommended default. Next, we can type the text Hello World using a Curl Example Box. Tip: Throughout the Curl Cues, you will be able to interactively view and manipulate the examples using an interactive example box. The example box displays the source code and the result of evaluating that code. Unlike static examples, the example box allows you to change the code and view the new result in a pop-up window. Code: {curl 6.0, 7.0 applet} Congratulations!! This is your first applet. Any text in your file is treated by the Curl runtime as text that should be displayed. Now, if a line with no text appears in a Curl applet, the runtime stops collapsing the whitespace and creates a new paragraph for the text that follows. Code: {curl 6.0, 7.0 applet} For more information regarding example boxes, please refer to the following section in the Curl Documentation: Curl Developer's Guide > Getting Started > Viewing the Documentation Adding Comments Commenting your code is always good practice. In the Curl Language, comments follow two vertical bar characters ||. Everything following these characters is considered a comment, and is ignored by the Curl runtime when interpreting the applet. You can also use the combination of |# and #| to comment out multiple lines of code. Code: {curl 6.0, 7.0 applet} For more information regarding comments, please refer to the following section in the Curl Documentation: Curl Developer's Guide > Core Language - Syntax > Basic Syntax |
|||||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Getting Started1:Creating a Simple Applet: Hello World - by kino - 06-15-2011, 02:06 PM
RE: Getting Started1:Creating a Simple Applet: Hello World - by joe.coyle - 08-02-2016, 01:55 AM
RE: Getting Started1:Creating a Simple Applet: Hello World - by dyoshida - 08-15-2016, 03:50 PM
|
Possibly Related Threads... | |||||
Thread | Author | Replies | Views | Last Post | |
Styling3:Creating Styles with the Style Designer | kino | 0 | 5,086 |
06-16-2011, 09:52 AM Last Post: kino |
|
Serving Content1:Launching a Curl Applet | kino | 0 | 5,371 |
06-15-2011, 05:12 PM Last Post: kino |
|
Forms1:Creating Forms | kino | 0 | 5,336 |
06-15-2011, 04:55 PM Last Post: kino |
|
User Interface Basics3:Creating Dialogs | kino | 0 | 3,360 |
06-15-2011, 03:55 PM Last Post: kino |
|
Getting Started5:Creating Lists | kino | 0 | 3,380 |
06-15-2011, 03:15 PM Last Post: kino |
|
Getting Started3:Top-level Applet Specifications | kino | 0 | 3,448 |
06-15-2011, 02:42 PM Last Post: kino |
Users browsing this thread:
1 Guest(s)
1 Guest(s)