|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
javax.swing.JToggleButton
net.sf.latexdraw.ui.WidgetMiniToolbar
public class WidgetMiniToolbar
This class defines a button which displays a frame containing
others buttons; a kind of menu with buttons.
This file is part of LaTeXDraw
Copyright (c) 2005-2012 Arnaud BLOUIN
LaTeXDraw is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
any later version.
LaTeXDraw is distributed 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.
05/02/06
Nested Class Summary | |
---|---|
(package private) class |
WidgetMiniToolbar.ListToggleButtonAWTEventListener
|
(package private) class |
WidgetMiniToolbar.WindowWidgets
|
Nested classes/interfaces inherited from class javax.swing.JToggleButton |
---|
javax.swing.JToggleButton.AccessibleJToggleButton, javax.swing.JToggleButton.ToggleButtonModel |
Nested classes/interfaces inherited from class javax.swing.AbstractButton |
---|
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected WidgetMiniToolbar.WindowWidgets |
buttonsFrame
The frame which displays the toolbar |
protected java.awt.Component |
componentFocusOnClose
The component to give the focus when the toolbar is closed. |
protected SwingEventManager |
eventManager
The event manager that listens events produced by the list of toogle buttons. |
private static int |
HEIGHT_ICON
|
static int |
HEIGHT_TRIANGLE
The height of the triangle drawn in the button |
protected int |
location
Define the location of the panel of buttons. |
static int |
LOCATION_NORTH
The frame is at the north of the button. |
static int |
LOCATION_SOUTH
The frame is at the south of the button. |
private static long |
serialVersionUID
|
protected MToolBar |
toolbar
The toolbar which contains the buttons |
private static int |
TRIANGLE_GAP
|
private static int |
TRIANGLE_NB_POINT
|
private static int |
WIDTH_ICON
|
static int |
WIDTH_TRIANGLE
The width of the triangle drawn in the button |
Fields inherited from class javax.swing.AbstractButton |
---|
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY |
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 javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
WidgetMiniToolbar(javax.swing.JFrame frame,
javax.swing.Icon icon,
int locate,
java.awt.Component componentFocusOnClose)
The constructor using an icon. |
|
WidgetMiniToolbar(javax.swing.JFrame frame,
java.lang.String txt,
int locate,
java.awt.Component componentFocusOnClose)
The constructor using a text. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
|
java.awt.Component |
add(java.awt.Component comp)
|
void |
addComponent(java.awt.Component comp)
Adds a button to the toolbar of the listJToggleButton. |
void |
addSeparator()
Adds a separator to the toolbar. |
private void |
attachAddedComponent(java.awt.Component comp)
Attaches the given component to the event manager of the panel if it exists. |
boolean |
contains(java.lang.Object obj)
Tests if the given object is contained by the calling picker. |
protected javax.swing.ImageIcon |
createTriangleIcon()
|
void |
defineToolbarLocation()
Defines the position of the mini-toolbar. |
SwingEventManager |
getEventManager()
|
int |
getLocationButtonPanel()
|
Pickable |
getPickableAt(double x,
double y)
|
Picker |
getPickerAt(double x,
double y)
|
java.awt.geom.Point2D |
getRelativePoint(double x,
double y,
java.lang.Object o)
|
MToolBar |
getToolbar()
|
boolean |
hasEventManager()
|
protected void |
intializing(javax.swing.JFrame frame,
int locate)
Initialises the ListJToggleButton. |
boolean |
isContentVisible()
|
private static boolean |
isContentVisibleContainer(java.awt.Container cont)
|
protected void |
paintComponent(java.awt.Graphics g)
|
void |
paintTriangle(java.awt.Graphics g,
int width,
int height)
Paints the triangle icon in a graphic. |
void |
repaint()
|
void |
setButtonsFrameVisible(boolean visible)
Sets id the toolbar must be visible or not. |
void |
setIcon()
The icon of the button will be the red triangle. |
void |
setIcon(javax.swing.Icon defaultIcon)
|
void |
setLocation(int locat)
Sets the location of the mini toolbar. |
void |
setSelected(boolean sel)
|
void |
stateChanged(javax.swing.event.ChangeEvent e)
|
void |
updateSelected()
Sets the main button to selected or not following if a button is selected or not. |
void |
windowGainedFocus(java.awt.event.WindowEvent e)
|
void |
windowLostFocus(java.awt.event.WindowEvent e)
|
Methods inherited from class javax.swing.JToggleButton |
---|
getAccessibleContext, getUIClassID, paramString, updateUI |
Methods inherited from class javax.swing.AbstractButton |
---|
actionPropertyChanged, addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, configurePropertiesFromAction, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, removeNotify, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setEnabled, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
protected SwingEventManager eventManager
protected WidgetMiniToolbar.WindowWidgets buttonsFrame
protected MToolBar toolbar
public static final int WIDTH_TRIANGLE
public static final int HEIGHT_TRIANGLE
protected int location
protected java.awt.Component componentFocusOnClose
public static final int LOCATION_NORTH
public static final int LOCATION_SOUTH
private static final int WIDTH_ICON
private static final int HEIGHT_ICON
private static final int TRIANGLE_NB_POINT
private static final int TRIANGLE_GAP
Constructor Detail |
---|
public WidgetMiniToolbar(javax.swing.JFrame frame, java.lang.String txt, int locate, java.awt.Component componentFocusOnClose)
frame
- The main frame containing the ListJToggleButton.txt
- The text of the ListJToggleButton.locate
- The position of the mini toolbar.componentFocusOnClose
- The component to give the focus when the toolbar is closed. Can be null.public WidgetMiniToolbar(javax.swing.JFrame frame, javax.swing.Icon icon, int locate, java.awt.Component componentFocusOnClose)
icon
- The icon of the ListJToggleButton.locate
- The position of the mini toolbar.frame
- The main frame containing the ListJToggleButton.componentFocusOnClose
- The component to give the focus when the toolbar is closed. Can be null.Method Detail |
---|
protected void intializing(javax.swing.JFrame frame, int locate)
frame
- The main frame containing the ListJToggleButton.locate
- The position of the mini toolbar.public boolean isContentVisible()
private static boolean isContentVisibleContainer(java.awt.Container cont)
protected javax.swing.ImageIcon createTriangleIcon()
public void setLocation(int locat)
locat
- The position of the mini toolbar.
java.lang.IllegalArgumentException
- If the location is neither LOCATION_NORTH
nor LOCATION_SOUTH
.public void setSelected(boolean sel)
setSelected
in class javax.swing.AbstractButton
public void addSeparator()
public void addComponent(java.awt.Component comp)
comp
- The new button to add.public java.awt.Component add(java.awt.Component comp)
add
in class java.awt.Container
public void paintTriangle(java.awt.Graphics g, int width, int height)
g
- The graphic.width
- The width of the object.height
- The height of the object.protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public void defineToolbarLocation()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void setButtonsFrameVisible(boolean visible)
visible
- True: the toolbar will be visible.public void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged
in interface javax.swing.event.ChangeListener
public int getLocationButtonPanel()
public void updateSelected()
public void windowGainedFocus(java.awt.event.WindowEvent e)
windowGainedFocus
in interface java.awt.event.WindowFocusListener
public void windowLostFocus(java.awt.event.WindowEvent e)
windowLostFocus
in interface java.awt.event.WindowFocusListener
public void setIcon()
public void setIcon(javax.swing.Icon defaultIcon)
setIcon
in class javax.swing.AbstractButton
public boolean contains(java.lang.Object obj)
Picker
contains
in interface Picker
obj
- The object to test.
public Pickable getPickableAt(double x, double y)
getPickableAt
in interface Picker
x
- The x-coordinate of the position used to get the pickable object.y
- The y-coordinate of the position used to get the pickable object.
public Picker getPickerAt(double x, double y)
getPickerAt
in interface Picker
x
- The x-coordinate of the position used to get the picker object.y
- The y-coordinate of the position used to get the picker object.
public java.awt.geom.Point2D getRelativePoint(double x, double y, java.lang.Object o)
getRelativePoint
in interface Picker
x
- The x-coordinate of the position to convert.y
- The y-coordinate of the position to convert.o
- An object contained by the calling picker. This function will computed the real position of the given
point in o
.
o1
that contains an other object o2
at position (10, 10)
. o1.getRelativePoint(30, 30, o2)
will return (20, 20)
.private void attachAddedComponent(java.awt.Component comp)
comp
- public boolean hasEventManager()
hasEventManager
in interface Eventable
public SwingEventManager getEventManager()
getEventManager
in interface Eventable
public MToolBar getToolbar()
public void repaint()
repaint
in class java.awt.Component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |