In my attempt to implement word-wrap for my JLabel
's text, I referred to this question. The code snippet I used for this purpose is as follows:
label.setText("<html style=\"vertical-align:middle;\">"+label.getText()+"</html>");
However, the text is not displayed correctly by the label. For instance, if the original text was "the big bad wolf", it appears like this:
<html style="vertical-align:middle;">the big bad wolf</html>
Why is the label failing to apply the intended style?
UPDATE: To illustrate my objective further, here is a visual reference:
https://i.sstatic.net/8za6S.png