Laf-Widget client properties

View all client properties.

Client property name



Client property name for specifying that the text component should have the edit context menu (with Cut / Copy / Paste / ... menu items). This property can be set either on a single text component or globally on UIManager. The value in both cases should be either Boolean.TRUE or Boolean.FALSE.

See also

Sample code

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;

import org.pushingpixels.lafwidget.LafWidget;
import org.pushingpixels.substance.api.SubstanceLookAndFeel;

 * Test application that shows the use of the
 {@link LafWidget#TEXT_EDIT_CONTEXT_MENU} client property.
 @author Kirill Grouchnikov
public class TextEditContextMenu extends JFrame {
   * Creates the main frame for <code>this</code> sample.
  public TextEditContextMenu() {
    super("Text edit context menu");

    this.setLayout(new BorderLayout());

    final JTextField jtf = new JTextField("sample text");

    JPanel main = new JPanel(new FlowLayout(FlowLayout.CENTER));
    this.add(main, BorderLayout.CENTER);

    JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    final JCheckBox hasEditContextMenu = new JCheckBox(
        "Has edit context menu");
    hasEditContextMenu.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
            hasEditContextMenu.isSelected() ? Boolean.TRUE : null);

    this.add(controls, BorderLayout.SOUTH);


   * The main method for <code>this</code> sample. The arguments are ignored.
   @param args
   *            Ignored.
  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        SubstanceLookAndFeel.setSkin(new BusinessBlackSteelSkin());
        new TextEditContextMenu().setVisible(true);

The screenshot below shows a text field when this property is not installed. Some text is selected and the right mouse button is clicked - no context edit menu is shown:

After installing this property on the text field, selecting some text (not necessary) and right-clicking the mouse, the context edit menu is shown: