API java : 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

public class Dimension
extends Dimension2D
implements Serializable

The Dimension class encapsulates the width and height of a component (in integer precision) in a single object. The class is associated with certain properties of components. Several methods defined by the Component class and the LayoutManager interface return a Dimension object.

Normally the values of width and height are non-negative integers. The constructors that allow you to create a dimension do not prevent you from setting a negative value for these properties. If the value of width or height is negative, the behavior of some methods defined by other objects is undefined.

Since:
JDK1.0
See Also:
Component, LayoutManager, Serialized Form

Field Summary
 int height
          The height dimension; negative values can be used.
 int width
          The width dimension; negative values can be used.
 
Constructor Summary
Dimension()
          Creates an instance of Dimension with a width of zero and a height of zero.
Dimension(Dimension d)
          Creates an instance of Dimension whose width and height are the same as for the specified dimension.
Dimension(int width, int height)
          Constructs a Dimension and initializes it to the specified width and specified height.
 
Method Summary
 boolean equals(Object obj)
          Checks whether two dimension objects have equal values.
 double getHeight()
          Returns the height of this dimension in double precision.
 Dimension getSize()
          Gets the size of this Dimension object.
 double getWidth()
          Returns the width of this dimension in double precision.
 int hashCode()
          Returns the hash code for this Dimension.
 void setSize(Dimension d)
          Sets the size of this Dimension object to the specified size.
 void setSize(double width, double height)
          Sets the size of this Dimension object to the specified width and height in double precision.
 void setSize(int width, int height)
          Sets the size of this Dimension object to the specified width and height.
 String toString()
          Returns a string representation of the values of this Dimension object's height and width fields.
 
Methods inherited from class java.awt.geom.Dimension2D
clone, setSize
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

width

public int width
The width dimension; negative values can be used.

See Also:
getSize(), setSize(double, double)

height

public int height
The height dimension; negative values can be used.

See Also:
getSize(), setSize(double, double)
Constructor Detail

Dimension

public Dimension()
Creates an instance of Dimension with a width of zero and a height of zero.


Dimension

public Dimension(Dimension d)
Creates an instance of Dimension whose width and height are the same as for the specified dimension.

Parameters:
d - the specified dimension for the width and height values

Dimension

public Dimension(int width,
                 int height)
Constructs a Dimension and initializes it to the specified width and specified height.

Parameters:
width - the specified width
height - the specified height
Method Detail

getWidth

public double getWidth()
Returns the width of this dimension in double precision.

Specified by:
getWidth in class Dimension2D
Returns:
the width of this dimension in double precision

getHeight

public double getHeight()
Returns the height of this dimension in double precision.

Specified by:
getHeight in class Dimension2D
Returns:
the height of this dimension in double precision

setSize

public void setSize(double width,
                    double height)
Sets the size of this Dimension object to the specified width and height in double precision. Note that if width or height are larger than Integer.MAX_VALUE, they will be reset to Integer.MAX_VALUE.

Specified by:
setSize in class Dimension2D
Parameters:
width - the new width for the Dimension object
height - the new height for the Dimension object

getSize

public Dimension getSize()
Gets the size of this Dimension object. This method is included for completeness, to parallel the getSize method defined by Component.

Returns:
the size of this dimension, a new instance of Dimension with the same width and height
Since:
JDK1.1
See Also:
setSize(double, double), Component.getSize()

setSize

public void setSize(Dimension d)
Sets the size of this Dimension object to the specified size. This method is included for completeness, to parallel the setSize method defined by Component.

Parameters:
d - the new size for this Dimension object
Since:
JDK1.1
See Also:
getSize(), Component.setSize(int, int)

setSize

public void setSize(int width,
                    int height)
Sets the size of this Dimension object to the specified width and height. This method is included for completeness, to parallel the setSize method defined by Component.

Parameters:
width - the new width for this Dimension object
height - the new height for this Dimension object
Since:
JDK1.1
See Also:
getSize(), Component.setSize(int, int)

equals

public boolean equals(Object obj)
Checks whether two dimension objects have equal values.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Object.hashCode(), Hashtable

hashCode

public int hashCode()
Returns the hash code for this Dimension.

Overrides:
hashCode in class Object
Returns:
a hash code for this Dimension
See Also:
Object.equals(java.lang.Object), Hashtable

toString

public String toString()
Returns a string representation of the values of this Dimension object's height and width fields. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overrides:
toString in class Object
Returns:
a string representation of this Dimension object

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

6 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-1321
Document créé le 30/08/06 02:04, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-java/awt/Dimension.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
0,44 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Une station de métro c'est un endroit où les métro s'arrêtent, une station de taxis, c'est un endroit où les taxis s'arrêtent ; sur mon bureau j'ai une station de travail...

Anonyme
 
l'infobrol
Nous sommes le Vendredi 01 Juin 2012, 11:47, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)