|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--com.zfqjava.swing.JLineBar
JLineBar provides a bar represents the line number of
the text component.
Client Property:
| Name | Value | Default Value |
|---|---|---|
| JLineBar.showArrowIcon |
|
Boolean.FALSE |
| JLineBar.showLineNumber |
|
Boolean.TRUE |
| Inner Class Summary | |
protected class |
JLineBar.AccessibleJLineBar
This class implements accessibility support for the JLineBar class. |
| Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
| 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 | |
JLineBar()
Constructs a JLineBar. |
|
JLineBar(int lineCount)
Constructs a JLineBar with a specified line count. |
|
JLineBar(int lineCount,
javax.swing.ListSelectionModel selectionModel)
Constructs a JLineBar with a selection model and a
specified line count. |
|
JLineBar(javax.swing.ListSelectionModel selectionModel)
Constructs a JLineBar with a selection model. |
|
| Method Summary | |
void |
addListSelectionListener(javax.swing.event.ListSelectionListener listener)
Adds a listener to the list that's notified each time a change to the selection occurs. |
protected javax.swing.ListSelectionModel |
createSelectionModel()
Returns an instance of DefaultListSelectionModel. |
protected void |
fireSelectionValueChanged(int firstIndex,
int lastIndex,
boolean isAdjusting)
Notifies JLineBar ListSelectionListeners that
the selection model has changed. |
javax.accessibility.AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this JLineBar. |
int |
getFirstLineIndex()
Returns the first line index, the default is 0. |
java.awt.Component |
getForComponent()
Returns the component that the JLineBar attach. |
java.awt.Rectangle |
getHeaderRect(int line)
Returns the rectangle containing the header tile at line. |
javax.swing.Icon |
getIconAt(int lineno)
Returns the icon at the specify line. |
int |
getLineCount()
Gets the current line count number. |
int |
getLineHeight()
Returns the line height. |
int |
getLineHeight(int lineno)
Returns the line height for the specified line number |
int |
getLineWidth()
Returns the line width. |
javax.swing.event.ListSelectionListener[] |
getListSelectionListeners()
Returns an array of all the ListSelectionListeners added
to this JLineBar with addListSelectionListener(). |
java.awt.Dimension |
getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for a view component. |
boolean |
getResizingAllowed()
Returns true if the user is allowed to resize rows by dragging between their headers, false otherwise. |
int |
getResizingLine()
Returns the resizing line. |
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns, depending on the value of orientation. |
boolean |
getScrollableTracksViewportHeight()
Return true if a viewport should always force the height of this Scrollable to match the height of the viewport. |
boolean |
getScrollableTracksViewportWidth()
Return true if a viewport should always force the width of this Scrollable to match the width of the viewport. |
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation. |
int |
getSelectedLine()
Returns the selected line number. |
int[] |
getSelectedLines()
Returns the selected lines number array. |
int |
getSelectionMode()
Returns whether single-item or multiple-item selections are allowed. |
javax.swing.ListSelectionModel |
getSelectionModel()
Returns the value of the current selection model. |
LineBarUI |
getUI()
Returns the look and feel (L&F) object that renders this component. |
java.lang.String |
getUIClassID()
Returns a string that specifies the name of the L&F class that renders this component. |
boolean |
isFixedLineHeight()
Determines the JLineBar has a fixed line height. |
protected java.lang.String |
paramString()
Returns a string representation of this JLineBar. |
void |
removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
Removes a listener from the list that's notified each time a change to the selection occurs. |
void |
revalidate()
|
void |
setFirstLineIndex(int firstLineIndex)
Sets the first line index, the default is 0. |
void |
setForComponent(java.awt.Component c)
Sets the component that the JLineBar attach. |
void |
setIconAt(javax.swing.Icon icon,
int lineno)
Sets the icon at the specify line. |
void |
setLineCount(int lineCount)
Sets the current line count number. |
void |
setLineHeight(int lineHeight)
Sets the line height. |
void |
setLineHeight(int lineno,
int lineHeight)
Sets the line height for the specified line number. |
void |
setLineWidth(int lineWidth)
Sets the line width. |
void |
setResizingAllowed(boolean resizingAllowed)
Sets whether the user can resize rows by dragging between headers. |
void |
setResizingLine(int line)
Sets the resizing line. |
void |
setSelectedLine(int lineno)
Sets the selected line number. |
void |
setSelectedLines(int[] lines)
Sets the selected lines number array. |
void |
setSelectionMode(int selectionMode)
Determines whether single-item or multiple-item selections are allowed. |
void |
setSelectionModel(javax.swing.ListSelectionModel selectionModel)
Sets the selectionModel for the list to a
non-null ListSelectionModel
implementation. |
void |
setUI(LineBarUI ui)
Sets the look and feel (L&F) object that renders this component. |
void |
updateUI()
Resets the UI property with a value from the current look and feel. |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public JLineBar()
JLineBar.JLineBar()public JLineBar(int lineCount)
JLineBar with a specified line count.lineCount - a specified line countJLineBar()public JLineBar(javax.swing.ListSelectionModel selectionModel)
JLineBar with a selection model.selectionModel - a selection modelJLineBar()
public JLineBar(int lineCount,
javax.swing.ListSelectionModel selectionModel)
JLineBar with a selection model and a
specified line count.lineCount - a specified line countselectionModel - a selection modelJLineBar()| Method Detail |
public void updateUI()
updateUI in class javax.swing.JComponentJComponent.updateUI()public LineBarUI getUI()
public void setUI(LineBarUI ui)
ui - the LineBarUI L&F objectUIDefaults.getUI(javax.swing.JComponent)public java.lang.String getUIClassID()
getUIClassID in class javax.swing.JComponentJComponent.getUIClassID(),
UIDefaults.getUI(javax.swing.JComponent)protected javax.swing.ListSelectionModel createSelectionModel()
DefaultListSelectionModel. This
method is used by the constructor to initialize the
selectionModel property.ListSelectionModel used by this
JList.setSelectionModel(javax.swing.ListSelectionModel),
DefaultListSelectionModelpublic javax.swing.ListSelectionModel getSelectionModel()
ListSelectionModel that implements
list selectionssetSelectionModel(javax.swing.ListSelectionModel),
ListSelectionModelpublic void setSelectionModel(javax.swing.ListSelectionModel selectionModel)
selectionModel for the list to a
non-null ListSelectionModel
implementation. The selection model handles the task of making single
selections, selections of contiguous ranges, and non-contiguous
selections.
This is a JavaBeans bound property.
selectionModel - the ListSelectionModel that
implements the selectionsjava.lang.IllegalArgumentException - if selectionModel
is nullgetSelectionModel()public void setSelectionMode(int selectionMode)
selectionMode values are allowed:
ListSelectionModel.SINGLE_SELECTION
Only one list index can be selected at a time. In this
mode the setSelectionInterval and
addSelectionInterval
methods are equivalent, and only the second index
argument is used.
ListSelectionModel.SINGLE_INTERVAL_SELECTION
One contiguous index interval can be selected at a time.
In this mode setSelectionInterval and
addSelectionInterval
are equivalent.
ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
In this mode, there's no restriction on what can be selected.
This is the default.
selectionMode - an integer specifying the type of selections
that are permissiblegetSelectionMode()public int getSelectionMode()
selectionMode propertysetSelectionMode(int)public void setResizingAllowed(boolean resizingAllowed)
resizingAllowed - true if table view should allow
resizinggetResizingAllowed()public boolean getResizingAllowed()
resizingAllowed propertysetResizingAllowed(boolean)public void setResizingLine(int line)
line - the line being resizinggetResizingLine()public int getResizingLine()
setResizingLine(int)public void setForComponent(java.awt.Component c)
JLineBar attach.c - the component to attachgetForComponent()public java.awt.Component getForComponent()
JLineBar attach.setForComponent(java.awt.Component)public void setFirstLineIndex(int firstLineIndex)
firstLineIndex - the first line indexgetFirstLineIndex()public int getFirstLineIndex()
setFirstLineIndex(int)public int getSelectedLine()
setSelectedLine(int)public void setSelectedLine(int lineno)
lineno - the line number to selectgetSelectedLine()public int[] getSelectedLines()
setSelectedLines(int[])public void setSelectedLines(int[] lines)
lines - the lines number array to selectgetSelectedLines()public int getLineCount()
setLineCount(int)public void setLineCount(int lineCount)
count - the line count to selectgetLineCount()public void setLineHeight(int lineHeight)
lineHeight - the line heightgetLineHeight()public int getLineHeight()
setLineHeight(int)
public void setLineHeight(int lineno,
int lineHeight)
lineno - the specified line numberlineHeight - the line heightsetLineHeight(int),
getLineHeight(int),
getLineHeight()public int getLineHeight(int lineno)
lineno - the specified line numbersetLineHeight(int,int),
setLineHeight(int),
setLineHeight(int)public void revalidate()
revalidate in class javax.swing.JComponentpublic boolean isFixedLineHeight()
JLineBar has a fixed line height.JLineBar has a fixed line height,
false otherwisepublic void setLineWidth(int lineWidth)
lineWidth - the line widthgetLineWidth()public int getLineWidth()
setLineWidth(int)public java.awt.Rectangle getHeaderRect(int line)
line.
When the line parameter is out of bounds this method uses the
same conventions as the JTable method getCellRect.lineJTable.getCellRect(int, int, boolean)
public void setIconAt(javax.swing.Icon icon,
int lineno)
icon - the icon to set at the line barlineno - the line number that the icon to setgetIconAt(int)public javax.swing.Icon getIconAt(int lineno)
lineno - the line number that the icon to setsetIconAt(javax.swing.Icon, int)
protected void fireSelectionValueChanged(int firstIndex,
int lastIndex,
boolean isAdjusting)
JLineBar ListSelectionListeners that
the selection model has changed. It's used to forward
ListSelectionEvents from the selectionModel
to the ListSelectionListeners added directly to the
JLineBar.firstIndex - the first selected indexlastIndex - the last selected indexisAdjusting - true if multiple changes are being madeaddListSelectionListener(javax.swing.event.ListSelectionListener),
removeListSelectionListener(javax.swing.event.ListSelectionListener),
EventListenerListpublic void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
JLineBar
will have their ListSelectionEvent.getSource() ==
this JLineBar
(instead of the ListSelectionModel).listener - the ListSelectionListener to addgetSelectionModel(),
getListSelectionListeners()public void removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
listener - the ListSelectionListener to removeaddListSelectionListener(javax.swing.event.ListSelectionListener),
getSelectionModel()public javax.swing.event.ListSelectionListener[] getListSelectionListeners()
ListSelectionListeners added
to this JLineBar with addListSelectionListener().ListSelectionListeners added or an empty
array if no listeners have been addedaddListSelectionListener(javax.swing.event.ListSelectionListener)public java.awt.Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize in interface javax.swing.ScrollableJComponent.getPreferredSize()
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Scrolling containers, like JScrollPane, will use this method each time the user requests a unit scroll.
getScrollableUnitIncrement in interface javax.swing.ScrollablevisibleRect - The view area visible within the viewportorientation - Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.direction - Less than zero to scroll up/left, greater than zero for down/right.JScrollBar.setUnitIncrement(int)
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Scrolling containers, like JScrollPane, will use this method each time the user requests a block scroll.
getScrollableBlockIncrement in interface javax.swing.ScrollablevisibleRect - The view area visible within the viewportorientation - Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.direction - Less than zero to scroll up/left, greater than zero for down/right.JScrollBar.setBlockIncrement(int)public boolean getScrollableTracksViewportWidth()
Scrollable to match the width of the viewport.
For example a normal
text view that supported line wrapping would return true here, since it
would be undesirable for wrapped lines to disappear beyond the right
edge of the viewport. Note that returning true for a Scrollable
whose ancestor is a JScrollPane effectively disables horizontal
scrolling.
Scrolling containers, like JViewport, will use this method each time they are validated.
getScrollableTracksViewportWidth in interface javax.swing.Scrollablepublic boolean getScrollableTracksViewportHeight()
Scrolling containers, like JViewport, will use this method each time they are validated.
getScrollableTracksViewportHeight in interface javax.swing.Scrollableprotected java.lang.String paramString()
null.paramString in class javax.swing.JComponentpublic javax.accessibility.AccessibleContext getAccessibleContext()
getAccessibleContext in interface javax.accessibility.AccessiblegetAccessibleContext in class javax.swing.JComponent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||