java.lang.Objectjavax.swing.text.Utilities
public class Utilities
A collection of methods to deal with various text related activities.
| Constructor Summary | |
|---|---|
Utilities()
|
|
| Method Summary | |
|---|---|
static int |
drawTabbedText(Segment s,
int x,
int y,
Graphics g,
TabExpander e,
int startOffset)
Draws the given text, expanding any tabs that are contained using the given tab expansion technique. |
static int |
getBreakLocation(Segment s,
FontMetrics metrics,
int x0,
int x,
TabExpander e,
int startOffset)
Determine where to break the given text to fit within the given span. |
static int |
getNextWord(JTextComponent c,
int offs)
Determines the start of the next word for the given location. |
static Element |
getParagraphElement(JTextComponent c,
int offs)
Determines the element to use for a paragraph/line. |
static int |
getPositionAbove(JTextComponent c,
int offs,
int x)
Determines the position in the model that is closest to the given view location in the row above. |
static int |
getPositionBelow(JTextComponent c,
int offs,
int x)
Determines the position in the model that is closest to the given view location in the row below. |
static int |
getPreviousWord(JTextComponent c,
int offs)
Determine the start of the prev word for the given location. |
static int |
getRowEnd(JTextComponent c,
int offs)
Determines the ending row model position of the row that contains the specified model position. |
static int |
getRowStart(JTextComponent c,
int offs)
Determines the starting row model position of the row that contains the specified model position. |
static int |
getTabbedTextOffset(Segment s,
FontMetrics metrics,
int x0,
int x,
TabExpander e,
int startOffset)
Determines the relative offset into the given text that best represents the given span in the view coordinate system. |
static int |
getTabbedTextOffset(Segment s,
FontMetrics metrics,
int x0,
int x,
TabExpander e,
int startOffset,
boolean round)
|
static int |
getTabbedTextWidth(Segment s,
FontMetrics metrics,
int x,
TabExpander e,
int startOffset)
Determines the width of the given segment of text taking tabs into consideration. |
static int |
getWordEnd(JTextComponent c,
int offs)
Determines the end of a word for the given location. |
static int |
getWordStart(JTextComponent c,
int offs)
Determines the start of a word for the given model location. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Utilities()
| Method Detail |
|---|
public static final int drawTabbedText(Segment s, int x, int y, Graphics g, TabExpander e, int startOffset)
s - the source of the textx - the X origin >= 0y - the Y origin >= 0g - the graphics contexte - how to expand the tabs. If this value is null,
tabs will be expanded as a space character.startOffset - starting offset of the text in the document >= 0
public static final int getTabbedTextWidth(Segment s, FontMetrics metrics, int x, TabExpander e, int startOffset)
s - the source of the textmetrics - the font metrics to use for the calculationx - the X origin >= 0e - how to expand the tabs. If this value is null,
tabs will be expanded as a space character.startOffset - starting offset of the text in the document >= 0
public static final int getTabbedTextOffset(Segment s, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset)
s - the source of the textmetrics - the font metrics to use for the calculationx0 - the starting view location representing the start
of the given text >= 0.x - the target view location to translate to an
offset into the text >= 0.e - how to expand the tabs. If this value is null,
tabs will be expanded as a space character.startOffset - starting offset of the text in the document >= 0
public static final int getTabbedTextOffset(Segment s, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset, boolean round)
public static final int getBreakLocation(Segment s, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset)
s - the source of the textmetrics - the font metrics to use for the calculationx0 - the starting view location representing the start
of the given text.x - the target view location to translate to an
offset into the text.e - how to expand the tabs. If this value is null,
tabs will be expanded as a space character.startOffset - starting offset in the document of the text
public static final int getRowStart(JTextComponent c, int offs) throws BadLocationException
c - the editoroffs - the offset in the document >= 0
BadLocationException - if the offset is out of rangepublic static final int getRowEnd(JTextComponent c, int offs) throws BadLocationException
c - the editoroffs - the offset in the document >= 0
BadLocationException - if the offset is out of rangepublic static final int getPositionAbove(JTextComponent c, int offs, int x) throws BadLocationException
c - the editoroffs - the offset in the document >= 0x - the X coordinate >= 0
BadLocationException - if the offset is out of rangepublic static final int getPositionBelow(JTextComponent c, int offs, int x) throws BadLocationException
c - the editoroffs - the offset in the document >= 0x - the X coordinate >= 0
BadLocationException - if the offset is out of rangepublic static final int getWordStart(JTextComponent c, int offs) throws BadLocationException
c - the editoroffs - the offset in the document >= 0
BadLocationException - if the offset is out of rangepublic static final int getWordEnd(JTextComponent c, int offs) throws BadLocationException
c - the editoroffs - the offset in the document >= 0
BadLocationException - if the offset is out of rangepublic static final int getNextWord(JTextComponent c, int offs) throws BadLocationException
c - the editoroffs - the offset in the document >= 0
BadLocationException - if the offset is out of rangepublic static final int getPreviousWord(JTextComponent c, int offs) throws BadLocationException
c - the editoroffs - the offset in the document >= 0
BadLocationException - if the offset is out of rangepublic static final Element getParagraphElement(JTextComponent c, int offs)
c - the editoroffs - the starting offset in the document >= 0
Ces informations proviennent du site de http://java.sun.com
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 :
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.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
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.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)