Code example for JLabel

Methods: getClientProperty

0
     * 
     * @see http://blog.nobel-joergensen.com/2009/01/18/changing-preferred-size-of-a-html-jlabel/ 
     */ 
    private Dimension calculatePreferredSize(JLabel labelWithHtmlText, boolean width, int preferredSize) {
 
        View view = (View) labelWithHtmlText.getClientProperty(BasicHTML.propertyKey);
 
        view.setSize(width ? preferredSize : 0,
                     width ? 0 : preferredSize);
 
        float w = view.getPreferredSpan(View.X_AXIS);
        float h = view.getPreferredSpan(View.Y_AXIS);
 
        return new Dimension((int) Math.ceil(w),
                (int) Math.ceil(h));
    } 
 
    @Override 
    public void actionPerformed(ActionEvent e) {
        if (ACTION_HOMEPAGE.equals(e.getActionCommand())) {