Example usage for javax.swing ImageIcon setDescription

List of usage examples for javax.swing ImageIcon setDescription

Introduction

In this page you can find the example usage for javax.swing ImageIcon setDescription.

Prototype

public void setDescription(String description) 

Source Link

Document

Sets the description of the image.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {

    ImageIcon icon = new ImageIcon("image.gif");
    icon.setDescription("Description of Image");
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    ImageIcon icon = new ImageIcon("image.gif");
    icon.setDescription("Description of Image");

    System.out.println(icon.getDescription());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    ImageIcon icon = new ImageIcon("image.gif");
    icon.setDescription("Description of Image");

    System.out.println(icon.getIconHeight());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    ImageIcon icon = new ImageIcon("image.gif");
    icon.setDescription("Description of Image");

    System.out.println(icon.getImageObserver());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    ImageIcon icon = new ImageIcon("image.gif");
    icon.setDescription("Description of Image");

    System.out.println(icon.toString());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    ImageIcon icon = new ImageIcon("image.gif");
    icon.setDescription("Description of Image");

    System.out.println(icon.getIconWidth());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    ImageIcon icon = new ImageIcon("image.gif");
    icon.setDescription("Description of Image");

    System.out.println(icon.getImageLoadStatus());
}

From source file:AccessibleScrollDemo.java

public AccessibleScrollDemo() {
    //Load the photograph into an image icon.
    ImageIcon david = new ImageIcon("images/youngdad.jpeg");
    david.setDescription("Photograph of David McNabb in his youth.");

    //Create the row and column headers
    columnView = new Rule(Rule.HORIZONTAL, true);
    columnView.setPreferredWidth(david.getIconWidth());
    columnView.getAccessibleContext().setAccessibleName("Column Header");
    columnView.getAccessibleContext()//from w w w  .j a  va  2  s  .c o m
            .setAccessibleDescription("Displays horizontal ruler for " + "measuring scroll pane client.");
    rowView = new Rule(Rule.VERTICAL, true);
    rowView.setPreferredHeight(david.getIconHeight());
    rowView.getAccessibleContext().setAccessibleName("Row Header");
    rowView.getAccessibleContext()
            .setAccessibleDescription("Displays vertical ruler for " + "measuring scroll pane client.");

    //Create the corners
    JPanel buttonCorner = new JPanel();
    isMetric = new JToggleButton("cm", true);
    isMetric.setFont(new Font("SansSerif", Font.PLAIN, 11));
    isMetric.setMargin(new Insets(2, 2, 2, 2));
    isMetric.addItemListener(new UnitsListener());
    isMetric.setToolTipText("Toggles rulers' unit of measure " + "between inches and centimeters.");
    buttonCorner.add(isMetric); //Use the default FlowLayout
    buttonCorner.getAccessibleContext().setAccessibleName("Upper Left Corner");

    String desc = "Fills the corner of a scroll pane " + "with color for aesthetic reasons.";
    Corner lowerLeft = new Corner();
    lowerLeft.getAccessibleContext().setAccessibleName("Lower Left Corner");
    lowerLeft.getAccessibleContext().setAccessibleDescription(desc);

    Corner upperRight = new Corner();
    upperRight.getAccessibleContext().setAccessibleName("Upper Right Corner");
    upperRight.getAccessibleContext().setAccessibleDescription(desc);

    //Set up the scroll pane
    picture = new ScrollablePicture(david, columnView.getIncrement());
    picture.setToolTipText(david.getDescription());
    picture.getAccessibleContext().setAccessibleName("Scroll pane client");

    JScrollPane pictureScrollPane = new JScrollPane(picture);
    pictureScrollPane.setPreferredSize(new Dimension(300, 250));
    pictureScrollPane.setViewportBorder(BorderFactory.createLineBorder(Color.black));

    pictureScrollPane.setColumnHeaderView(columnView);
    pictureScrollPane.setRowHeaderView(rowView);

    pictureScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, buttonCorner);
    pictureScrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, lowerLeft);
    pictureScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, upperRight);

    //Put it in this panel
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    add(pictureScrollPane);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:org.apache.jmeter.util.JMeterUtils.java

/**
 * This looks for the requested image in the classpath under
 * org.apache.jmeter.images.<em>&lt;name&gt;</em>, and also sets the description
 * of the image, which is useful if the icon is going to be placed
 * on the clipboard.//from w  w w .  j a v a  2 s.co  m
 *
 * @param name
 *            the name of the image
 * @param description
 *            the description of the image
 * @return The Image value
 */
public static ImageIcon getImage(String name, String description) {
    ImageIcon icon = getImage(name);
    if (icon != null) {
        icon.setDescription(description);
    }
    return icon;
}