From 1b18e662294398ef7cfd387c3614cfe47e2aba4f Mon Sep 17 00:00:00 2001 From: benfry Date: Tue, 19 Nov 2002 23:05:37 +0000 Subject: [PATCH] working on a standard style based on old font stuff --- processing/app/PdeBase.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/processing/app/PdeBase.java b/processing/app/PdeBase.java index 07c0fe477..52d6975bc 100644 --- a/processing/app/PdeBase.java +++ b/processing/app/PdeBase.java @@ -998,6 +998,28 @@ public class PdeBase extends Frame implements ActionListener { Integer.parseInt(st.nextToken())); } + // return a default style, based on old conventions + static public SimpleAttributeSet getStyle() { + + StyleConstants.setFontFamily(style, st.nextToken()); + + String s = st.nextToken(); + StyleConstants.setBold(style, s.indexOf("bold") != -1); + StyleConstants.setItalic(style, s.indexOf("italic") != -1); + + StyleConstants.setFontSize(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; + } + static public SimpleAttributeSet getStyle(String what, SimpleAttributeSet otherwise) { String str = get("editor.program." + what + ".style");