proyecto.utilidades
Class HojaEstilo

java.lang.Object
  extended by javax.swing.text.StyleContext
      extended by javax.swing.text.html.StyleSheet
          extended by proyecto.utilidades.HojaEstilo
All Implemented Interfaces:
Serializable, AbstractDocument.AttributeContext

public class HojaEstilo
extends StyleSheet

Clase que contiene el StyleSheet (hoja de estilo CSS en formato java) para los documentos HTML EpSilon. La clase implementa el patrón Singleton ya que no se debe necesitar más de una instancia de la misma. Modo de uso: Para utilizarla se reproducirá el siquiente código :
HTMLEditorKit kit = new HTMLEditorKit();
kit.setStyleSheet(HojaEstilo.get());
textPane.setEditorKit(kit);

de este modo conseguimos aplicar la hoja de estilo únicamente al documento que queremos si nos limitamos a hacer:
textPane.getEditorKit().setStyleSheet(HojaEstilo.get())
cambiaremos la hoja de estilo del editor kit por defecto con lo que todos los JTextPane con HTML la utilizarán.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.html.StyleSheet
StyleSheet.BoxPainter, StyleSheet.ListPainter
 
Nested classes/interfaces inherited from class javax.swing.text.StyleContext
StyleContext.NamedStyle, StyleContext.SmallAttributeSet
 
Field Summary
static HojaEstilo hoja
           
 
Fields inherited from class javax.swing.text.StyleContext
DEFAULT_STYLE
 
Method Summary
static HojaEstilo get()
           
static String toHexString(Color c)
          Devuelve el string hexadecimal que representa un color a partir del mismo.
static String toHexString(int rojo, int verde, int azul)
           Devuelve el string hexadecimal que representa un color a partir de los componentes RGB
 
Methods inherited from class javax.swing.text.html.StyleSheet
addAttribute, addAttributes, addCSSAttribute, addCSSAttributeFromHTML, addRule, addStyleSheet, createLargeAttributeSet, createSmallAttributeSet, getBackground, getBase, getBoxPainter, getDeclaration, getFont, getForeground, getIndexOfSize, getListPainter, getPointSize, getPointSize, getRule, getRule, getStyleSheets, getViewAttributes, importStyleSheet, loadRules, removeAttribute, removeAttributes, removeAttributes, removeStyle, removeStyleSheet, setBase, setBaseFontSize, setBaseFontSize, stringToColor, translateHTMLToCSS
 
Methods inherited from class javax.swing.text.StyleContext
addChangeListener, addStyle, getChangeListeners, getCompressionThreshold, getDefaultStyleContext, getEmptySet, getFont, getFontMetrics, getStaticAttribute, getStaticAttributeKey, getStyle, getStyleNames, readAttributes, readAttributeSet, reclaim, registerStaticAttributeKey, removeChangeListener, toString, writeAttributes, writeAttributeSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

hoja

public static HojaEstilo hoja
Method Detail

get

public static HojaEstilo get()

toHexString

public static String toHexString(int rojo,
                                 int verde,
                                 int azul)

Devuelve el string hexadecimal que representa un color a partir de los componentes RGB

Parameters:
rojo - componente rojo del color.
verde - componente verde del color.
azul - componente azul del color.
Returns:
String Cadena que representa el hexadecimal del color que llega como parámetro

toHexString

public static String toHexString(Color c)
Devuelve el string hexadecimal que representa un color a partir del mismo.

Parameters:
c - , color para el que se va a obtener el valor hexadecimal.
Returns:
String , Cadena que representa el hexadecimal del color que llega como parámetro