01: /*
02: * @(#)ContentContainer.java 5/5/2005
03: *
04: * Copyright 2002 - 2005 JIDE Software Inc. All rights reserved.
05: */
06: package com.jidesoft.swing;
07:
08: import com.jidesoft.plaf.LookAndFeelFactory;
09: import com.jidesoft.plaf.UIDefaultsLookup;
10: import com.jidesoft.plaf.basic.ThemePainter;
11:
12: import javax.swing.*;
13: import java.awt.*;
14:
15: /**
16: * In JIDE Action Framework, <code>ContentContainer</code> is the area that contains all command bars.
17: * It is also the largest area in the content pane of top level windows.
18: * <p/>
19: * <code>ContentContainer</code> uses BasicPainter to paint the background.
20: * For example, under Office 2003 L&F, it will use gradient to paint the background.
21: */
22: public class ContentContainer extends JPanel {
23: private ThemePainter _painter;
24:
25: /**
26: * Creates a new <code>JPanel</code> with a double buffer
27: * and a flow layout.
28: */
29: public ContentContainer() {
30: setBorder(BorderFactory.createEmptyBorder());
31: updateUI();
32: }
33:
34: @Override
35: public void updateUI() {
36: super .updateUI();
37: if (UIDefaultsLookup.get("Theme.painter") == null) {
38: LookAndFeelFactory.installJideExtension();
39: }
40: _painter = (ThemePainter) UIDefaultsLookup.get("Theme.painter");
41: }
42:
43: @Override
44: protected void paintComponent(Graphics g) {
45: if (_painter != null) {
46: _painter.paintContentBackground(this , g, new Rectangle(0,
47: 0, getWidth(), getHeight()),
48: SwingConstants.HORIZONTAL,
49: ThemePainter.STATE_DEFAULT);
50: }
51: }
52: }
|