working on integration of new text editor with coloring

This commit is contained in:
benfry
2002-10-21 05:49:10 +00:00
parent 534ca955cd
commit 3e96229b66
3 changed files with 1100 additions and 3 deletions

View File

@@ -781,9 +781,32 @@ public class PdeBase implements ActionListener {
Integer.parseInt(st.nextToken()));
}
//static public boolean isMacintosh() {
//return System.getProperty("os.name").toLowerCase().indexOf("mac") != -1;
//}
static public SimpleAttributeSet getStyle(String what,
SimpleAttributeSet otherwise) {
String str = get("editor.program." + which + ".style");
if (str == null) return otherwise; // ENABLE LATER
StringTokenizer st = new StringTokenizer(str, ",");
SimpleAttributeSet style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, st.nextToken());
String s = st.nextToken();
StyleConstants.setBold(style, s.indexOf("bold") != -1);
StyleConstants.setItalic(style, s.indexOf("italic") != -1);
StyleConstants.setSize(style, Integer.parseInt(st.nextToken()));
s = st.nextToken();
if (s.indexOf("#") == 0) s = s.substring(1);
StyleConstants.setForeground(style, new Color(Integer.parseInt(s, 16)));
s = st.nextToken();
if (s.indexOf("#") == 0) s = s.substring(1);
StyleConstants.setBackground(style, new Color(Integer.parseInt(s, 16)));
return style;
}
// used by PdeEditorButtons, but probably more later