Examples of SimpleAttributeSet


Examples of javax.swing.text.SimpleAttributeSet

  {
    doc = this;
    rootElement = doc.getDefaultRootElement();
    putProperty( DefaultEditorKit.EndOfLineStringProperty, "\n" );

    normal = new SimpleAttributeSet();
    StyleConstants.setForeground(normal, Color.black);

    comment = new SimpleAttributeSet();
    StyleConstants.setForeground(comment, Color.gray);
    StyleConstants.setItalic(comment, true);

    keyword = new SimpleAttributeSet();
    StyleConstants.setForeground(keyword, Color.blue);

    quote = new SimpleAttributeSet();
    StyleConstants.setForeground(quote, Color.red);

    keywords = new HashSet<String>();
    keywords.add( "abstract" );
    keywords.add( "boolean" );
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

      {
        muxList.add(cssRule);
      }
    }

    final MutableAttributeSet retval = new SimpleAttributeSet();
    for (int i = muxList.size() - 1; i >= 0; i--)
    {
      final AttributeSet o = (AttributeSet) muxList.get(i);
      retval.addAttributes(o);
    }
    return retval;
  }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

    {
        Document doc = part1.getDocument();
        try
        {
            doc.remove( 0, doc.getLength() );
            doc.insertString( 0, ipString, new SimpleAttributeSet() );
        }
        catch ( BadLocationException exp )
        {
        }
    }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

        nextTF.requestFocus();
        Document doc = nextTF.getDocument();
        try
        {
            doc.remove( 0, doc.getLength() );
            doc.insertString( 0, nextTextFieldStr, new SimpleAttributeSet() );
        }
        catch ( BadLocationException exp )
        {
        }
    }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

         if (foreground == null)
            foreground = Color.WHITE;
         if (background == null)
            background = Color.BLACK;
        
         MutableAttributeSet newAttr = new SimpleAttributeSet();
         StyleConstants.setForeground(newAttr, foreground);
         StyleConstants.setBackground(newAttr, background);
         // StyleConstants.setBold(newAttr, true);
         return newAttr;
      }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

         }
      });

      ///////////////////////////////////////////////////////////////////
      // Message
      _saSetMessage = new SimpleAttributeSet();
      StyleConstants.setBackground(_saSetMessage, Color.green);

      SimpleAttributeSet saSetMessageHistory = new SimpleAttributeSet();
      StyleConstants.setBackground(saSetMessageHistory, getBackground());
      _saSetHistoryBySaSet.put(_saSetMessage, saSetMessageHistory);
      //
      ////////////////////////////////////////////////////////////////


      ///////////////////////////////////////////////////////////////////
      // Warning
      _saSetWarning = new SimpleAttributeSet();
      StyleConstants.setBackground(_saSetWarning, Color.yellow);

      SimpleAttributeSet saSetWarningHistory = new SimpleAttributeSet();
      StyleConstants.setBackground(saSetWarningHistory, new Color(255,255,210)); // a light yellow
      _saSetHistoryBySaSet.put(_saSetWarning, saSetWarningHistory);
      //
      ////////////////////////////////////////////////////////////////


      /////////////////////////////////////////////////////////////////
      // Error
      // Attention: Do not use background colors here.
      // Color blind people cannot read black writing on red background.
      _saSetError = new SimpleAttributeSet();
      //StyleConstants.setBackground(_saSetError, Color.red);
      StyleConstants.setForeground(_saSetError, Color.red);

      SimpleAttributeSet saSetErrorHistory = new SimpleAttributeSet();
      //StyleConstants.setBackground(saSetErrorHistory, Color.pink);
      StyleConstants.setForeground(saSetErrorHistory, new Color(255,102,102));
      _saSetHistoryBySaSet.put(_saSetError, saSetErrorHistory);
      //
      //////////////////////////////////////////////////////////////////
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

    {
         /////////////////////////////////////////////////////////////////////////////////
         // Checks if the former message should be highlighted in a 'history' color.
         if (document.getLength() >= _lastLength && null != _lastMessage)
      {
            SimpleAttributeSet historySaSet = _saSetHistoryBySaSet.get(_lastSASet);
            document.remove(_lastLength, _lastMessage.length());
            document.insertString(document.getLength(), _lastMessage, historySaSet);
      }
         //
         ///////////////////////////////////////////////////////////////////////////////////
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

            {
                if ( j++ > 0 && !str.equals( "" ) )
                {
                    if ( m_this != null && m_this.getFrame() != null )
                    {
                        SimpleAttributeSet sas = new SimpleAttributeSet();
                        String insString = getStyle( str, sas );
                       
                       
                        m_this.getFrame().getlogTextArea().getDocument().insertString( m_this.getFrame().getlogTextArea().getDocument().getEndPosition().getOffset() - 1, insString + "\n",
                                sas );
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

    void appendString(String message, Color c) {
        Document doc = console.getDocument();
        if(doc.getLength() != 0) {
            message = "\n" + message;
        }
        SimpleAttributeSet attr = new SimpleAttributeSet();
        StyleConstants.setForeground(attr, c);
        try {
            doc.insertString(doc.getLength(), message, attr);
        }
        catch(Exception e) {           
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

        }
    }

    public void append(String text, Color color) {
        synchronized (textArea) {
            SimpleAttributeSet attr1 = new SimpleAttributeSet();
            StyleConstants.setForeground(attr1, color);
            try {
                textArea.getStyledDocument().insertString(textArea.getStyledDocument().getLength(), text, attr1);
                if (textArea.getStyledDocument().getLength() > 65535) {
                    textArea.getStyledDocument().remove(65536, textArea.getStyledDocument().getLength() - 65535);
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.