Example usage for java.awt Label Label

List of usage examples for java.awt Label Label

Introduction

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

Prototype

public Label() throws HeadlessException 

Source Link

Document

Constructs an empty label.

Usage

From source file:ClockDemo.java

/**
 * The init method is called when the browser first starts the applet. It
 * sets up the Label component and obtains a DateFormat object
 *///from ww  w.  j  a v  a2s  . co m
public void init() {
    time = new Label();
    time.setFont(new Font("helvetica", Font.BOLD, 12));
    time.setAlignment(Label.CENTER);
    setLayout(new BorderLayout());
    add(time, BorderLayout.CENTER);
    timeFormat = DateFormat.getTimeInstance(DateFormat.MEDIUM);
}

From source file:SimpleInputMethod.java

public void setInputMethodContext(InputMethodContext context) {
    inputMethodContext = context;// ww w. j a  v  a 2s  . c om
    if (statusWindow == null) {
        statusWindow = context.createInputMethodWindow("Simple Input Method", false);
        Label label = new Label();
        label.setText(locale.getDisplayName());
        statusWindow.add(label);
        label.setSize(200, 50);
        statusWindow.add(label);
        statusWindow.pack();

        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        statusWindow.setLocation(d.width - statusWindow.getWidth(), d.height - statusWindow.getHeight());
    }
}

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 ww  w.  j  a v  a2 s.  c  o  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 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 av a2  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;
}

From source file:AppletViewer.java

/** Construct the GUI for an Applet Status window */
AppletAdapter() {/*from w ww . j a v  a 2  s . co m*/
    super();

    // Must do this very early on, since the Applet's
    // Constructor or its init() may use showStatus()
    add(status = new Label());

    // Give "status" the full width
    status.setSize(getSize().width, status.getSize().height);

    showStatus("AppletAdapter constructed"); // now it can be said
}

From source file:Bouncer.java

public AnimationFrame(Bouncer ac) {
    super();/*from  w  ww .  java  2s .c  o  m*/
    setLayout(new BorderLayout());
    add(ac, BorderLayout.CENTER);
    add(mStatusLabel = new Label(), BorderLayout.SOUTH);
    // Create a number formatter.
    mFormat = NumberFormat.getInstance();
    mFormat.setMaximumFractionDigits(1);
    // Listen for the frame rate changes.
    ac.setRateListener(this);
    // Kick off the animation.
    Thread t = new Thread(ac);
    t.start();
}

From source file:ImageBouncer.java

public AnimationFrame(ImageBouncer ac) {
    super();//w  w w . java2s .  co  m
    setLayout(new BorderLayout());
    add(ac, BorderLayout.CENTER);
    add(mStatusLabel = new Label(), BorderLayout.SOUTH);
    // Create a number formatter.
    mFormat = NumberFormat.getInstance();
    mFormat.setMaximumFractionDigits(1);
    // Listen for the frame rate changes.
    ac.setRateListener(this);
    // Kick off the animation.
    Thread t = new Thread(ac);
    t.start();
}

From source file:TextBouncer.java

public AnimationFrame(TextBouncer ac) {
    super();/*from  ww  w.j a  v a  2 s.  c  o  m*/
    setLayout(new BorderLayout());
    add(ac, BorderLayout.CENTER);
    add(mStatusLabel = new Label(), BorderLayout.SOUTH);
    // Create a number formatter.
    mFormat = NumberFormat.getInstance();
    mFormat.setMaximumFractionDigits(1);
    // Listen for the frame rate changes.
    ac.setRateListener(this);
    // Kick off the animation.
    Thread t = new Thread(ac);
    t.start();
}

From source file:gdsc.smlm.ij.plugins.SpotAnalysis.java

private void createFrame() {
    Panel mainPanel = new Panel();
    add(mainPanel);/*www .  j a  v  a2 s  .c  om*/

    inputChoice = new Choice();
    mainPanel.add(createChoicePanel(inputChoice, ""));

    widthTextField = new TextField();
    mainPanel.add(createTextPanel(widthTextField, "PSF width", "1.2"));

    blurTextField = new TextField();
    mainPanel.add(createTextPanel(blurTextField, "Blur (relative to width)", "1"));

    gainTextField = new TextField();
    mainPanel.add(createTextPanel(gainTextField, "Gain", "37.7"));

    exposureTextField = new TextField();
    mainPanel.add(createTextPanel(exposureTextField, "ms/Frame", "20"));

    smoothingTextField = new TextField();
    mainPanel.add(createTextPanel(smoothingTextField, "Smoothing", "0.25"));

    profileButton = new Button("Profile");
    profileButton.addActionListener(this);
    addButton = new Button("Add");
    addButton.addActionListener(this);
    deleteButton = new Button("Remove");
    deleteButton.addActionListener(this);
    saveButton = new Button("Save");
    saveButton.addActionListener(this);
    saveTracesButton = new Button("Save Traces");
    saveTracesButton.addActionListener(this);

    currentLabel = new Label();
    mainPanel.add(createLabelPanel(currentLabel, "", ""));

    rawFittedLabel = new Label();
    mainPanel.add(createLabelPanel(rawFittedLabel, "", ""));

    blurFittedLabel = new Label();
    mainPanel.add(createLabelPanel(blurFittedLabel, "", ""));

    JPanel buttonPanel = new JPanel();
    FlowLayout l = new FlowLayout();
    l.setVgap(0);
    buttonPanel.setLayout(l);
    buttonPanel.add(profileButton, BorderLayout.CENTER);
    buttonPanel.add(addButton, BorderLayout.CENTER);
    buttonPanel.add(deleteButton, BorderLayout.CENTER);
    buttonPanel.add(saveButton, BorderLayout.CENTER);
    buttonPanel.add(saveTracesButton, BorderLayout.CENTER);

    mainPanel.add(buttonPanel);

    listModel = new DefaultListModel<Spot>();
    onFramesList = new JList<Spot>(listModel);
    onFramesList.setVisibleRowCount(15);
    onFramesList.addListSelectionListener(this);
    //mainPanel.add(onFramesList);

    JScrollPane scrollPane = new JScrollPane(onFramesList);
    scrollPane.getVerticalScrollBarPolicy();
    mainPanel.add(scrollPane);

    GridBagLayout mainGrid = new GridBagLayout();
    int y = 0;
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.WEST;
    c.gridwidth = 1;
    c.insets = new Insets(2, 2, 2, 2);

    for (Component comp : mainPanel.getComponents()) {
        c.gridy = y++;
        mainGrid.setConstraints(comp, c);
    }

    mainPanel.setLayout(mainGrid);
}

From source file:no.eris.applet.AppletViewer.java

/** Construct the GUI for an Applet Status window */
AppletAdapter(AppletViewer appletViewer, Map<String, String> attributes, Map<String, String> params) {
    this.appletViewer = appletViewer;
    this.attributes = attributes;
    this.params = params;

    // Must do this very early on, since the Applet's
    // Constructor or its init() may use showStatus()
    add(status = new Label());

    // Give "status" the full width
    status.setSize(getSize().width, status.getSize().height);

    showStatus("AppletAdapter constructed"); // now it can be said
}