diff options
author | Mark Wielaard <mark@klomp.org> | 2004-09-04 17:14:00 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2004-09-04 17:14:00 +0000 |
commit | 23640e02408b9d5ef14dfb99d3a75b4408b7f9be (patch) | |
tree | 59ee419732dcb4acfbfa972b452d7e8e1f2958ae /javax/swing/text/StyleConstants.java | |
parent | 26ab6649730d6e8249ef03f8b02c8a146f4a62fa (diff) | |
download | classpath-23640e02408b9d5ef14dfb99d3a75b4408b7f9be.tar.gz |
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/JTextArea.java
(lineWrap): Renamed from "wrapping".
(wrapStyleWord): NEw field.
(getLineWrap): Re-edited javadoc comment.
(setLineWrap): Likewise.
(getWrapStyleWord): New method.
(setWrapStyleWord): Likewise.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/plaf/basic/BasicTextAreaUI.java
(create): New method.
* javax/swing/text/DefaultHighlighter.java
(DefaultHighlightPainter.debugRect): Removed.
* javax/swing/text/StyleContext.java
(DEFAULT_STYLE): New field.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/plaf/basic/BasicLookAndFeel.java
(initComponentDefaults): Add keybindings for selection.backward and
selection-forward for text components.
* javax/swing/plaf/basic/BasicTextUI.java
(paintSafely): Paint highlight only when something is actually
selected.
* javax/swing/text/DefaultCaret.java
(handleHighlight): New method.
(setSelectionVisible): Don't do anything when nothing changes.
Handle highlight.
(moveDot): Reimplemented. Handle highlight.
(setDot): Set mark too. Handle highlight.
(getSelectionPainter): New method.
* javax/swing/text/DefaultEditorKit.java
(defaultActions): Added new actions for text selection.
* javax/swing/text/DefaultHighlighter.java
(DefaultHighlightPainter): New inner class.
(DefaultPainter): New field.
(paint): Implemented.
* javax/swing/text/PlainView.java
(paint): Don't draw background here again.
* javax/swing/text/Utilities.java
(getTabbedTextWidth): Use width of ' ' instead of 'm' for tabsize.
(drawTabbedText): Likewise.
2004-09-04 Graydon Hoare <graydon@redhat.com>
* java/awt/Component.java
(isFocusTraversable): Predicate on isLightweight()
(setFocusable): Set isFocusTraversableOverridden.
(requestFocus): Predicate peer dispatch on !isLightweight()
(requestFocusInWindow): Likewise.
(dispatchEventImpl): Coordinate with KeyboardFocusManager.
* java/awt/Container.java
(dispatchEventImpl): Predicate on event mask.
(LightweightDispatcher): Remove focus machinery.
* java/awt/DefaultFocusTraversalPolicy.java
(accept): Expand predicate to include isFocusable().
* java/awt/DefaultKeyboardFocusManager.java:
Globally change c.dispatchEvent(e) to redispatchEvent(c,e)
* java/awt/KeyboardFocusManager.java
(redispatchEvent): Synchronize on event to prevent feedback.
* javax/swing/AbstractButton.java
(ButtonFocusListener): Remove class.
(init): Set focusPainted, focusable.
* javax/swing/ActionMap.java (get): Check parent for null.
* javax/swing/InputMap.java (get): Likewise.
* javax/swing/JComponent.java
(inputMap_whenFocused): New InputMap.
(inputMap_whenAncestorOfFocused): Likewise.
(inputMap_whenInFocusedWindow): Likewise.
(getActionForKeyStroke): Rewrite.
(getConditionForKeystroke): Likewise.
(ActionListenerProxy): New private class.
(setInputMap): Implement.
(getInputMap): Likewise.
(setActionMap): Likewise.
(getActionMap): Likewise.
(processComponentKeyEvent): New empty method.
(processKeyEvent): Implement.
(processKeyBinding): Likewise.
(resetKeyboardActions): Rewrite.
* javax/swing/KeyStroke.java: Rewrite.
* javax/swing/SwingUtilities.java
(notifyAction): Implement.
(replaceUIActionMap): Likewise.
(replaceUIInputMap): Likewise.
* javax/swing/plaf/basic/BasicButtonListener.java
(focusGained): Implement.
(focusLost): Repaint if focusPainted().
(installKeyboardActions): Install pressed / released actions.
(uninstallKeyboardActions): Implement.
* javax/swing/plaf/basic/BasicButtonUI.java
(focusColor): New field.
(installDefaults): Load focus color, install input map.
(installKeyboardActions): Implement.
(uninstallKeyboardActions): Likewise.
(paintFocus): Rewrite.
* javax/swing/plaf/basic/BasicLookAndFeel.java
(Button.focus): New default, midPurple.
* javax/swing/plaf/basic/BasicTextUI.java
(kit): Make static.
(installUI): Get doc from kit, load defaults.
(getKeymapName): Implement.
(createKeymap): Likewise.
(installKeyboardActions): Likewise.
(getInputMap): Likewise.
(getActionMap): Likewise.
(createActionMap): Likewise.
* javax/swing/text/AbstractDocument.java
(getStartPosition): Implement.
(getEndPosition): Likewise.
* javax/swing/text/DefaultEditorKit.java
(CopyAction): New class.
(CutAction): Likewise.
(DefaultKeyTypedAction): Likewise.
(InsertBreakAction): Likewise.
(InsertContentAction): Likewise.
(InsertTabAction): Likewise.
(PasteAction): Likewise.
(defaultActions): New static table.
(createCaret): Implement.
(getActions): Likewise.
* javax/swing/text/JTextComponent.java
(KeymapWrapper): New private class.
(KeymapActionMap): Likewise.
(DefaultKeymap): New class.
(keymaps): New static table.
(keymap): New field.
(getKeymap): Implement.
(removeKeymap): Likewise.
(addKeymap): Likewise.
(setKeymap): Likewise.
(loadKeymap): Likewise.
(getActions): Likewise.
(margin): New field.
(JTextComponent): Build and install default keymap.
* javax/swing/text/TextAction.java
(textAction): Call super properly.
(getTextComponent): Implement.
* javax/swing/text/Utilities.java
(drawTabbedText): Adjust position by ascent.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/plaf/basic/BasicTextUI.java
(RottView.modelToView): New method.
(UpdateHandler): Renamed from EventHandler.
(updateHandler): Renamed from eventHandler.
(modelToView): Implemented.
* javax/swing/text/AbstractDocument.java
(BranchElement.getElement): Return null for non-existing indeces.
(BranchElement.getElementIndex): Return 0 in some corner cases.
* javax/swing/text/FieldView.java
(modelToView): New method.
* javax/swing/text/PlainView.java
(modelToView): Made public.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/text/AbstractDocument.java
(createBranchElement): Use new constructor of BranchElement.
(createLeafElement): Renamed arguments.
(getRootElements): Implemented.
(BranchElement.start): Removed.
(BranchElement.end): Likewise.
(BranchElement.BranchElement): Fixed arguments.
(BranchElement.getEndOffset): Reimplemented.
(BranchElement.getStartOffset): Likewis.
* javax/swing/text/DefaultCaret.java
(paint): Draw simple vertical line as caret instead of a rectangle.
* javax/swing/text/JTextComponent.java
(setText): Use doc directly.
* javax/swing/text/PlainView.java
(nextTabStop): Implemented.
* javax/swing/text/Utilities.java
(drawTabbedText): nextTabStop() returns an absolute x position.
(getTabbedTextWidth): Likewise.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/text/PlainView.java
(selectedColor): New field.
(unselectedColor): Likewise.
(font): Likewise.
(updateMetrics): New method.
(lineToRect): Likewise.
(modelToView): Likewise.
(drawSelectedText): Use color from JTextComponent ad draw with
Utilities class.
(drawUnselectedText): Likewise.
(paint): Initialize helper fields.
* javax/swing/text/View.java
(getChildAllocation): New method.
(getViewIndex): Likewise.
(getToolTipText): Likewise.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/text/Utilities.java
(drawTabbedText): Reimplemented.
(getTabbedTextWidth): Likewise.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/plaf/basic/BasicTextUI.java
(installDefaults): Install caret and highlighter.
(modelToView): Use Bias.Forward when calling sibling.
* javax/swing/text/AbstractDocument.java
(ElementEdit): Implements DocumentEvent.ElementChange.
(ElementEdit.ElementEdit): New method.
(ElementEdit.getChildrenAdded): Likewise.
(ElementEdit.getChildrenRemoved): Likewise.
(ElementEdit.getElement): Likewise.
(ElementEdit.getIndex): Likewise.
* javax/swing/text/DefaultCaret.java
(color): Removed.
(textComponent): Renamed from parent, made private.
(selectionVisible): Renamed from vis_sel, made private.
(blinkRate): Renamed from blink, made private.
(magicCaretPosition): Renamed from magic, made private.
(visible): Renamed from vis, made private.
(dot): Made private.
(mark): Likewise.
(deinstall): Remove as MouseMotionListener.
(install): Initialize textComponent first. Add as
MouseMotionListener.
(paint): Reimplemented.
* javax/swing/text/JTextComponent.java
(setCaret): Deinstall old caret, install new one and fire property
change after setting property.
(setHighlighter): Deinstall old highlighter, install new one and fire
property change after setting property.
(setCaretColor): Fire property change after setting property.
(setDisabledTextColor): Likewise.
(setSelectedTextColor): Likewise.
(setSelectionColor): Likewise.
(modelToView): New method.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/text/AbstractDocument.java
(getText): Simplified.
* javax/swing/text/Segment.java
(current): New field.
(current): Reimplemented.
(first): Likewise.
(getIndex): Likewise.
(last): Likewise.
(next): Likewise.
(previous): Likewise.
(setIndex): Likewise.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/plaf/basic/BasicButtonUI.java
(defaultTextIconGap): Made protected.
(defaultTextShiftOffset): Likewise.
(textShiftOffset): New field.
(clearTextShiftOffset): New method.
(getTextShiftOffset): Likewise.
(setTextShiftOffset): Likewise.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/plaf/basic/BasicTextUI.java
(installUI): Add eventHandler as property listener.
(uninstallUI): remove eventHandler as propert listener.
(installDefaults): Added comment.
(installListeners): Likewise.
(installKeyboardActions): Likewise.
(uninstallDefaults): Likewise.
(uninstallListeners): Likewise.
(uninstallKeyboardActions): Likewise.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/text/AbstractDocument.java:
Fixed some typos in comments.
(insertString): Reimplemented.
(remove): Likewise.
(replace): New method.
(children): Dont use fully qualified class name.
(DefaultDocumentEvent.offset): Renamed from off.
(DefaultDocumentEvent.length): Renamed from len.
(DefaultDocumentEvent.type): New field.
(DefaultDocumentEvent.DefaultDocumentEvent): New constructor.
(DefaultDocumentEvent.getType): Implemented.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/plaf/basic/BasicTextUI.java
(RootView.textComponent): Removed.
(RootView.RootView): Don't initialize textComponent.
(RootView.getViewFactory): New method.
(EventHandler): New inner class.
(rootView): Initialize at instance creation.
(eventHandler): New field.
(installUI): Don't create view hierarchy directly,
call modelChanged() instead.
(modelChanged): New method.
* javax/swing/text/JTextComponent.java
(setDocument): Fire property change event.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/plaf/basic/BasicTextUI.java
(RootView.paint): Removed debug output.
(paintSafely): Draw highlighter before text.
(paintBackground): Use background color of text component.
* javax/swing/plaf/basic/BasicToggleButtonUI.java:
Reformatted.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/plaf/basic/BasicToolBarUI.java
(BasicToolBarUI): Fixed arguments for constructor.
(createUI): Fixed creation of object.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/text/TabSet.java
(TabSet): Implements java.io.Serializable.
* javax/swing/text/TabStop.java
(TabStop): Implements java.io.Serializable.
(TabStop): Made public.
2004-09-04 Graydon Hoare <graydon@redhat.com>
* javax/swing/text/SimpleAttributeSet.java: New file.
* javax/swing/text/StyleConstants.java: New file.
* javax/swing/text/StyleContext.java: New file.
* javax/swing/text/TabSet.java: New file.
* javax/swing/text/TabStop.java: New file.
* javax/swing/text/AbstactDocument.java:
(AbstractElement): Implement attribute support.
* javax/swing/text/AttributeSet.java
(NameAttribute): New static field.
(ResolveAttribute): New static field.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/JComponent.java
(setUI): Fire PropertyChange.
* javax/swing/JLabel.java
(text): Renamed from labelText.
(horizontalAlignment): New default vlaue.
(icon): Renamed from activeIcon.
(displayedMnemonic): Renamed from mnemonicKey, added default value.
(displayedMnemonicIndex): Renamed from underlineChar.
(setDisplayedMnemonic): Reimplemented.
* javax/swing/JRadioButton.java
(JRadioButton): New constructors.
* javax/swing/JTextField.java
(JTextField): Throw exception if colums < 0, initialitialz
this.columns directly and initialize document with text
conditionally.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/plaf/basic/BasicFormattedTextFieldUI.java,
javax/swing/plaf/basic/BasicPasswordFieldUI.java,
javax/swing/plaf/basic/BasicTextAreaUI.java: New files.
* javax/swing/text/FieldView.java
(paint): Just call super method for now.
2004-09-04 Michael Koch <konqueror@gmx.de>
* javax/swing/TransferHandler.java,
javax/swing/plaf/basic/ComboPopup.java: New files
2004-09-04 Roman Kennke <roman@ontographics.com>
* javax/swing/text/Utilities.java: New file.
Diffstat (limited to 'javax/swing/text/StyleConstants.java')
-rw-r--r-- | javax/swing/text/StyleConstants.java | 439 |
1 files changed, 439 insertions, 0 deletions
diff --git a/javax/swing/text/StyleConstants.java b/javax/swing/text/StyleConstants.java new file mode 100644 index 000000000..2201c47b5 --- /dev/null +++ b/javax/swing/text/StyleConstants.java @@ -0,0 +1,439 @@ +/* StyleConstants.java -- + Copyright (C) 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.text; + +import java.awt.Color; +import java.awt.Component; +import javax.swing.Icon; + +public class StyleConstants +{ + + String keyname; + private StyleConstants(String k) + { + keyname = k; + } + + public String toString() + { + return keyname; + } + + public static int ALIGN_CENTER; + public static int ALIGN_JUSTIFIED; + public static int ALIGN_LEFT; + public static int ALIGN_RIGHT; + + public static Object Background = CharacterConstants.Background; + public static Object BidiLevel = CharacterConstants.BidiLevel; + public static Object Bold = CharacterConstants.Bold; + public static Object ComponentAttribute = CharacterConstants.ComponentAttribute; + public static Object FontFamily = CharacterConstants.Family; + public static Object FontSize = CharacterConstants.Size; + public static Object Foreground = CharacterConstants.Foreground; + public static Object IconAttribute = CharacterConstants.IconAttribute; + public static Object Italic = CharacterConstants.Italic; + public static Object StrikeThrough = CharacterConstants.StrikeThrough; + public static Object Subscript = CharacterConstants.Subscript; + public static Object Superscript = CharacterConstants.Superscript; + public static Object Underline = CharacterConstants.Underline; + + public static Object Alignment = ParagraphConstants.Alignment; + public static Object FirstLineIndent = ParagraphConstants.FirstLineIndent; + public static Object LeftIndent = ParagraphConstants.LeftIndent; + public static Object LineSpacing = ParagraphConstants.LineSpacing; + public static Object Orientation = ParagraphConstants.Orientation; + public static Object RightIndent = ParagraphConstants.RightIndent; + public static Object SpaceAbove = ParagraphConstants.SpaceAbove; + public static Object SpaceBelow = ParagraphConstants.SpaceBelow; + public static Object TabSet = ParagraphConstants.TabSet; + + public static String ComponentElementName = new String("component"); + public static String IconElementName = new String("icon"); + + public static Object ComposedTextAttribute = new StyleConstants("composed text"); + public static Object ModelAttribute = new StyleConstants("model"); + public static Object NameAttribute = new StyleConstants("name"); + public static Object ResolveAttribute = new StyleConstants("resolver"); + + public static int getAlignment(AttributeSet a) + { + if (a.isDefined(Alignment)) + return ((Integer)a.getAttribute(Alignment)).intValue(); + else + return ALIGN_LEFT; + } + + public static Color getBackground(AttributeSet a) + { + if (a.isDefined(Background)) + return (Color) a.getAttribute(Background); + else + return Color.BLACK; + } + + public static int getBidiLevel(AttributeSet a) + { + if (a.isDefined(BidiLevel)) + return ((Integer)a.getAttribute(BidiLevel)).intValue(); + else + return 0; + } + + public static Component getComponent(AttributeSet a) + { + if (a.isDefined(ComponentAttribute)) + return (Component) a.getAttribute(ComponentAttribute); + else + return (Component) null; + } + + public static float getFirstLineIndent(AttributeSet a) + { + if (a.isDefined(FirstLineIndent)) + return ((Float)a.getAttribute(FirstLineIndent)).floatValue(); + else + return 0.f; + } + + public static String getFontFamily(AttributeSet a) + { + if (a.isDefined(FontFamily)) + return (String) a.getAttribute(FontFamily); + else + return "Monospaced"; + } + + public static int getFontSize(AttributeSet a) + { + if (a.isDefined(FontSize)) + return ((Integer)a.getAttribute(FontSize)).intValue(); + else + return 12; + } + + public static Color getForeground(AttributeSet a) + { + if (a.isDefined(Foreground)) + return (Color) a.getAttribute(Foreground); + else + return Color.BLACK; + } + + public static Icon getIcon(AttributeSet a) + { + if (a.isDefined(IconAttribute)) + return (Icon) a.getAttribute(IconAttribute); + else + return (Icon) null; + } + + public static float getLeftIndent(AttributeSet a) + { + if (a.isDefined(LeftIndent)) + return ((Float)a.getAttribute(LeftIndent)).floatValue(); + else + return 0.f; + } + + public static float getLineSpacing(AttributeSet a) + { + if (a.isDefined(LineSpacing)) + return ((Float)a.getAttribute(LineSpacing)).floatValue(); + else + return 0.f; + } + + public static float getRightIndent(AttributeSet a) + { + if (a.isDefined(RightIndent)) + return ((Float)a.getAttribute(RightIndent)).floatValue(); + else + return 0.f; + } + + public static float getSpaceAbove(AttributeSet a) + { + if (a.isDefined(SpaceAbove)) + return ((Float)a.getAttribute(SpaceAbove)).floatValue(); + else + return 0.f; + } + + public static float getSpaceBelow(AttributeSet a) + { + if (a.isDefined(SpaceBelow)) + return ((Float)a.getAttribute(SpaceBelow)).floatValue(); + else + return 0.f; + } + + public static javax.swing.text.TabSet getTabSet(AttributeSet a) + { + if (a.isDefined(StyleConstants.TabSet)) + return (javax.swing.text.TabSet) a.getAttribute(StyleConstants.TabSet); + else + return (javax.swing.text.TabSet) null; + } + + public static boolean isBold(AttributeSet a) + { + if (a.isDefined(Bold)) + return ((Boolean) a.getAttribute(Bold)).booleanValue(); + else + return false; + } + + public static boolean isItalic(AttributeSet a) + { + if (a.isDefined(Italic)) + return ((Boolean) a.getAttribute(Italic)).booleanValue(); + else + return false; + } + + public static boolean isStrikeThrough(AttributeSet a) + { + if (a.isDefined(StrikeThrough)) + return ((Boolean) a.getAttribute(StrikeThrough)).booleanValue(); + else + return false; + } + + public static boolean isSubscript(AttributeSet a) + { + if (a.isDefined(Subscript)) + return ((Boolean) a.getAttribute(Subscript)).booleanValue(); + else + return false; + } + + public static boolean isSuperscript(AttributeSet a) + { + if (a.isDefined(Superscript)) + return ((Boolean) a.getAttribute(Superscript)).booleanValue(); + else + return false; + } + + public static boolean isUnderline(AttributeSet a) + { + if (a.isDefined(Underline)) + return ((Boolean) a.getAttribute(Underline)).booleanValue(); + else + return false; + } + + public static void setAlignment(MutableAttributeSet a, int align) + { + a.addAttribute(Alignment, new Integer(align)); + } + + public static void setBackground(MutableAttributeSet a, Color fg) + { + a.addAttribute(Background, fg); + } + + public static void setBidiLevel(MutableAttributeSet a, int lev) + { + a.addAttribute(BidiLevel, new Integer(lev)); + } + + public static void setBold(MutableAttributeSet a, boolean b) + { + a.addAttribute(Bold, new Boolean(b)); + } + + public static void setComponent(MutableAttributeSet a, Component c) + { + a.addAttribute(ComponentAttribute, c); + } + + public static void setFirstLineIndent(MutableAttributeSet a, float i) + { + a.addAttribute(FirstLineIndent, new Float(i)); + } + + public static void setFontFamily(MutableAttributeSet a, String fam) + { + a.addAttribute(FontFamily, fam); + } + + public static void setFontSize(MutableAttributeSet a, int s) + { + a.addAttribute(FontSize, new Integer(s)); + } + + public static void setForeground(MutableAttributeSet a, Color fg) + { + a.addAttribute(Foreground, fg); + } + + public static void setIcon(MutableAttributeSet a, Icon c) + { + a.addAttribute(IconAttribute, c); + } + + public static void setItalic(MutableAttributeSet a, boolean b) + { + a.addAttribute(Italic, new Boolean(b)); + } + + public static void setLeftIndent(MutableAttributeSet a, float i) + { + a.addAttribute(LeftIndent, new Float(i)); + } + + public static void setLineSpacing(MutableAttributeSet a, float i) + { + a.addAttribute(LineSpacing, new Float(i)); + } + + public static void setRightIndent(MutableAttributeSet a, float i) + { + a.addAttribute(RightIndent, new Float(i)); + } + + public static void setSpaceAbove(MutableAttributeSet a, float i) + { + a.addAttribute(SpaceAbove, new Float(i)); + } + + public static void setSpaceBelow(MutableAttributeSet a, float i) + { + a.addAttribute(SpaceBelow, new Float(i)); + } + + public static void setStrikeThrough(MutableAttributeSet a, boolean b) + { + a.addAttribute(StrikeThrough, new Boolean(b)); + } + + public static void setSubscript(MutableAttributeSet a, boolean b) + { + a.addAttribute(Subscript, new Boolean(b)); + } + + public static void setSuperscript(MutableAttributeSet a, boolean b) + { + a.addAttribute(Superscript, new Boolean(b)); + } + + public static void setTabSet(MutableAttributeSet a, javax.swing.text.TabSet tabs) + { + a.addAttribute(StyleConstants.TabSet, tabs); + } + + public static void setUnderline(MutableAttributeSet a, boolean b) + { + a.addAttribute(Underline, new Boolean(b)); + } + + // The remainder are so-called "typesafe enumerations" which + // alias subsets of the above constants. + public static class CharacterConstants + extends StyleConstants + implements AttributeSet.CharacterAttribute + { + private CharacterConstants(String k) + { + super(k); + } + + public static Object Background = ColorConstants.Background; + public static Object BidiLevel = new CharacterConstants("bidiLevel"); + public static Object Bold = FontConstants.Bold; + public static Object ComponentAttribute = new CharacterConstants("component"); + public static Object Family = FontConstants.Family; + public static Object Size = FontConstants.Size; + public static Object Foreground = ColorConstants.Foreground; + public static Object IconAttribute = new CharacterConstants("icon"); + public static Object Italic = FontConstants.Italic; + public static Object StrikeThrough = new CharacterConstants("strikethrough"); + public static Object Subscript = new CharacterConstants("subscript"); + public static Object Superscript = new CharacterConstants("superscript"); + public static Object Underline = new CharacterConstants("underline"); + } + + public static class ColorConstants + extends StyleConstants + implements AttributeSet.ColorAttribute, AttributeSet.CharacterAttribute + { + private ColorConstants(String k) + { + super(k); + } + public static Object Foreground = new ColorConstants("foreground"); + public static Object Background = new ColorConstants("background"); + } + + public static class FontConstants + extends StyleConstants + implements AttributeSet.FontAttribute, AttributeSet.CharacterAttribute + { + private FontConstants(String k) + { + super(k); + } + public static Object Bold = new FontConstants("bold"); + public static Object Family = new FontConstants("family"); + public static Object Italic = new FontConstants("italic"); + public static Object Size = new FontConstants("size"); + } + + public static class ParagraphConstants + extends StyleConstants + implements AttributeSet.ParagraphAttribute + { + private ParagraphConstants(String k) + { + super(k); + } + public static Object Alignment = new ParagraphConstants("Alignment"); + public static Object FirstLineIndent = new ParagraphConstants("FirstLineIndent"); + public static Object LeftIndent = new ParagraphConstants("LeftIndent"); + public static Object LineSpacing = new ParagraphConstants("LineSpacing"); + public static Object Orientation = new ParagraphConstants("Orientation"); + public static Object RightIndent = new ParagraphConstants("RightIndent"); + public static Object SpaceAbove = new ParagraphConstants("SpaceAbove"); + public static Object SpaceBelow = new ParagraphConstants("SpaceBelow"); + public static Object TabSet = new ParagraphConstants("TabSet"); + } + +} |