GBPanel.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright (c) 2000 by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* Copyright (C) 1996 Active Software, Inc.
* All rights reserved.
*
* @(#) GBPanel.java 1.35 - last change made 06/17/97
*/
private boolean runtime = true;
private GBContainer cntr;
public GBPanel() {
}
else
return super.handleEvent(evt);
}
public void setRuntime(boolean rt) {
return;
if (runtime) {
} else {
try {
}
catch (IllegalAccessException ex) {
}
catch (InstantiationException ex) {
}
cntr.setGBPanel(this);
}
}
public GBContainer getGBContainer() {
return cntr;
}
//
// Special hack for flow layout so that it
// can re-adjust its vertical
// size based on the horizontal space available.
// This method is needed
// to make the flow layout take up more space
// vertically when it runs
// short on horizontal space.
//
public void layout() {
boolean hasFlow = false;
int count = countComponents();
for (int i = 0; i < count; i++) {
comp = getComponent(i);
if (mgr instanceof VJFlowLayout) {
hasFlow = true;
}
}
}
if (hasFlow) {
gridbag.layoutContainerNoReshape(this);
for (int i = 0; i < count; i++) {
comp = getComponent(i);
if (mgr instanceof VJFlowLayout) {
}
}
}
}
super.layout();
if (hasFlow) {
for (int i = 0; i < count; i++) {
comp = getComponent(i);
if (mgr instanceof VJFlowLayout) {
}
}
}
}
}
//
// Forwarding of container methods
//
else
updateLayout();
}
updateLayout();
}
private void updateLayout() {
LayoutManager m = getLayout();
if (m instanceof GBLayout)
else
}
// #ifdef JDK1.1
int index) {
}
// #else
// public Component add(Component comp, int pos) {
// super.add(comp, pos);
// doAdd(comp);
// return comp;
// }
// #endif
}
}
public void removeAll() {
super.removeAll();
}
g = getGraphics();
super.update(g);
}
g = getGraphics();
super.paint(g);
}
public void reshape(int x, int y, int w, int h) {
super.reshape(x, y, w, h);
}
//
// Layout and Preview modes
//
public void layoutMode() {
cntr.layoutMode();
}
public void previewMode() {
cntr.previewMode();
}
//
// Constraints
//
if (c == null)
/* JSTYLED */
}
else
return null;
}
//
// GBLayout attributes
//
public void setColumnWeights(double w[]) {
cntr.setColumnWeights(w);
mgr.columnWeights = w;
}
public void setRowWeights(double w[]) {
cntr.setRowWeights(w);
mgr.rowWeights = w;
}
public double [] getColumnWeights() {
return cntr.getColumnWeights();
return mgr.columnWeights;
else
return null;
}
public double [] getRowWeights() {
return cntr.getRowWeights();
return mgr.rowWeights;
else
return null;
}
public void setColumnWidths(int w[]) {
cntr.setColumnWidths(w);
mgr.columnWidths = w;
}
public void setRowHeights(int h[]) {
cntr.setRowHeights(h);
mgr.rowHeights = h;
}
public int[] getColumnWidths() {
return cntr.getColumnWidths();
return mgr.columnWidths;
else
return null;
}
public int[] getRowHeights() {
return cntr.getRowHeights();
return mgr.rowHeights;
else
return null;
}
}