styleconstants.java
来自「linux下建立JAVA虚拟机的源码KAFFE」· Java 代码 · 共 1,073 行 · 第 1/3 页
JAVA
1,073 行
* * @return The left indentation. * * @see #setLeftIndent(MutableAttributeSet, float) */ public static float getLeftIndent(AttributeSet a) { Float f = (Float) a.getAttribute(LeftIndent); if (f != null) return f.floatValue(); else return 0.0f; } /** * Returns the line spacing specified in the given attributes, or * <code>0.0f</code> if no line spacing is specified. * * @param a the attribute set (<code>null</code> not permitted). * * @return The line spacing. * * @see #setLineSpacing(MutableAttributeSet, float) */ public static float getLineSpacing(AttributeSet a) { Float f = (Float) a.getAttribute(LineSpacing); if (f != null) return f.floatValue(); else return 0.0f; } /** * Returns the right indentation specified in the given attributes, or * <code>0.0f</code> if no right indentation is specified. * * @param a the attribute set (<code>null</code> not permitted). * * @return The right indentation. * * @see #setRightIndent(MutableAttributeSet, float) */ public static float getRightIndent(AttributeSet a) { Float f = (Float) a.getAttribute(RightIndent); if (f != null) return f.floatValue(); else return 0.0f; } /** * Returns the 'space above' specified in the given attributes, or * <code>0.0f</code> if no 'space above' is specified. * * @param a the attribute set (<code>null</code> not permitted). * * @return The 'space above'. * * @see #setSpaceAbove(MutableAttributeSet, float) */ public static float getSpaceAbove(AttributeSet a) { Float f = (Float) a.getAttribute(SpaceAbove); if (f != null) return f.floatValue(); else return 0.0f; } /** * Returns the 'space below' specified in the given attributes, or * <code>0.0f</code> if no 'space below' is specified. * * @param a the attribute set (<code>null</code> not permitted). * * @return The 'space below'. * * @see #setSpaceBelow(MutableAttributeSet, float) */ public static float getSpaceBelow(AttributeSet a) { Float f = (Float) a.getAttribute(SpaceBelow); if (f != null) return f.floatValue(); else return 0.0f; } /** * Returns the tab set specified in the given attributes, or * <code>null</code> if no tab set is specified. * * @param a the attribute set (<code>null</code> not permitted). * * @return The tab set. * * @see #setTabSet(MutableAttributeSet, javax.swing.text.TabSet) */ public static javax.swing.text.TabSet getTabSet(AttributeSet a) { // I'm guessing that the fully qualified class name is to differentiate // between the TabSet class and the TabSet (attribute) instance on some // compiler... return (javax.swing.text.TabSet) a.getAttribute(StyleConstants.TabSet); } /** * Returns the value of the bold flag in the given attributes, or * <code>false</code> if no bold flag is specified. * * @param a the attribute set (<code>null</code> not permitted). * * @return The bold flag. * * @see #setBold(MutableAttributeSet, boolean) */ public static boolean isBold(AttributeSet a) { Boolean b = (Boolean) a.getAttribute(Bold); if (b != null) return b.booleanValue(); else return false; } /** * Returns the value of the italic flag in the given attributes, or * <code>false</code> if no italic flag is specified. * * @param a the attribute set (<code>null</code> not permitted). * * @return The italic flag. * * @see #setItalic(MutableAttributeSet, boolean) */ public static boolean isItalic(AttributeSet a) { Boolean b = (Boolean) a.getAttribute(Italic); if (b != null) return b.booleanValue(); else return false; } /** * Returns the value of the strike-through flag in the given attributes, or * <code>false</code> if no strike-through flag is specified. * * @param a the attribute set (<code>null</code> not permitted). * * @return The strike-through flag. * * @see #setStrikeThrough(MutableAttributeSet, boolean) */ public static boolean isStrikeThrough(AttributeSet a) { Boolean b = (Boolean) a.getAttribute(StrikeThrough); if (b != null) return b.booleanValue(); else return false; } /** * Returns the value of the subscript flag in the given attributes, or * <code>false</code> if no subscript flag is specified. * * @param a the attribute set (<code>null</code> not permitted). * * @return The subscript flag. * * @see #setSubscript(MutableAttributeSet, boolean) */ public static boolean isSubscript(AttributeSet a) { Boolean b = (Boolean) a.getAttribute(Subscript); if (b != null) return b.booleanValue(); else return false; } /** * Returns the value of the superscript flag in the given attributes, or * <code>false</code> if no superscript flag is specified. * * @param a the attribute set (<code>null</code> not permitted). * * @return The superscript flag. * * @see #setSuperscript(MutableAttributeSet, boolean) */ public static boolean isSuperscript(AttributeSet a) { Boolean b = (Boolean) a.getAttribute(Superscript); if (b != null) return b.booleanValue(); else return false; } /** * Returns the value of the underline flag in the given attributes, or * <code>false</code> if no underline flag is specified. * * @param a the attribute set (<code>null</code> not permitted). * * @return The underline flag. * * @see #setUnderline(MutableAttributeSet, boolean) */ public static boolean isUnderline(AttributeSet a) { Boolean b = (Boolean) a.getAttribute(Underline); if (b != null) return b.booleanValue(); else return false; } /** * Adds an alignment attribute to the specified set. * * @param a the attribute set (<code>null</code> not permitted). * @param align the alignment (typically one of * {@link StyleConstants#ALIGN_LEFT}, * {@link StyleConstants#ALIGN_RIGHT}, * {@link StyleConstants#ALIGN_CENTER} or * {@link StyleConstants#ALIGN_JUSTIFIED}). * * @throws NullPointerException if <code>a</code> is <code>null</code>. * * @see #getAlignment(AttributeSet) */ public static void setAlignment(MutableAttributeSet a, int align) { a.addAttribute(Alignment, new Integer(align)); } /** * Adds a background attribute to the specified set. * * @param a the attribute set (<code>null</code> not permitted). * @param bg the background (<code>null</code> not permitted). * * @throws NullPointerException if either argument is <code>null</code>. * * @see #getBackground(AttributeSet) */ public static void setBackground(MutableAttributeSet a, Color bg) { a.addAttribute(Background, bg); } /** * Adds a bidi-level attribute to the specified set. * * @param a the attribute set (<code>null</code> not permitted). * @param lev the level. * * @throws NullPointerException if <code>a</code> is <code>null</code>. * * @see #getBidiLevel(AttributeSet) */ public static void setBidiLevel(MutableAttributeSet a, int lev) { a.addAttribute(BidiLevel, new Integer(lev)); } /** * Adds a bold attribute to the specified set. * * @param a the attribute set (<code>null</code> not permitted). * @param b the new value of the bold attribute. * * @throws NullPointerException if <code>a</code> is <code>null</code>. * * @see #isBold(AttributeSet) */ public static void setBold(MutableAttributeSet a, boolean b) { a.addAttribute(Bold, Boolean.valueOf(b)); } /** * Adds a component attribute to the specified set. * * @param a the attribute set (<code>null</code> not permitted). * @param c the component (<code>null</code> not permitted). * * @throws NullPointerException if either argument is <code>null</code>. * * @see #getComponent(AttributeSet) */ public static void setComponent(MutableAttributeSet a, Component c) { a.addAttribute(ComponentAttribute, c); } /** * Adds a first line indentation attribute to the specified set. * * @param a the attribute set (<code>null</code> not permitted). * @param i the indentation. * * @throws NullPointerException if <code>a</code> is <code>null</code>. * * @see #getFirstLineIndent(AttributeSet) */ public static void setFirstLineIndent(MutableAttributeSet a, float i) { a.addAttribute(FirstLineIndent, new Float(i)); } /** * Adds a font family attribute to the specified set. * * @param a the attribute set (<code>null</code> not permitted). * @param fam the font family name (<code>null</code> not permitted). * * @throws NullPointerException if either argument is <code>null</code>. * * @see #getFontFamily(AttributeSet) */ public static void setFontFamily(MutableAttributeSet a, String fam) { a.addAttribute(FontFamily, fam); } /** * Adds a font size attribute to the specified set. * * @param a the attribute set (<code>null</code> not permitted). * @param s the font size (in points). * * @throws NullPointerException if <code>a</code> is <code>null</code>. * * @see #getFontSize(AttributeSet) */ public static void setFontSize(MutableAttributeSet a, int s) { a.addAttribute(FontSize, new Integer(s)); } /** * Adds a foreground color attribute to the specified set. * * @param a the attribute set (<code>null</code> not permitted). * @param fg the foreground color (<code>null</code> not permitted). * * @throws NullPointerException if either argument is <code>null</code>. * * @see #getForeground(AttributeSet) */ public static void setForeground(MutableAttributeSet a, Color fg) {
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?