01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: /**
18: * @author Dmitry A. Durnev
19: * @version $Revision$
20: */package org.apache.harmony.awt.theme;
21:
22: import java.awt.Dimension;
23: import java.awt.Graphics;
24: import java.awt.Insets;
25: import java.awt.Rectangle;
26: import java.awt.SystemColor;
27:
28: import org.apache.harmony.awt.state.TextComponentState;
29:
30: public class DefaultTextComponent extends DefaultStyle {
31:
32: public static void drawBackground(Graphics g, TextComponentState s) {
33: g.setColor(s.isEnabled() ? s.getBackground()
34: : SystemColor.control);
35: Rectangle client = s.getClient();
36: Dimension size = s.getSize();
37: g.fillRect(client.x, client.y, client.width, client.height);
38: Insets ins = s.getInsets();
39: int x = client.x + client.width;
40: int y = client.y + client.height;
41: int w = size.width - x;
42: int h = size.height - y;
43: // fill areas outside of client area &&
44: // scrollbars
45: g.fillRect(x, y, w, h);
46: g.fillRect(0, size.height - ins.bottom, size.width, ins.bottom);
47: g.fillRect(size.width - ins.right, 0, ins.right, size.height);
48:
49: DefaultButton.drawButtonFrame(g, new Rectangle(size), true);
50: }
51: }
|