I am trying to create vertical text in a jlabel, and since there isn't a method for it in java i am using HTML, but it doesn't wanna work.
Here is a html document that displays the same code and here it is vertical.
<html>
<p class="fasz">
<p style="text-orientation: sideways-right;writing-mode: vertical-rl">
Picsa
</p>
</html>
Here is a java example:
package javaapplication48;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class JavaApplication48 {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(null);
frame.setSize(500, 500);
frame.setVisible(true);
JLabel label = new JLabel();
label.setText("<html>"
+ " <p class=\"fasz\">"
+ " <p style=\"text-orientation: sideways-right;writing-mode: vertical-rl\">"
+ " Picsa"
+ " </p>"
+ "</html>");
frame.add(label);
label.setBounds(0, 0, 200, 200);
JLabel ctrl =new JLabel();
ctrl.setText("<html>"
+ " <p class=\"fasz\">"
+ " <p style=\"color:red\">"
+ " Picsa"
+ " </p>"
+ "</html>");
ctrl.setBounds(0, 0, 200, 300);
frame.add(ctrl);
ctrl.updateUI();
}
}