01: /*
02: * Copyright (C) 2004 Nicky BRAMANTE
03: *
04: * This file is part of FreeQueryBuilder
05: *
06: * FreeQueryBuilder is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License
08: * as published by the Free Software Foundation; either version 2
09: * of the License, or (at your option) any later version.
10: *
11: * This program 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
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19: *
20: * Send questions or suggestions to nickyb@interfree.it
21: */
22:
23: package it.frb.admin;
24:
25: import java.awt.BorderLayout;
26: import java.awt.Component;
27: import java.awt.LayoutManager;
28:
29: public class DefaultPanel extends javax.swing.JPanel {
30: public DefaultPanel() {
31: this (0, 0);
32: }
33:
34: public DefaultPanel(int hgap, int vgap) {
35: super (new BorderLayout(hgap, vgap));
36: }
37:
38: public final void setLayout(LayoutManager mgr) {
39: if (!(mgr instanceof BorderLayout))
40: throw new IllegalArgumentException(
41: "this is a BorderLayout panel");
42:
43: super .setLayout(mgr);
44: }
45:
46: public final void add(Component comp, Object constraints) {
47: if (!(this .getLayout() instanceof BorderLayout))
48: super .setLayout(new BorderLayout());
49:
50: super .add(comp, constraints);
51: }
52:
53: public void setNorthComponent(Component comp) {
54: add(comp, BorderLayout.NORTH);
55: }
56:
57: public void setSouthComponent(Component comp) {
58: add(comp, BorderLayout.SOUTH);
59: }
60:
61: public void setCenterComponent(Component comp) {
62: add(comp, BorderLayout.CENTER);
63: }
64:
65: public void setEastComponent(Component comp) {
66: add(comp, BorderLayout.EAST);
67: }
68:
69: public void setWestComponent(Component comp) {
70: add(comp, BorderLayout.WEST);
71: }
72: }
|