public class Mosaic extends IPanel
For example, when the the view rectangle (in normalized coordinates) of a tile is set, perhaps while zooming or scrolling, then that tile's mosaic changes the view rectangles of any other tiles in the same row or column accordingly, so that they all zoom and scroll together.
A mosaic can also manage axes at the top, left, bottom, and/or right sides of its matrix of tiles. These axes annotate the adjacent tiles, and mosaic ensures that they too zoom and scroll consistent with any changes to the view rectangles of those tiles.
A mosaic also manages a horizontal scrollbar for each column and a vertical scrollbar for each row. The mosaic shows scrollbars for only those dimensions of view rectangles that are zoomed. In other words, scrollbars are visible and consume space only when they are needed.
Modifier and Type | Class and Description |
---|---|
static class |
Mosaic.AxesPlacement
Placement of axes.
|
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
Mosaic(int nrow,
int ncol,
java.util.Set<Mosaic.AxesPlacement> axesPlacement)
Constructs a mosaic with the specified number of rows and columns.
|
Modifier and Type | Method and Description |
---|---|
int |
countColumns()
Returns the number of columns of tiles in this mosaic.
|
int |
countRows()
Returns the number of rows of tiles in this mosaic.
|
void |
doLayout() |
java.awt.Dimension |
getMinimumSize() |
ModeManager |
getModeManager()
Gets the mode manager for this mosaic.
|
java.awt.Dimension |
getPreferredSize() |
Tile |
getTile(int irow,
int icol)
Gets the tile with specified row and column indices.
|
TileAxis |
getTileAxisBottom(int icol)
Gets the bottom tile axis with specified column index.
|
TileAxis |
getTileAxisLeft(int irow)
Gets the left tile axis with specified row index.
|
TileAxis |
getTileAxisRight(int irow)
Gets the right tile axis with specified row index.
|
TileAxis |
getTileAxisTop(int icol)
Gets the top tile axis with specified column index.
|
protected void |
paintComponent(java.awt.Graphics g) |
void |
paintToRect(java.awt.Graphics2D g2d,
int x,
int y,
int w,
int h)
Paints this panel to a specified rectangle of a graphics context.
|
void |
setBackground(java.awt.Color color) |
void |
setFont(java.awt.Font font) |
void |
setForeground(java.awt.Color color) |
void |
setHeightElastic(int irow,
int heightElastic)
Sets the height elastic for the specified row.
|
void |
setHeightMinimum(int irow,
int heightMinimum)
Sets the height minimum for the specified row.
|
void |
setModeManager(ModeManager modeManager)
Sets the mode manager for this mosaic.
|
void |
setWidthElastic(int icol,
int widthElastic)
Sets the width elastic for the specified column.
|
void |
setWidthMinimum(int icol,
int widthMinimum)
Sets the width minimum for the specified column.
|
void |
setWidthTileSpacing(int wts)
Sets the width in pixels of spacing between adjacent tiles.
|
computeScale, createGraphics, getLineWidth, paintToImage, paintToImage, paintToPng, scaleLineWidth
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, setLayout, transferFocusDownCycle, validate, validateTree
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, imageUpdate, 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, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public Mosaic(int nrow, int ncol, java.util.Set<Mosaic.AxesPlacement> axesPlacement)
nrow
- the number of rows.ncol
- the number of columns.axesPlacement
- the placement of axes.public void setModeManager(ModeManager modeManager)
modeManager
- the mode manager.public int countRows()
public int countColumns()
public Tile getTile(int irow, int icol)
irow
- the row index.icol
- the column index.public TileAxis getTileAxisTop(int icol)
icol
- the column index.public TileAxis getTileAxisLeft(int irow)
irow
- the row index.public TileAxis getTileAxisBottom(int icol)
icol
- the column index.public TileAxis getTileAxisRight(int irow)
irow
- the row index.public void setWidthMinimum(int icol, int widthMinimum)
icol
- the column index.widthMinimum
- the width minimum.public void setWidthElastic(int icol, int widthElastic)
icol
- the column index.widthElastic
- the width elastic.public void setHeightMinimum(int irow, int heightMinimum)
irow
- the row index.heightMinimum
- the height minimum.public void setHeightElastic(int irow, int heightElastic)
irow
- the row index.heightElastic
- the height elastic.public void setWidthTileSpacing(int wts)
wts
- the width of the inter-tile spacing.public ModeManager getModeManager()
public void setFont(java.awt.Font font)
setFont
in class javax.swing.JComponent
public void setForeground(java.awt.Color color)
setForeground
in class javax.swing.JComponent
public void setBackground(java.awt.Color color)
setBackground
in class javax.swing.JComponent
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public void doLayout()
doLayout
in class java.awt.Container
public void paintToRect(java.awt.Graphics2D g2d, int x, int y, int w, int h)
IPanel
Classes that extend this base class typically override this method to draw something besides children of this panel. When appropriate, those extensions may also call this method.
paintToRect
in class IPanel
g2d
- the graphics context.x
- the x-coordinate of the graphics rectangle.y
- the y-coordinate of the graphics rectangle.w
- the width of the graphics rectangle.h
- the height of the graphics rectangle.protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent