Java JLabel findMaxLabelWidth(JLabel... jLabels)

Here you can find the source of findMaxLabelWidth(JLabel... jLabels)

Description

find Max Label Width

License

Apache License

Declaration

public static int findMaxLabelWidth(JLabel... jLabels) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.FontMetrics;

import javax.swing.JLabel;

public class Main {
    public static int findMaxLabelWidth(JLabel... jLabels) {
        int maxvalue = 0;
        for (JLabel label : jLabels) {

            FontMetrics fm = label.getFontMetrics(label.getFont());
            int width = fm.stringWidth(label.getText());
            if (maxvalue < width) {
                maxvalue = width;//  w ww .  ja  v a2 s  .c  o  m
            }

        }

        return maxvalue;
    }
}

Related

  1. addParameterRow(Container container, JLabel label, Component component)
  2. clear(JLabel... fields)
  3. ensureCustomBackgroundStored(JLabel comp)
  4. exibeMensagemTemporaria(final JLabel lblMensagem, String mensagem)
  5. extendByIcon(JLabel label, Dimension dm)
  6. getLabelValue(JLabel lbl)
  7. getRoughStroke(final JLabel _jlbl_stroke)
  8. getStoredBackground(JLabel comp)
  9. getStroke(final JLabel _jlbl_stroke)