Example usage for java.awt Label setAlignment

List of usage examples for java.awt Label setAlignment

Introduction

In this page you can find the example usage for java.awt Label setAlignment.

Prototype

public synchronized void setAlignment(int alignment) 

Source Link

Document

Sets the alignment for this label to the specified alignment.

Usage

From source file:edu.cornell.mannlib.vitro.webapp.controller.freemarker.ImageUploaderThumbnailerTester_2.java

private Component createImagePanel(CropData cropData) {
    RenderedOp image = createCroppedImage(cropData);

    Set<String> blackSides = checkBlackEdges(image);
    if (!blackSides.isEmpty()) {
        log.warn("edges  at " + cropData + ", " + blackSides);
    }/*from w  w  w.j a va 2  s .c om*/

    String legend = "left=" + cropData.left + ", top=" + cropData.top + ", size=" + cropData.size;
    Label l = new Label();
    l.setAlignment(Label.CENTER);
    if (!blackSides.isEmpty()) {
        l.setBackground(new Color(0xFFDDDD));
        legend += " " + blackSides;
    }
    l.setText(legend);

    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    p.add("South", l);
    p.add("Center", new ImageCanvas(image));
    p.setBackground(new Color(0xFFFFFF));
    p.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    return p;
}

From source file:edu.cornell.mannlib.vitro.webapp.imageprocessor.jai.JaiImageProcessorTester2.java

private Component createImagePanel(CropData cropData) {
    RenderedOp image = createCroppedImage(cropData);

    Set<String> blackSides = checkBlackEdges(image);
    if (!blackSides.isEmpty()) {
        log.warn("edges  at " + cropData + ", " + blackSides);
    }//from   ww  w  .  j a va  2 s.  co m

    String legend = "left=" + cropData.left + ", top=" + cropData.top + ", size=" + cropData.size;
    Label l = new Label();
    l.setAlignment(Label.CENTER);
    if (!blackSides.isEmpty()) {
        l.setBackground(new Color(0xFFDDDD));
        legend += " " + blackSides;
    }
    l.setText(legend);

    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    p.add("South", l);
    p.add("Center", new javax.media.jai.widget.ImageCanvas(image));
    p.setBackground(new Color(0xFFFFFF));
    p.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    return p;
}