Example usage for javax.swing JLabel putClientProperty

List of usage examples for javax.swing JLabel putClientProperty

Introduction

In this page you can find the example usage for javax.swing JLabel putClientProperty.

Prototype

public final void putClientProperty(Object key, Object value) 

Source Link

Document

Adds an arbitrary key/value "client property" to this component.

Usage

From source file:de.iew.imageupload.widgets.ContentPane.java

public void registerImageFile(File file) {
    try {//from  ww w.j a va 2  s .com
        ImageIcon imageIcon = new ImageIcon(file.getAbsolutePath());
        JLabel imageLabel = new JLabel(imageIcon, JLabel.CENTER);
        imageLabel.setPreferredSize(new Dimension(100, 100));
        imageLabel.setSize(new Dimension(100, 100));
        imageLabel.addMouseListener(this.imageMouseClickHandler);
        imageLabel.setBackground(Color.WHITE);
        imageLabel.setBorder(new EmptyBorder(10, 10, 10, 10));
        imageLabel.putClientProperty("Image File", file);

        this.imageGridPane.add(imageLabel);
        this.imageGridPane.revalidate();
    } catch (Exception e) {
        e.printStackTrace();
    }
}