biskuteri-cafe-JKomasto2/TestWindow.java
Snowyfox 7ede5e1290 Added buggy rich text pane.
Added rendering of emojis.
Added run script.
2022-04-15 08:54:31 -04:00

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);
}
}