Java JTextComponent setTextStyle(JTextComponent txt)

Here you can find the source of setTextStyle(JTextComponent txt)

Description

set Text Style

License

Academic Free License

Declaration

public static void setTextStyle(JTextComponent txt) 

Method Source Code


//package com.java2s;
//License from project: Academic Free License 

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;

import javax.swing.text.JTextComponent;

public class Main {
    public static Color BACKGROUND = new Color(35, 34, 32);
    public static Color BASIC_TEXT_COLOR = new Color(221, 224, 193);
    private static Font BASIC_FONT = null;

    public static void setTextStyle(JTextComponent txt) {
        getBasicFont();//from w  w w .  j a  va 2s.c om
        txt.setFont(BASIC_FONT);
        txt.setForeground(BASIC_TEXT_COLOR);
        txt.setBackground(BACKGROUND);
    }

    public static Font getBasicFont() {
        if (BASIC_FONT == null) {
            BASIC_FONT = Font.getFont("Verdana");
        }
        return BASIC_FONT;
    }

    public static void setBackground(Component comp) {
        comp.setBackground(BACKGROUND);
    }
}

Related

  1. setTextComponentMargins(JTextComponent component)
  2. setTextComponentTransparent( JTextComponent paramJTextComponent)
  3. setTextComponentTransparent( JTextComponent textComponent)
  4. setTextComponentTransparent( JTextComponent textComponent)
  5. setTextComponetIntegerValid(final JTextComponent c)
  6. setWarningBackground(JTextComponent comp)
  7. textComponentAsLabel(JTextComponent textcomponent)
  8. value(JTextComponent txt)