|
|||||||||
| Home >> All >> com >> eireneh >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.eireneh.swing
Class DeckLayout

java.lang.Objectcom.eireneh.swing.AbstractLayout
com.eireneh.swing.DeckLayout
- All Implemented Interfaces:
- java.awt.LayoutManager, java.awt.LayoutManager2, java.io.Serializable
- public class DeckLayout
- extends AbstractLayout
- implements java.awt.LayoutManager2, java.io.Serializable
- extends AbstractLayout
DeckLayout is very similar to the awt CardLayout, except the latter is supposed to have some focus problems. I've not come across these before, and DeckLayout seems to be broken anyway, so I don't use it at all.
DeckLayout treats each component in the container as a card. Only one card is visible at a time, and the container acts like a deck of cards. The ordering of cards is determined by the container's own internal ordering of its component objects. DeckLayout defines a set of methods that allow an application to flip through the cards sequentially, or to show a specified card. The addLayoutComponent method can be used to associate a string identifier with a given card for faster random access.
|
Distribution Licence: Project B is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The License is available on the internet here, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below. The copyright to this program is held by it's authors. |
| Field Summary | |
protected int |
count
|
protected java.util.Hashtable |
tab
|
protected boolean |
wrap
|
| Fields inherited from class com.eireneh.swing.AbstractLayout |
hgap, vgap |
| Constructor Summary | |
DeckLayout()
|
|
DeckLayout(boolean wrap)
|
|
DeckLayout(int hgap,
int vgap)
|
|
DeckLayout(int hgap,
int vgap,
boolean wrap)
|
|
| Method Summary | |
void |
addLayoutComponent(java.awt.Component comp,
java.lang.Object constraints)
Adds the specified component to this deck layout's internal table, by name. |
private void |
checkLayout(java.awt.Container parent)
Make sure that the Container really has this layout installed, to avoid serious problems. |
void |
first(java.awt.Container parent)
Flips to the first card of the container. |
java.awt.Component |
getComponent(java.lang.String name)
|
int |
getIndex(java.awt.Container parent,
java.lang.String name)
|
java.lang.String |
getName(java.awt.Container parent,
int index)
|
void |
last(java.awt.Container parent)
Flips to the last card of the container. |
void |
layoutContainer(java.awt.Container parent)
Lays out the specified container using this deck layout. |
java.awt.Dimension |
minimumLayoutSize(java.awt.Container parent)
Calculates the minimum size for the specified panel. |
int |
next(java.awt.Container parent)
Flips to the next card of the specified container. |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container parent)
Calculates the preferred size for the specified panel. |
int |
previous(java.awt.Container parent)
Flips to the previous card of the specified container. |
void |
removeLayoutComponent(java.awt.Component comp)
Removes the specified component from the layout. |
private void |
setActive(java.awt.Component comp,
boolean enabled)
Enable or disable the specified component and all its children. |
void |
show(java.awt.Container parent,
int index)
Flips to the component at the numbered position. |
void |
show(java.awt.Container parent,
java.lang.String name)
Flips to the component that was added to this layout using the specified name. |
| Methods inherited from class com.eireneh.swing.AbstractLayout |
addLayoutComponent, getHgap, getLayoutAlignmentX, getLayoutAlignmentY, getVgap, invalidateLayout, maximumLayoutSize, setHgap, setVgap, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.awt.LayoutManager2 |
getLayoutAlignmentX, getLayoutAlignmentY, invalidateLayout, maximumLayoutSize |
| Methods inherited from interface java.awt.LayoutManager |
addLayoutComponent |
| Field Detail |
tab
protected java.util.Hashtable tab
count
protected int count
wrap
protected boolean wrap
| Constructor Detail |
DeckLayout
public DeckLayout()
DeckLayout
public DeckLayout(boolean wrap)
DeckLayout
public DeckLayout(int hgap,
int vgap)
DeckLayout
public DeckLayout(int hgap,
int vgap,
boolean wrap)
| Method Detail |
addLayoutComponent
public void addLayoutComponent(java.awt.Component comp, java.lang.Object constraints)
- Adds the specified component to this deck layout's internal
table, by name. The object specified by constraints must be
a string. The deck layout stores this string as a key-value
pair that can be used for random access to a particular card.
By calling the show method, an application can display the
component with the specified name.
- Specified by:
addLayoutComponentin interfacejava.awt.LayoutManager2- Overrides:
addLayoutComponentin classAbstractLayout
removeLayoutComponent
public void removeLayoutComponent(java.awt.Component comp)
- Removes the specified component from the layout.
- Specified by:
removeLayoutComponentin interfacejava.awt.LayoutManager- Overrides:
removeLayoutComponentin classAbstractLayout
preferredLayoutSize
public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
- Calculates the preferred size for the specified panel.
- Specified by:
preferredLayoutSizein interfacejava.awt.LayoutManager
minimumLayoutSize
public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
- Calculates the minimum size for the specified panel.
- Specified by:
minimumLayoutSizein interfacejava.awt.LayoutManager
layoutContainer
public void layoutContainer(java.awt.Container parent)
- Lays out the specified container using this deck layout.
Each component in the parent container is reshaped to be
the same size as the container, minus insets, horizontal
and vertical gaps.
- Specified by:
layoutContainerin interfacejava.awt.LayoutManager
checkLayout
private void checkLayout(java.awt.Container parent)
- Make sure that the Container really has this layout installed,
to avoid serious problems.
setActive
private void setActive(java.awt.Component comp, boolean enabled)
- Enable or disable the specified component and all its children.
This makes focus traversal function properly. The side effect
is that all children are enabled or disabled and specific
contexts are not maintained. You can get around this by
intercepting setEnabled in your component to restore state
if this is important in your context.
first
public void first(java.awt.Container parent)
- Flips to the first card of the container.
next
public int next(java.awt.Container parent)
- Flips to the next card of the specified container. If the
currently visible card is the last one, this method flips
to the first card in the layout.
previous
public int previous(java.awt.Container parent)
- Flips to the previous card of the specified container. If the
currently visible card is the first one, this method flips to
the last card in the layout.
last
public void last(java.awt.Container parent)
- Flips to the last card of the container.
show
public void show(java.awt.Container parent, java.lang.String name)
- Flips to the component that was added to this layout using
the specified name. If no such component exists, nothing happens.
show
public void show(java.awt.Container parent, int index)
- Flips to the component at the numbered position. If no such
component exists, nothing happens.
getComponent
public java.awt.Component getComponent(java.lang.String name)
getName
public java.lang.String getName(java.awt.Container parent, int index)
getIndex
public int getIndex(java.awt.Container parent, java.lang.String name)
|
|||||||||
| Home >> All >> com >> eireneh >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC