[14982] | 1 | /*
|
---|
| 2 | * Copyright 2005 Paul Hinds
|
---|
| 3 | *
|
---|
| 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
| 5 | * you may not use this file except in compliance with the License.
|
---|
| 6 | * You may obtain a copy of the License at
|
---|
| 7 | *
|
---|
| 8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 9 | *
|
---|
| 10 | * Unless required by applicable law or agreed to in writing, software
|
---|
| 11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 13 | * See the License for the specific language governing permissions and
|
---|
| 14 | * limitations under the License.
|
---|
| 15 | */
|
---|
| 16 | package org.tp23.antinstaller.renderer.swing;
|
---|
| 17 |
|
---|
| 18 | import java.awt.Dimension;
|
---|
| 19 |
|
---|
| 20 | import javax.swing.Action;
|
---|
| 21 | import javax.swing.Icon;
|
---|
| 22 | import javax.swing.JButton;
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | /**
|
---|
| 26 | * A JButton with altered prefered size to facilitate fixing the width
|
---|
| 27 | * but still using a GridBagLayout
|
---|
| 28 | * @author Paul Hinds
|
---|
| 29 | * @version $Id: AIButton.java,v 1.2 2006/12/09 15:26:09 teknopaul Exp $
|
---|
| 30 | */
|
---|
| 31 | public class AIButton extends JButton {
|
---|
| 32 |
|
---|
| 33 | public AIButton() {
|
---|
| 34 | super();
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public AIButton(String text) {
|
---|
| 38 | super(text);
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | public AIButton(Action a) {
|
---|
| 42 | super(a);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | public AIButton(Icon icon) {
|
---|
| 46 | super(icon);
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | public AIButton(String text, Icon icon) {
|
---|
| 50 | super(text, icon);
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | private Dimension prefSize = new Dimension(SizeConstants.BUTTON_WIDTH,
|
---|
| 54 | SizeConstants.FIELD_HEIGHT);
|
---|
| 55 |
|
---|
| 56 | public Dimension getMinimumSize() {
|
---|
| 57 | return prefSize;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | public Dimension getPreferredSize() {
|
---|
| 61 | return prefSize;
|
---|
| 62 | }
|
---|
| 63 | public void setOverflow(Dimension prefSize) {
|
---|
| 64 | this.prefSize = prefSize;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | public Dimension getMaximumSize() {
|
---|
| 68 | return prefSize;
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | } |
---|