Trail: To 1.1 -- And Beyond!
|
Lesson: Migrating to 1.1
|
|
Simple Name Changes in the AWT
This page lists simple name changes
between the 1.0 and 1.1 releases of the AWT.
These name changes can be performed automatically
by a script such as
the sed script
we provide.
See
How to Convert Code that Uses the AWT
for instructions on using
the sed script.
The name changes listed in the following table
are not valid for non-AWT code.
At least one isn't even valid for all AWT code.
Since the sed script can't tell
what type of object it's affecting,
you might find it making incorrect changes,
which you'll generally discover when you see
compilation error messages
such as the following:
CardWindow.java:40: Method setVisible(java.awt.Panel, java.lang.String) not
found in class java.awt.CardLayout.
((CardLayout)cards.getLayout()).setVisible(cards,(String)arg);
When you see such an error message,
check whether the script
incorrectly changed a method name.
If you find the method name in the second column
of the table below,
look in the first column
to see the method's original name.
You can then edit the program by hand,
changing the error-causing line
to use the original name.
For example, to correct the error above,
you should change
setVisible
to
show on line 40 of the CardWindow.java file.
Note:
To see a complete list of deprecated AWT methods
(1.0 methods no longer recommended in 1.1), see
Deprecated Methods in the AWT.
| Original Method Name
| 1.1 Method Name
|
addItem
| add
|
appendText
| append
|
inside
| contains
|
layout
| doLayout
|
getPageIncrement
| getBlockIncrement
|
bounds
getBoundingBox
| getBounds
|
getClipRect
| getClipBounds
|
locate
| getComponentAt
|
countComponents
| getComponentCount
|
insets
| getInsets
|
countItems
| getItemCount
|
location
| getLocation
|
countMenus
| getMenuCount
|
minimumSize
| getMinimumSize
|
preferredSize
| getPreferredSize
|
getCurrent
| getSelectedCheckbox
|
getLineIncrement
| getUnitIncrement
|
getVisible
| getVisibleAmount
|
insertText
| insert
|
isSelected
| isIndexSelected
|
allowsMultipleSelections
| isMultipleMode
|
delItem
| remove
|
clear
| removeAll
|
replaceText
| replaceRange
|
setPageIncrement
| setBlockIncrement
|
reshape
| setBounds
|
setEchoCharacter
| setEchoChar
|
disable()
| setEnabled(false)
|
enable()
| setEnabled(true)
|
enable(expression)
| setEnabled(expression)
|
move
| setLocation
|
setMultipleSelections
| setMultipleMode
|
setCurrent
| setSelectedCheckbox
|
resize
| setSize
|
setLineIncrement
| setUnitIncrement
|
hide
| setVisible(false)
|
show()
| setVisible(true)
|
show(expression)
| setVisible(expression)
|
nextFocus
| transferFocus
|
|