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

Defining and Using Applet Parameters - Java Tutorial 5.0 英文版

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

Trail: Deployment
Lesson: Applets

Defining and Using Applet Parameters

Parameters are to applets what command-line arguments are to applications. They allow the user to customize the applet's operation. By defining parameters, you can increase your applet's flexibility, making your applet work in multiple situations without recoding and recompiling it.

The next few pages discuss parameters from the applet programmer's point of view. To learn about the user view of parameters, see Specifiying Parameters.

Deciding Which Parameters to Support (in the Deployment trail)

When implementing parameters, you must answer four questions:

  • What should the applet let the user configure?
  • What should the parameters be named?
  • What kind of value should each parameter take?
  • What should the default value of each parameter be?

Writing the Code to Support Parameters (in the Deployment trail)

Applets get the user-defined values of parameters by calling the Applet getParameter method.

Giving Information about Parameters (in the Deployment trail)

By implementing the getParameterInfo method, applets provide information that browsers can use to help the user set parameter values.


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

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