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

Trail: JDK(TM) 1.1 -- And Beyond!
Lesson: Migrating to 1.1

Alternatives to Deprecated Methods in the AWT

This section lists all the deprecated AWT methods and their 1.1 replacements. A script named updateAWT can make the simplest replacements for you. See How to Convert Your Program for instructions and examples of using the script.

A table similar to this one is in Simple Name Changes in the AWT. That table contains a bit less information than this one, and it's alphabetized by the 1.1 column to help you easily undo incorrect changes that the script has made.

In the following table, method names in bold font are the preferred method names. Some of the valid 1.1 substitutes for event-handling methods are less preferable than other 1.1 solutions. For example, although gotFocus can be replaced by processFocusEvent, we'd rather you replaced it with focusGained implemented in a FocusListener, as described in How to Convert Event-Handling Code.

Deprecated Method Class Where Deprecated 1.1 Replacement
action Component See How to Convert Event-Handling Code for examples of handling action events.
allowsMultipleSelections List isMultipleMode
appendText TextArea append
bounds Component getBounds
clear List removeAll
countComponents Container getComponentCount
countItems Choice, List, Menu getItemCount
countMenus MenuBar getMenuCount
deliverEvent Component, Container dispatchEvent
disable() MenuItem setEnabled(false)
enable() Component, MenuItem setEnabled(true)
enable(expression) Component setEnabled(expression)
getBoundingBox Polygon getBounds
getClipRect Graphics getClipBounds
getCurrent CheckboxGroup getSelectedCheckbox
getCursorType Frame getCursor method in Component
getLineIncrement Scrollbar getUnitIncrement
getPageIncrement Scrollbar getBlockIncrement
getPeer Component No replacement.
getVisible Scrollbar getVisibleAmount
gotFocus Component processFocusEvent
See How to Convert Event-Handling Code for information on preferred ways to handle events.
handleEvent Component processEvent
See How to Convert Event-Handling Code for information on preferred ways to handle events.
hide Component setVisible(false)
insertText TextArea insert
insets Container getInsets
inside Component, Polygon, Rectangle contains
isSelected List isIndexSelected
keyDown Component processKeyEvent
See How to Convert Event-Handling Code for information on preferred ways to handle events.
keyUp Component processKeyEvent
See How to Convert Event-Handling Code for information on preferred ways to handle events.
layout Component, Container, ScrollPane doLayout
locate Component, Container getComponentAt
location Component getLocation
lostFocus Component processFocusEvent
See How to Convert Event-Handling Code for information on preferred ways to handle events.
minimumSize Component, Container, TextArea, TextField getMinimumSize
mouseDown Component processMouseEvent
See How to Convert Event-Handling Code for information on preferred ways to handle events.
mouseDrag Component processMouseMotionEvent
See How to Convert Event-Handling Code for information on preferred ways to handle events.
mouseEnter Component processMouseEvent
See How to Convert Event-Handling Code for information on preferred ways to handle events.
mouseExit Component processMouseEvent
See How to Convert Event-Handling Code for information on preferred ways to handle events.
mouseMove Component processMouseMotionEvent
See How to Convert Event-Handling Code for information on preferred ways to handle events.
mouseUp Component processMouseEvent
See How to Convert Event-Handling Code for information on preferred ways to handle events.
move Component, Rectangle setLocation
nextFocus Component, Container, Window transferFocus
postEvent Component, Window dispatchEvent
preferredSize Component, Container, TextArea, TextField getPreferredSize
replaceText TextArea replaceRange
reshape Component, Rectangle setBounds
resize Component, Rectangle setSize
setCurrent CheckboxGroup setSelectedCheckbox
setCursor Frame setCursor method in Component
setEchoCharacter TextField setEchoChar
setLineIncrement Scrollbar setUnitIncrement
setMultipleSelections List setMultipleMode
setPageIncrement Scrollbar setBlockIncrement
show() Component setVisible(true)
show(expression) Component setVisible(expression)
size Component getSize


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

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