Example usage for javax.swing JLabel setVerticalTextPosition

List of usage examples for javax.swing JLabel setVerticalTextPosition

Introduction

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

Prototype

@BeanProperty(expert = true, visualUpdate = true, enumerationValues = { "SwingConstants.TOP",
        "SwingConstants.CENTER",
        "SwingConstants.BOTTOM" }, description = "The vertical position of the text relative to it's image.")
public void setVerticalTextPosition(int textPosition) 

Source Link

Document

Sets the vertical position of the label's text, relative to its image.

Usage

From source file:com.enderville.enderinstaller.ui.Installer.java

protected void initialPanel(JPanel contentPane) {
    JLabel text = new JLabel();
    try {/* w  ww . j a  va 2  s  . c o  m*/
        ImageIcon icon = new ImageIcon(ImageIO.read(new FileInputStream(InstallerConfig.getLogoFile())));
        text.setIcon(icon);
    } catch (IOException e) {
        LOGGER.error("IO error on logo.png", e);
    }
    StringBuilder textBuffer = new StringBuilder();
    try {
        BufferedReader r = new BufferedReader(new FileReader(InstallerConfig.getInitTextFile()));
        String line = null;
        while ((line = r.readLine()) != null) {
            textBuffer.append(line + "\n");
        }
    } catch (IOException ioe) {
        LOGGER.error("IO error on logo.png", ioe);
    }
    text.setText(textBuffer.toString());
    text.setVerticalTextPosition(JLabel.BOTTOM);
    text.setHorizontalTextPosition(JLabel.CENTER);
    contentPane.setLayout(new MigLayout(new LC().fill()));
    contentPane.add(text, new CC().alignX("center").wrap());
    contentPane.add(getTargetButton(), new CC().alignX("center").wrap());
}