Java JTextComponent setTextComponentTransparent( JTextComponent paramJTextComponent)

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

Description

set Text Component Transparent

License

Open Source License

Declaration

public static void setTextComponentTransparent(
            JTextComponent paramJTextComponent) 

Method Source Code

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

import javax.swing.text.JTextComponent;

public class Main {
    public static void setTextComponentTransparent(
            JTextComponent paramJTextComponent) {
        paramJTextComponent.setOpaque(false);
        paramJTextComponent.putClientProperty("Synthetica.opaque",
                Boolean.valueOf(false));
        paramJTextComponent.putClientProperty(
                "Nimbus.Overrides.InheritDefaults", Boolean.valueOf(false));
        paramJTextComponent.putClientProperty("Nimbus.Overrides",
                new UIDefaults());
    }/*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 component the text component to be set to transparent.
     * @deprecated replaced by {@link #setComponentTransparent(javax.swing.JComponent)}.
     */
    @Deprecated
    public static void setTextComponentTransparent(JComponent component) {
        setComponentTransparent(component);
    }

    /**
     * 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 component the text component to be set to transparent.
     */
    public static void setComponentTransparent(JComponent component) {
        component.setOpaque(false);

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

    }
}

Related

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