Java on Solaris 7 Developer's Guide

What Is Deprecation?*

A method is deprecated when it is no longer considered important, and should no longer be used because it may be deleted from its class. Deprecation is a result of classes evolving, causing their APIs to change. Methods are renamed, new ones added, attributes change. Deprecated classes and methods are marked "@deprecated" in documentation comments to enable developer transition from that API to the new one.

Table 4-1 Deprecated Methods
 Class Method Replaced By
java.awt.BorderLayoutaddLayoutComponent() addLayoutComponent(component,object)
java.awt.CardLayoutaddLayoutComponent()addLayoutComponent(component,object)
java.awt.CheckboxGroupgetCurrent() getSelectedCheckbox()
setCurrent() setSelectedCheckbox()
java.awt.ChoicecountItems()getItemCount()
java.awt.ComponentgetPeer() No replacement.
enable()setEnabled(true)
disable()setEnabled(false)
show()setVisible(true)
hide()setVisible(false)
location()getLocation()
move()setLocation()
size()getSize()
resize()setSize()
bounds()getBounds()
reshape()setBounds()
preferredSize()getPreferredSize()
minimumSize()getMinimumSize()
layout()doLayout()
 inside()contains()
locate()getComponentAt()
deliverEvent()dispatchEvent()
postEvent()dispatchEvent()
handleEvent()processEvent()
mouseDown()processMouseEvent()
mouseDrag()processMouseMotionEvent()
mouseUp()processMouseEvent(MouseEvent)
mouseMove()processMouseMotionEvent()
mouseEnter()processMouseEvent()
mouseExit()processMouseEvent()
keyDown()processKeyEvent()
keyUp()processKeyEvent()
action()Register as ActionListeneron component firing action events.
gotFocus()processFocusEvent()
lostFocus()processFocusEvent()
nextFocus()transferFocus()
java.awt.ContainercountComponents()getComponentCount()
insets()getInsets()
preferredSize()getPreferredSize()
minimumSize()getMinimumSize()
deliverEvent()dispatchEvent()
locate()getComponentAt()
java.awt.FontMetricsgetMaxDescent()getMaxDescent()
java.awt.FramesetCursor()setCursor()method in Component
getCursorType()getCursor() method in Component
java.awt.GraphicsgetClipRect()getClipBounds()
java.awt.ListcountItems()getItemCount()
clear()removeAll()
isSelected()isIndexSelected()
allowsMultipleSelections()isMultipleMode()
setMultipleSelections()setMultipleMode()
preferredSize()getPreferredSize()
minimumSize()getMinimumSize()
delItems()No longer for public use; retained as package private.
java.awt.MenucountItems()getItemCount()
java.awt.MenuBarcountMenus()getMenuCount()
java.awt.MenuComponentsgetPeer() No replacement.
postEvent()dispatchEvent()
java.awt.MenuContainerpostEvent()dispatchEvent()
java.awt.MenuItemenable()setEnabled(true)
disable()setEnabled(false)
java.awt.PolygongetBoundingBox()getBounds()
inside()contains()
java.awt.Rectanglereshape()setBounds()
move()setLocation()
resize()setSize()
inside()contains()
java.awt.ScrollPanelayout()doLayout()
java.awt.ScrollbargetVisible()getVisibleAmount()
setLineIncrement()setUnitIncrement()
getLineIncrement()getUnitIncrement()
setPageIncrement()setBlockIncrement()
getPageIncrement()getBlockIncrement()
java.awt.TextAreainsertText()insert()
appendText()append()
replaceText()replaceRange()
preferredSize()getPreferredSize()
minimumSize()getMinimumSize()
java.awt.TextFieldsetEchoCharacter()setEchoChar()
preferredSize()getPreferredSize()
minimumSize()getMinimumSize()
java.awt.WindowpostEvent()dispatchEvent()
java.io.ByteArrayOutputStreamtoString()toString(String enc) or toString(), which uses the platform's default character encoding.
java.io.DataInputStreamreadLine()BufferedReader.readLine()
java.io.PrintStreamprintStream()PrintWriter class
java.io.StreamTokenizerstreamTokenizer()Convert input stream to character stream.
java.lang.CharacterisJavaLetter()isJavaIdentifierStart(char)
isJavaLetterOrDigit()isJavaIdentifierPart(char)
isSpace()isWhitespace(char)
java.lang.ClassLoaderdefineClass()defineClass(java.lang.String,byte[],int,int)
java.lang.RuntimegetLocalizedInputStream()InputStreamReader and BufferedReader classes.
getLocalizedOutputStream()Use OutputStreamWriter, BufferedWriter, and PrintWriter classes
java.lang.Stringstring()Use String constructors that take a character-encoding name or use default encoding.
getBytes()getBytes(String enc) or getBytes()
java.lang.Systemgetenv()Use java.lang.System.getProperty methods' system properties and corresponding get TypeName methods of Boolean, Integer, and Long primitive types.
java.lang.Threadresume()Refer to "Deprecated Threads Methods"
java.lang.Threadstop()Refer to "Deprecated Threads Methods"
java.lang.Threadsuspend()Refer to "Deprecated Threads Methods"
java.util.DategetYear()Calendar.get(Calendar.YEAR)-1900
setYear()Calendar.set(Calendar.YEAR+1900)
getMonth()Calendar.get(Calendar.MONTH)
setMonth()Calendar.set(Calendar.MONTH,int month)
getDate()Calendar.get(Calendar.DAY_OF_MONTH)
setDate()Calendar.set(Calendar.DAY_OF_MONTH,int date)
getDay()Calendar.get(Calendar.DAY_OF_WEEK)
getHours()Calendar.get(Calendar.HOUR_OF_DAY)
setHours()Calendar.set(Calendar.HOUR_OF_DAY,int hours)
getMinutes()Calendar.get(Calendar.MINUTE)
setMinutes()Calendar.set(Calendar.MINUTE,int minutes)
getSeconds()Calendar.get(Calendar.SECOND)
setSeconds()Calendar.set(Calendar.SECOND,int seconds)
parse()DateFormat.parse(String s)
getTimezoneOffset()Calendar.get(Calendar.ZONE_OFFSET)+Calendar.get(Calendar.DST_OFFSET)
toLocaleString()DateFormat.format(Date date)
toGMTString()DateFormat.format(Date date) using a GMT TimeZone
UTC()Calendar.set(year+1900,month,date,hrs,min,sec) or GregorianCalendar(year+1900,month,date,hrs,min,sec), using a UTC TimeZone, followed by Calendar.getTime().getTime().