API java : EditorKit


javax.swing.text
Class EditorKit

java.lang.Object
  extended by javax.swing.text.EditorKit
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
DefaultEditorKit

public abstract class EditorKit
extends Object
implements Cloneable, Serializable

Establishes the set of things needed by a text component to be a reasonably functioning editor for some type of text content. The EditorKit acts as a factory for some kind of policy. For example, an implementation of html and rtf can be provided that is replaceable with other implementations.

A kit can safely store editing state as an instance of the kit will be dedicated to a text component. New kits will normally be created by cloning a prototype kit. The kit will have it's setComponent method called to establish it's relationship with a JTextComponent.


Constructor Summary
EditorKit()
          Construct an EditorKit.
 
Method Summary
 Object clone()
          Creates a copy of the editor kit.
abstract  Caret createCaret()
          Fetches a caret that can navigate through views produced by the associated ViewFactory.
abstract  Document createDefaultDocument()
          Creates an uninitialized text storage model that is appropriate for this type of editor.
 void deinstall(JEditorPane c)
          Called when the kit is being removed from the JEditorPane.
abstract  Action[] getActions()
          Fetches the set of commands that can be used on a text component that is using a model and view produced by this kit.
abstract  String getContentType()
          Gets the MIME type of the data that this kit represents support for.
abstract  ViewFactory getViewFactory()
          Fetches a factory that is suitable for producing views of any models that are produced by this kit.
 void install(JEditorPane c)
          Called when the kit is being installed into the a JEditorPane.
abstract  void read(InputStream in, Document doc, int pos)
          Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.
abstract  void read(Reader in, Document doc, int pos)
          Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.
abstract  void write(OutputStream out, Document doc, int pos, int len)
          Writes content from a document to the given stream in a format appropriate for this kind of content handler.
abstract  void write(Writer out, Document doc, int pos, int len)
          Writes content from a document to the given stream in a format appropriate for this kind of content handler.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditorKit

public EditorKit()
Construct an EditorKit.

Method Detail

clone

public Object clone()
Creates a copy of the editor kit. This is implemented to use Object.clone. If the kit cannot be cloned, null is returned.

Overrides:
clone in class Object
Returns:
the copy
See Also:
Cloneable

install

public void install(JEditorPane c)
Called when the kit is being installed into the a JEditorPane.

Parameters:
c - the JEditorPane

deinstall

public void deinstall(JEditorPane c)
Called when the kit is being removed from the JEditorPane. This is used to unregister any listeners that were attached.

Parameters:
c - the JEditorPane

getContentType

public abstract String getContentType()
Gets the MIME type of the data that this kit represents support for.

Returns:
the type

getViewFactory

public abstract ViewFactory getViewFactory()
Fetches a factory that is suitable for producing views of any models that are produced by this kit.

Returns:
the factory

getActions

public abstract Action[] getActions()
Fetches the set of commands that can be used on a text component that is using a model and view produced by this kit.

Returns:
the set of actions

createCaret

public abstract Caret createCaret()
Fetches a caret that can navigate through views produced by the associated ViewFactory.

Returns:
the caret

createDefaultDocument

public abstract Document createDefaultDocument()
Creates an uninitialized text storage model that is appropriate for this type of editor.

Returns:
the model

read

public abstract void read(InputStream in,
                          Document doc,
                          int pos)
                   throws IOException,
                          BadLocationException
Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.

Parameters:
in - The stream to read from
doc - The destination for the insertion.
pos - The location in the document to place the content >= 0.
Throws:
IOException - on any I/O error
BadLocationException - if pos represents an invalid location within the document.

write

public abstract void write(OutputStream out,
                           Document doc,
                           int pos,
                           int len)
                    throws IOException,
                           BadLocationException
Writes content from a document to the given stream in a format appropriate for this kind of content handler.

Parameters:
out - The stream to write to
doc - The source for the write.
pos - The location in the document to fetch the content from >= 0.
len - The amount to write out >= 0.
Throws:
IOException - on any I/O error
BadLocationException - if pos represents an invalid location within the document.

read

public abstract void read(Reader in,
                          Document doc,
                          int pos)
                   throws IOException,
                          BadLocationException
Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.

Since actual text editing is unicode based, this would generally be the preferred way to read in the data. Some types of content are stored in an 8-bit form however, and will favor the InputStream.

Parameters:
in - The stream to read from
doc - The destination for the insertion.
pos - The location in the document to place the content >= 0.
Throws:
IOException - on any I/O error
BadLocationException - if pos represents an invalid location within the document.

write

public abstract void write(Writer out,
                           Document doc,
                           int pos,
                           int len)
                    throws IOException,
                           BadLocationException
Writes content from a document to the given stream in a format appropriate for this kind of content handler.

Since actual text editing is unicode based, this would generally be the preferred way to write the data. Some types of content are stored in an 8-bit form however, and will favor the OutputStream.

Parameters:
out - The stream to write to
doc - The source for the write.
pos - The location in the document to fetch the content >= 0.
len - The amount to write out >= 0.
Throws:
IOException - on any I/O error
BadLocationException - if pos represents an invalid location within the document.

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

7 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-1933
Document créé le 31/08/06 00:50, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-javax/swing/text/EditorKit.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,47 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Une partie de l'art de vivre dépend de notre capacité à combattre notre impuissance [face à nos désirs, à nos envies ou à nos impulsions]. C'est difficile, parce que l'impuissance engendre souvent la peur.

Marc Levy [Extrait de Et si c'était vrai...]
 
l'infobrol
Nous sommes le Samedi 02 Juin 2012, 08:43, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)