Java JTextComponent setTextComponentTransparent( JTextComponent textComponent)

Here you can find the source of setTextComponentTransparent( JTextComponent textComponent)

Description

Sets the text component transparent.

License

Open Source License

Parameter

Parameter Description
textComponent the text component to be set to transparent.

Declaration

public static void setTextComponentTransparent(
        JTextComponent textComponent) 

Method Source Code

//package com.java2s;
import javax.swing.*;

import javax.swing.text.JTextComponent;

public class Main {
    /**/*from   w w  w. j a  v a  2 s.  c  o  m*/
     * Sets the text component transparent. It will call setOpaque(false) and also set client property for certain L&Fs
     * in case the L&F doesn't respect the opaque flag.
     *
     * @param textComponent the text component to be set to transparent.
     */
    public static void setTextComponentTransparent(
            JTextComponent textComponent) {
        textComponent.setOpaque(false);

        // add this for the Synthetica
        textComponent.putClientProperty("Synthetica.opaque", false);
        // add this for Nimbus to disable all the painting of a component in Nimbus
        textComponent.putClientProperty("Nimbus.Overrides.InheritDefaults",
                false);
        textComponent.putClientProperty("Nimbus.Overrides",
                new UIDefaults());

    }
}

Related

  1. setMandatoryBorder(JTextComponent comp)
  2. setText(JTextComponent textComp, String text)
  3. setTextComponentMargins(JTextComponent component)
  4. setTextComponentTransparent( JTextComponent paramJTextComponent)
  5. setTextComponentTransparent( JTextComponent textComponent)
  6. setTextComponetIntegerValid(final JTextComponent c)
  7. setTextStyle(JTextComponent txt)
  8. setWarningBackground(JTextComponent comp)
  9. textComponentAsLabel(JTextComponent textcomponent)