Programming

Introduction to Java :Components Part-2

Fadıl

Lists

You will recall that in the SELECT widget in HTML programming, you could select how many choices were visible at any one time using the SIZE attribute. Well, since the Choice widget does not have such an attribute, you need to use a different component if you want that functionality. In the JDK, the List component is used for such circumstances.

import java.awt.*;

public class ListExample
  {
  public static void main(String[] args)
    {
    Frame baseFrame = new Frame();
    baseFrame.reshape(10,10,200,200);
    baseFrame.setTitle("List Example");
    List list = new List(3, true);
    list.addItem("Selena");
    list.addItem("Eric");
    list.addItem("Mark");
    list.addItem("Bob Frog");
    baseFrame.add(list);
    baseFrame.show();
    }
  }

Menus allow you to organize many related functions in your application in one centralized, easy-to-use interface object. Although Menus come in many forms, the most common menu types are “menu bars.”

PHP Function:  Built-in Functions part 8

PHP Function: Built-in Functions part 8

Fadıl

Misc. Functions

The die() and exit functions provide useful control over the execution of your script, offereing an ‘escape route’ for programming errors.

die()
Outputs a given message and terminates the script when a returned value is false. Its syntax is

die(“message”);

for example, you would use the following code to print a message and stop the execution of your script upon failure to connect to your database:

$connection = mysql_connect(“servername”, “username”, “password”)
or die(“Can’t connect to database.”);

Introduction to Java :Components Part-1

Fadıl

Static Text with Label

The Label class gives you the ability to draw a single line of text in your application. There is not much to it, consider the following example:

In all of the following examples, we will use the add() method to add components to a Frame object in order to show them on the monitor. Frame and add() will be discussed in the next section. So don’t worry about the specifics of baseFrame or add() for now. Instead, watch how the components are used within it!

PHP Function:  Built-in Functions part 7

PHP Function: Built-in Functions part 7

Fadıl

Here are yet more Built-in Functions,

Mail Function
If your server has access to sendmail or an SNMP gateway the mail() function sends mail to a specified recipient. Its syntax is

mail(“recipient”, “subject”, “message”, “mail headers”);

For example, the following code sends mail to [email protected] with the subject of “Great Site” and a message body saying “Techsoftcenter.com Is a cool site!”. The “From:” line is part of the additional mail headers.

Introduction to Java : Using the AWT To Build User Interfaces

Fadıl

Using the AWT To Build User Interfaces

Now we will make a big jump: we need to go from a simple application to a more serious one that will be representative of the kinds of applications you will build in real life. To do so, we will take advantage of the AWT class package that is distributed with the JDK.

As stated in the pre-requisite article “Web Programming 101,” one of the big benefits of using Java is the ability it gives you to create web-based graphical user interfaces (GUIs).