站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Java Tutorial 5.0 英文版

Setting Program Attributes - Java Tutorial 5.0 英文版

The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail Search
Feedback Form

Trail: Essential Java Classes

Lesson: Setting Program Attributes

Java programs run within an environment that contains system attributes: a host machine, a user, a current directory, and an operating system. A Java program also can set up its own configurable attributes, called program attributes. Program attributes allow the user to configure various startup options, preferred window size, and so on for the program. Sometimes the term preferences is used instead of program attributes.

System attributes are maintained by the System class and are covered later in System Properties. Java programs can set their own set of program attributes through three mechanisms: properties, command-line arguments, and applet parameters.

Using Properties to Manage Program Attributes

A property defines attributes on a persistent basis. That is, you use properties when attribute values need to persist between invocations of a program. This section shows you how to do this in your programs.

Command-Line Arguments

A command-line argument defines attributes for Java applications on a nonpersistent basis. You use command-line arguments to set one or more attributes for a single invocation of an application. This section shows how to accept and process command-line arguments in a Java program.

Applet Parameters

An applet parameter is similar to a command-line argument, except that it is used with applets, not applications. Use applet parameters to set one or more attributes for a single invocation of an applet. For information about applet parameters, see Defining and Using Applet Parameters (in the Essential Java Classes trail).

Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail Search
Feedback Form

Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.