|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel uic.widgets.ToolBarContainer
This ToolBarContainer is a Container that allows a number of Toolbars to be present at a certain side of the screen. The Swing Tutorials describe ways to add only one Toolbar per side of the screen, and its quite hard to actually add a toolbar correctly, this class is suppost to make it easy. The simplest way of using the container is like this:
JFrame myFrame = new JFrame(); ToolBarContainer top = new ToolBarContainer(myFrame, SwingConstants.TOP); JToolBar fileTools = new JToolBar("File"); // add some buttons to the fileTools toolbar. top.add(fileTools);Note that at any time you can still add another toolbar to the container:
JToolBar projectTools = new JToolBar("Project"); // add some buttons to the projectTools toolbar. top.add(projectTools);
Known issue: due to the nature of Toolbars in Swing the usage of this container stops a toolbar being able to be 'dragged' from one side of the window to another if you do not use the accompanied UICTheme in your application.
Nested Class Summary |
Nested classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
ToolBarContainer()
It is legal; but not advisable to create a ToolBarContainer by yourself, use the placeToolBarOnWindow factory method instead. |
|
ToolBarContainer(int placing)
It is legal; but not advisable to create a ToolBarContainer by yourself, use the placeToolBarOnWindow factory method instead. |
|
ToolBarContainer(Window parent,
int placing)
It is legal; but not advisable to create a ToolBarContainer by yourself, use the placeToolBarOnWindow factory method instead. |
Method Summary | |
Component |
add(Component child)
Overloaded method, look at Container |
Component |
add(Component child,
int index)
Overloaded method, look at Container |
void |
add(Component child,
Object contraints)
Overloaded method, look at Container |
boolean |
canDrop(Point screenCoordinate,
boolean paintDropLocation)
find out if a toolbar at screenCoordinate is 'over' us and the user intends to drop it on us. |
protected JToolBar |
createToolBar(Component widget,
String name)
rotate and/or wrap the widget in a toolbar (if not a toolbar allready) |
Dimension |
getMinimumSize()
Make it always 1 pixel width and hight. |
int |
getPlacing()
Each ToolBarLayouter is placed on a Window-edge. |
Dimension |
getPreferredSize()
Work around bug that borderlayout does not honor minimumSize. |
boolean |
isHorizontal()
Shorthand 'orientation' method. |
void |
paint(Graphics g)
Draw seperators. |
static JToolBar |
placeToolBarOnWindow(Container widget,
MainWindow window)
Add a toolbar to the mainwindow |
static JToolBar |
placeToolBarOnWindow(Container widget,
MainWindow window,
int placing)
Add a toolbar to the mainwindow |
static JToolBar |
placeToolBarOnWindow(Container widget,
MainWindow window,
String name)
Add a toolbar to the mainwindow |
static JToolBar |
placeToolBarOnWindow(Container widget,
MainWindow window,
String name,
int placing)
|
static JToolBar |
placeToolBarOnWindow(Container widget,
Window window)
|
static JToolBar |
placeToolBarOnWindow(Container widget,
Window window,
int placing)
|
static JToolBar |
placeToolBarOnWindow(Container widget,
Window window,
String name)
|
static JToolBar |
placeToolBarOnWindow(Container widget,
Window window,
String name,
int placing)
builder method to put a toolbar on a Window; note that both JFrame and JDialog are Windows. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ToolBarContainer()
public ToolBarContainer(int placing)
placing
- from the box-tyoe SwingConstants (top/bottom etc).public ToolBarContainer(Window parent, int placing)
placing
- from the box-tyoe SwingConstants (top/bottom etc).parent
- the containing window where the container should be added to.Method Detail |
public Component add(Component child)
public Component add(Component child, int index)
public void add(Component child, Object contraints)
public boolean isHorizontal()
public int getPlacing()
protected JToolBar createToolBar(Component widget, String name)
public void paint(Graphics g)
public boolean canDrop(Point screenCoordinate, boolean paintDropLocation)
screenCoordinate
- the point where the users-pointer ispaintDropLocation
- if true will give graphical feedback on where exactly the toolbar will be droppedpublic static JToolBar placeToolBarOnWindow(Container widget, Window window, String name)
public static JToolBar placeToolBarOnWindow(Container widget, Window window, int placing)
public static JToolBar placeToolBarOnWindow(Container widget, Window window)
public static JToolBar placeToolBarOnWindow(Container widget, MainWindow window, String name)
public static JToolBar placeToolBarOnWindow(Container widget, MainWindow window, int placing)
public static JToolBar placeToolBarOnWindow(Container widget, MainWindow window)
public static JToolBar placeToolBarOnWindow(Container widget, MainWindow window, String name, int placing)
public static JToolBar placeToolBarOnWindow(Container widget, Window window, String name, int placing)
widget
- the widget you want to place as a toolbar on the window; can be a toolbar but
also a simple widget that will then be placed in a toolbar.window
- the target Windowname
- of the toolbar.placing
- a direction from the UICToolBar on where the toolbar is to be placed.
One of LEFT/RIGHT/TOP/BOTTOM/FLAT/FLOATING/HIDDEN.
IllegalArgumentException
- when placing is an illegal value, or window is null.public Dimension getMinimumSize()
public Dimension getPreferredSize()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |