Source code: org/pqt/autorib/rib/RIBColor.java
1 //AutoRIB
2 // Copyright © 1998 - 2002, P W Quint
3 //
4 // Contact: autorib00@aol.com
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public
8 // License as published by the Free Software Foundation; either
9 // version 2 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 package org.pqt.autorib.rib;
21
22 import java.util.*;
23 import java.io.*;
24
25 import org.pqt.autorib.tokenizer.*;
26 import org.pqt.autorib.globals.*;
27 import org.pqt.autorib.util.*;
28
29 public class RIBColor extends RIBRequest
30 {
31 public Color color;
32
33 public RIBColor() {}
34
35 public RIBColor(Tokenizer in) throws FormatException, IOException
36 {
37 read(in);
38 }
39
40 public void read(Tokenizer in) throws FormatException, IOException
41 {
42 readRequestName(in);
43 Vector v = in.getArray();
44 try { color = new Color(v); }
45 catch (Exception e) { throw new FormatException("Incorrect color format",
46 in); }
47 }
48
49
50 public void writeOther(Writer out) throws IOException
51 {
52 Token.write(out,'[' + color.toString() + "] ");
53 }
54
55
56 }