0N/A/*
2362N/A * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.swing.plaf.basic;
0N/A
0N/Aimport java.awt.*;
0N/Aimport javax.swing.*;
0N/Aimport javax.swing.border.*;
0N/Aimport javax.swing.plaf.*;
0N/Aimport java.awt.*;
0N/Aimport java.awt.event.*;
0N/A
0N/A
0N/A/**
0N/A * BasicPanel implementation
0N/A *
0N/A * @author Steve Wilson
0N/A */
0N/Apublic class BasicPanelUI extends PanelUI {
0N/A
0N/A // Shared UI object
0N/A private static PanelUI panelUI;
0N/A
0N/A public static ComponentUI createUI(JComponent c) {
0N/A if(panelUI == null) {
0N/A panelUI = new BasicPanelUI();
0N/A }
0N/A return panelUI;
0N/A }
0N/A
0N/A public void installUI(JComponent c) {
0N/A JPanel p = (JPanel)c;
0N/A super.installUI(p);
0N/A installDefaults(p);
0N/A }
0N/A
0N/A public void uninstallUI(JComponent c) {
0N/A JPanel p = (JPanel)c;
0N/A uninstallDefaults(p);
0N/A super.uninstallUI(c);
0N/A }
0N/A
0N/A protected void installDefaults(JPanel p) {
0N/A LookAndFeel.installColorsAndFont(p,
0N/A "Panel.background",
0N/A "Panel.foreground",
0N/A "Panel.font");
0N/A LookAndFeel.installBorder(p,"Panel.border");
0N/A LookAndFeel.installProperty(p, "opaque", Boolean.TRUE);
0N/A }
0N/A
0N/A protected void uninstallDefaults(JPanel p) {
0N/A LookAndFeel.uninstallBorder(p);
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Returns the baseline.
0N/A *
0N/A * @throws NullPointerException {@inheritDoc}
0N/A * @throws IllegalArgumentException {@inheritDoc}
0N/A * @see javax.swing.JComponent#getBaseline(int, int)
0N/A * @since 1.6
0N/A */
0N/A public int getBaseline(JComponent c, int width, int height) {
0N/A super.getBaseline(c, width, height);
0N/A Border border = c.getBorder();
0N/A if (border instanceof AbstractBorder) {
0N/A return ((AbstractBorder)border).getBaseline(c, width, height);
0N/A }
0N/A return -1;
0N/A }
0N/A
0N/A /**
0N/A * Returns an enum indicating how the baseline of the component
0N/A * changes as the size changes.
0N/A *
0N/A * @throws NullPointerException {@inheritDoc}
0N/A * @see javax.swing.JComponent#getBaseline(int, int)
0N/A * @since 1.6
0N/A */
0N/A public Component.BaselineResizeBehavior getBaselineResizeBehavior(
0N/A JComponent c) {
0N/A super.getBaselineResizeBehavior(c);
0N/A Border border = c.getBorder();
0N/A if (border instanceof AbstractBorder) {
0N/A return ((AbstractBorder)border).getBaselineResizeBehavior(c);
0N/A }
0N/A return Component.BaselineResizeBehavior.OTHER;
0N/A }
0N/A}