KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > awt > Dimension

java.awt
Class Dimension

java.lang.Object
  extended by java.awt.geom.Dimension2D
      extended by java.awt.Dimension
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
DimensionUIResource
See Also:
Top Examples, Source Code, Component, LayoutManager

public Dimension()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[530]Get and save user screen size
By Anonymous on 2003/11/17 10:40:12  Rate
import java.util.prefs.*; 
 private Dimension screenSize; 
 private Preferences prefs 
  
  
 void getUserScreenSize (  )   {  
     prefs = Preferences.userNodeForPackage ( this ) ; 
     int rows = prefs.getInt ( "rows", 40 ) ; 
     int cols = prefs.getInt ( "cols", 80 ) ; 
     screenSize = new Dimension ( rows, cols ) ; 
  }  
  
  
 void saveUserScreenSize (  )   {  
     prefs.putInt ( "rows", screenSize.getWidth (  )  ) ; 
     prefs.putInt ( "cols", screenSize.getHeight (  )  ) ; 
     try  {  
         prefs.flush (  ) ; // Force write to backing store 
      }  catch  ( BackingStoreException bse )   {  
     // Handle exception 
      }  
  } 


public Dimension(int width,
                 int height)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Dimension(Dimension d)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean equals(Object obj)
See Also:
Hashtable, Object.hashCode()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public double getHeight()
See Also:
Dimension2D
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Dimension getSize()
See Also:
setSize(double, double)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public double getWidth()
See Also:
Dimension2D
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int hashCode()
See Also:
Hashtable, Object.equals(java.lang.Object)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int height
See Also:
setSize(double, double), getSize()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setSize(double width,
                    double height)
See Also:
Dimension2D
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setSize(int width,
                    int height)
See Also:
getSize()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setSize(Dimension d)
See Also:
Component.setSize(int, int), getSize()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String toString()
See Also:
Object
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int width
See Also:
setSize(double, double), getSize()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags