Warning: session_start(): open(/var/lib/php/sessions/sess_fjj3kaek92ii6js9kg8ct2cfs9, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// textAndColors = a list of Color objects and strings
// Note: This functions changes the BACKGROUND colors
// (not the text, which remains black).
static JTextPane showColoredText(L textAndColors) {
ret showColoredText(textAndColors, "Colored Text");
}
static JTextPane showColoredText(L textAndColors, S title) {
JFrame jf = new JFrame(title);
Container cp = jf.getContentPane();
new JTextPane pane;
showColoredText_fillPane(pane, textAndColors);
cp.add(new JScrollPane(pane), BorderLayout.CENTER);
jf.setSize(500, 600);
centerFrame(jf);
jf.setVisible(true);
ret pane;
}
static void showColoredText_fillPane(JTextPane pane, L textAndColors) {
pane.setText("");
Color color = Color.white;
for (O x : textAndColors) {
if (x instanceof Color)
color = (Color) x;
else
showColoredText_appendToTextPane(pane, color, String.valueOf(x));
}
}
static void showColoredText(JTextPane pane, L textAndColors) {
showColoredText_fillPane(pane, textAndColors);
}
static void showColoredText_appendToTextPane(JTextPane pane, Color color, S text) ctex {
Document doc = pane.getStyledDocument();
SimpleAttributeSet set = new SimpleAttributeSet();
StyleConstants.setFontFamily(set, "Courier");
StyleConstants.setBold(set, true);
StyleConstants.setFontSize(set, 14);
StyleConstants.setBackground(set, color);
doc.insertString(doc.getLength(), text, set);
}