mirror of
https://gitlab.com/biskuteri-cafe/JKomasto2.git
synced 2025-01-08 21:04:44 +01:00
7ede5e1290
Added rendering of emojis. Added run script.
28 lines
695 B
Java
28 lines
695 B
Java
|
|
import javax.swing.*;
|
|
import java.awt.*;
|
|
import java.util.List;
|
|
|
|
class
|
|
TestWindow extends JFrame {
|
|
|
|
TestWindow()
|
|
{
|
|
RichTextPane display = new RichTextPane();
|
|
setContentPane(display);
|
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
|
setLocationByPlatform(true);
|
|
setSize(320, 240);
|
|
setVisible(true);
|
|
setVisible(false);
|
|
|
|
String s = "This is a standard English sentence.";
|
|
RichTextPane.Builder b = new RichTextPane.Builder();
|
|
for (String word: s.split(" ")) b = b.text(word).spacer(" ");
|
|
List<RichTextPane.Segment> text = b.finish();
|
|
FontMetrics fm = display.getFontMetrics(display.getFont());
|
|
RichTextPane.layout(text, fm, display.getWidth());
|
|
display.setText(text);
|
|
}
|
|
|
|
} |