Thread Rating:
  • 601 Vote(s) - 2.84 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting Started1:Creating a Simple Applet: Hello World
06-15-2011, 02:06 PM, (This post was last modified: 06-16-2011, 01:09 PM by kino.)
#1
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}
{applet {compiler-directives careful? = true}

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}
{applet {compiler-directives careful? = true}}

Hello World

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}
{applet {compiler-directives careful? = true}}

Hello World
This is my first applet

Hello World

This is my first 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}
{applet {compiler-directives careful? = true}}

|| This is a comment

|#
Comments can also
be specified in a
block format
#|

This is my first 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

08-02-2016, 01:55 AM,
#2
RE: Getting Started1:Creating a Simple Applet: Hello World

I am just learning curl and I have tried your Hello Word! applet but when I run the start.curl file from curl IDE or Eclipse, the web browser is launched but I am just getting a URL that looks like File:/// and it is not launching as a web applet. All the code is displayed in the browser.

Any help would be greatly appreciated.

Joey

(06-15-2011, 02:06 PM)kino Wrote: 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}
{applet {compiler-directives careful? = true}

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}
{applet {compiler-directives careful? = true}}

Hello World

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}
{applet {compiler-directives careful? = true}}

Hello World
This is my first applet

Hello World

This is my first 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}
{applet {compiler-directives careful? = true}}

|| This is a comment

|#
Comments can also
be specified in a
block format
#|

This is my first 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

08-15-2016, 03:50 PM, (This post was last modified: 08-15-2016, 04:27 PM by dyoshida.)
#3
RE: Getting Started1:Creating a Simple Applet: Hello World
Probably I think that your default browser is Google chrome or Microsoft edge.
Because Google chrome not supported NPAPI, chrome cannot display an applet in the the browser window.

Please refer this news release. (However, the language is Japanese)
http://www.curlap.com/release/2015/20150806.html

Therefore, I think it better to use a detached applets (.dcurl).
Step1. Create new curl project and select detached applets type.
Step2. Open start.dcurl file. You can see the code, such as:
Code:
{curl 8.0 applet}
{curl-file-attributes character-encoding = "shift-jis"}
{applet manifest = "manifest.mcurl",
    {compiler-directives careful? = true}
}

{View
    {Frame width = 8cm, height = 8cm},
    visibility = "normal",
    {on WindowClose do
        {exit}
    }
}

Step3. Please modify "Frame" like this.
Code:
{Frame width = 8cm, height = 8cm,
    "Hello World"
},



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
Forum Jump:


Users browsing this thread:
5 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('1')