Package javax.swing.text

Examples of javax.swing.text.Style.addAttribute()


        assertNull(newStyle.getAttribute(StyleConstants.FontSize));
        assertNull(newStyle.getAttribute(StyleConstants.FontFamily));
        newStyle.addAttribute(StyleConstants.FontFamily, "family2");
        newStyle.addAttribute(StyleConstants.FontSize, new Integer(10));
        newStyle.addAttribute(StyleConstants.Italic, Boolean.FALSE);
        newStyle.addAttribute(StyleConstants.StrikeThrough, Boolean.TRUE);
        newStyle.addAttribute(StyleConstants.Subscript, Boolean.FALSE);
        newStyle.addAttribute(StyleConstants.Foreground, Color.RED);
        textPane.setDocument(newDoc);
        assertNotSame(style, newStyle);
        assertEquals(25, ((Integer) newStyle.getAttribute(StyleConstants.FontSize)).intValue());
View Full Code Here


        assertNull(newStyle.getAttribute(StyleConstants.FontFamily));
        newStyle.addAttribute(StyleConstants.FontFamily, "family2");
        newStyle.addAttribute(StyleConstants.FontSize, new Integer(10));
        newStyle.addAttribute(StyleConstants.Italic, Boolean.FALSE);
        newStyle.addAttribute(StyleConstants.StrikeThrough, Boolean.TRUE);
        newStyle.addAttribute(StyleConstants.Subscript, Boolean.FALSE);
        newStyle.addAttribute(StyleConstants.Foreground, Color.RED);
        textPane.setDocument(newDoc);
        assertNotSame(style, newStyle);
        assertEquals(25, ((Integer) newStyle.getAttribute(StyleConstants.FontSize)).intValue());
        assertEquals(font.getName(), newStyle.getAttribute(StyleConstants.FontFamily));
View Full Code Here

        newStyle.addAttribute(StyleConstants.FontFamily, "family2");
        newStyle.addAttribute(StyleConstants.FontSize, new Integer(10));
        newStyle.addAttribute(StyleConstants.Italic, Boolean.FALSE);
        newStyle.addAttribute(StyleConstants.StrikeThrough, Boolean.TRUE);
        newStyle.addAttribute(StyleConstants.Subscript, Boolean.FALSE);
        newStyle.addAttribute(StyleConstants.Foreground, Color.RED);
        textPane.setDocument(newDoc);
        assertNotSame(style, newStyle);
        assertEquals(25, ((Integer) newStyle.getAttribute(StyleConstants.FontSize)).intValue());
        assertEquals(font.getName(), newStyle.getAttribute(StyleConstants.FontFamily));
        assertEquals(Boolean.TRUE, newStyle.getAttribute(StyleConstants.Italic));
View Full Code Here

        assertEquals(1, parent.getAttributeCount());
        assertNull(parent.getResolveParent());
        assertEquals(2, child.getAttributeCount());
        assertNotNull(child.getResolveParent());
        parent.addAttribute(StyleConstants.Bold, Boolean.FALSE);
        child.addAttribute(StyleConstants.Bold, Boolean.TRUE);
        assertFalse(((Boolean) parent.getAttribute(StyleConstants.Bold)).booleanValue());
        assertTrue(((Boolean) child.getAttribute(StyleConstants.Bold)).booleanValue());
        // Add styles with diff parameters
        Style parent1 = textPane.addStyle("p1", null);
        Style parent2 = textPane.addStyle("p2", null);
View Full Code Here

    public void testGetLogicalStyle() throws BadLocationException {
        textPane.getStyledDocument().insertString(11, "bold", attrs);
        Style style = textPane.addStyle("bold", textPane.getStyle(StyleContext.DEFAULT_STYLE));
        textPane.setCaretPosition(1);
        style.addAttribute(StyleConstants.Bold, Boolean.TRUE);
        textPane.setLogicalStyle(style);
        style = textPane.getLogicalStyle();
        textPane.setCaretPosition(3);
        assertSame(style, textPane.getLogicalStyle());
        assertTrue(((Boolean) style.getAttribute(StyleConstants.Bold)).booleanValue());
View Full Code Here

        StyleConstants.setBold(attrs, true);
        // Add style
        Style style = textPane.addStyle("bold", textPane.getStyle(StyleContext.DEFAULT_STYLE));
        // Set style
        textPane.setCaretPosition(1);
        style.addAttribute(StyleConstants.Bold, Boolean.TRUE);
        assertFalse(StyleConstants.isBold(textPane.getParagraphAttributes()));
        textPane.setLogicalStyle(style);
        style = textPane.getLogicalStyle();
        textPane.setCaretPosition(3);
        assertSame(style, textPane.getLogicalStyle());
View Full Code Here

        GameNode node = (GameNode) startNode.getChildAt(n);
        boolean isCurrentNode = (node == currentNode);
        if (node.isLeaf()) {
          if (node.isWhiteMove()) {
            s = node.getFullMoveNumber() + ". ";
            boldStyle.addAttribute("gameNode", node);
            doc.insertString(pos, s, boldStyle);
            pos += s.length();
            s = node.getMove();
            Style style = isCurrentNode ? currentNodeStyle : regularStyle;
            style.addAttribute("gameNode", node);
View Full Code Here

            boldStyle.addAttribute("gameNode", node);
            doc.insertString(pos, s, boldStyle);
            pos += s.length();
            s = node.getMove();
            Style style = isCurrentNode ? currentNodeStyle : regularStyle;
            style.addAttribute("gameNode", node);
            doc.insertString(pos, s, style);
            pos += s.length();
            isContinuous = true;
          } else {
            if (isContinuous) {
View Full Code Here

            isContinuous = true;
          } else {
            if (isContinuous) {
              s = node.getMove();
              Style style = isCurrentNode ? currentNodeStyle : regularStyle;
              style.addAttribute("gameNode", node);
              doc.insertString(pos, s, style);
              pos += s.length();
            } else {
              isContinuous = true;
              s = node.getFullMoveNumber() + "... ";
View Full Code Here

              boldStyle.addAttribute("gameNode", node);
              doc.insertString(pos, s, boldStyle);
              pos += s.length();
              s = node.getMove();
              Style style = isCurrentNode ? currentNodeStyle : regularStyle;
              style.addAttribute("gameNode", node);
              doc.insertString(pos, s, style);
              pos += s.length();
            }
          }
          if (node.hasComment()) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.