JDK 1.1 for Solaris 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 might 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. The following table lists the deprecated methods.

Table 4-1 Deprecated Methods

Class 

Method 

Replaced By 

 java.awt.BorderLayout addLayoutComponent()  addLayoutComponent(component,object)
 java.awt.CardLayout addLayoutComponent() addLayoutComponent(component,object)
 java.awt.CheckboxGroup getCurrent()  getSelectedCheckbox()
  setCurrent()  setSelectedCheckbox()
 java.awt.Choice countItems() getItemCount()
 java.awt.Component getPeer() 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 ActionListener on component firing action events.
  gotFocus() processFocusEvent()
  lostFocus() processFocusEvent()
  extFocus() transferFocus()
 java.awt.Container countComponents() getComponentCount()
  insets() getInsets()
  preferredSize() getPreferredSize()
  minimumSize() getMinimumSize()
  deliverEvent() dispatchEvent()
  locate() getComponentAt()
 java.awt.FontMetrics getMaxDescent() getMaxDescent()
 java.awt.Frame setCursor()setCursor()method in Component
  getCursorType()getCursor() method in Component
 java.awt.Graphics getClipRect() getClipBounds()
 java.awt.List countItems() 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.Menu countItems() getItemCount()
 java.awt.MenuBar countMenus() getMenuCount()
 java.awt.MenuComponents getPeer() No replacement.
  postEvent() dispatchEvent()
 java.awt.MenuContainer postEvent() dispatchEvent()
 java.awt.MenuItem enable() setEnabled(true)
  disable() setEnabled(false)
 java.awt.Polygon getBoundingBox() getBounds()
  inside() contains()
 java.awt.Rectangle reshape() setBounds()
  move() setLocation()
  resize() setSize()
  inside() contains()
 java.awt.ScrollPane layout() doLayout()
 java.awt.Scrollbar getVisible() getVisibleAmount()
  setLineIncrement() setUnitIncrement()
  getLineIncrement() getUnitIncrement()
  setPageIncrement() setBlockIncrement()
  getPageIncrement() getBlockIncrement()
 java.awt.TextArea insertText() insert()
  appendText() append()
  replaceText() replaceRange()
  preferredSize() getPreferredSize()
  minimumSize() getMinimumSize()
 java.awt.TextField setEchoCharacter() setEchoChar()
  preferredSize() getPreferredSize()
  minimumSize() getMinimumSize()
 java.awt.Window postEvent() dispatchEvent()
 java.io. ByteArrayOutputStream toString() toString(String enc) or toString(), which uses the platform's default character encoding
 java.io.DataInputStream readLine() BufferedReader.readLine()
 java.io.PrintStream printStream() PrintWriter class
 java.io.StreamTokenizer streamTokenizer() Convert input stream to character stream
 java.lang.Character isJavaLetter() isJavaIdentifierStart(char)
  isJavaLetterOrDigit() isJavaIdentifierPart(char)
  isSpace() isWhitespace(char)
 java.lang.ClassLoader defineClass() defineClass (java.lang.String,byte[],int,int)
 java.lang.Runtime getLocalizedInputStream() InputStreamReader and BufferedReader classes
  getLocalizedOutputStream() Use OutputStreamWriter, BufferedWriter, and PrintWriter classes
 java.lang.String string() Use String constructors that take a character-encoding name or use default encoding.
  getBytes() getBytes(String enc) or getBytes()
 java.lang.System getenv() Use java.lang.System.getProperty methods' system properties and corresponding get TypeName methods of Boolean, Integer, and Long primitive types.
 java.lang.Thread resume()Refer to "Deprecated Threads Methods"
 java.lang.Thread stop()Refer to "Deprecated Threads Methods"
 java.lang.Thread suspend()Refer to "Deprecated Threads Methods"
 java.util.Date getYear() 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().