proyecto.utilidades
Class HojaEstilo
java.lang.Object
javax.swing.text.StyleContext
javax.swing.text.html.StyleSheet
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
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 |
hoja
public static HojaEstilo hoja
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