01: /*
02: * $Id: Util.java 6077 2006-01-23 05:21:52Z dfs $
03: *
04: * Copyright 2004-2006 Daniel F. Savarese
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.savarese.org/software/ApacheLicense-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: package org.savarese.unicorn.ui;
20:
21: import java.awt.*;
22: import javax.swing.*;
23: import javax.swing.border.*;
24:
25: final class Util {
26:
27: private Util() {
28: }
29:
30: static JPanel _makePanel(String title, Color titleColor) {
31: JPanel panel = new JPanel();
32: TitledBorder border = BorderFactory
33: .createTitledBorder(BorderFactory
34: .createEtchedBorder(EtchedBorder.LOWERED));
35: border.setTitle(title);
36: if (titleColor != null)
37: border.setTitleColor(titleColor);
38: panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
39: panel.setBorder(border);
40: panel.setAlignmentX(Component.LEFT_ALIGNMENT);
41: panel.setMaximumSize(new Dimension(Short.MAX_VALUE,
42: Short.MAX_VALUE));
43:
44: return panel;
45: }
46:
47: static JPanel _makePanel(String title) {
48: return _makePanel(title, null);
49: }
50: }
|