|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.TransferHandler org.fife.ui.TabbedPaneTransferHandler
public class TabbedPaneTransferHandler
A transfer handler for JTabbedPane
s. This handler can move tabs
between tabbed panes, as well as move the position of tabs within a tabbed
pane.
If the tabbed pane receiving the drop implements the
DrawDnDIndicatorTabbedPane
interface, it will be sent a
rectangle that it can paint to signify where the dropped tab will be placed.
DrawDnDIndicatorTabbedPane
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.TransferHandler |
---|
javax.swing.TransferHandler.DropLocation, javax.swing.TransferHandler.TransferSupport |
Field Summary | |
---|---|
protected java.awt.Point |
mouseLocation
The location of the mouse cursor throughout the drag-and-drop. |
Fields inherited from class javax.swing.TransferHandler |
---|
COPY, COPY_OR_MOVE, LINK, MOVE, NONE |
Constructor Summary | |
---|---|
TabbedPaneTransferHandler()
Constructor. |
Method Summary | |
---|---|
boolean |
canImport(javax.swing.JComponent c,
java.awt.datatransfer.DataFlavor[] flavors)
Overridden to include a check for a TabData flavor. |
protected java.awt.datatransfer.Transferable |
createTransferable(javax.swing.JComponent c)
|
void |
dragEnter(java.awt.dnd.DropTargetDragEvent e)
|
void |
dragExit(java.awt.dnd.DropTargetEvent e)
|
void |
dragOver(java.awt.dnd.DropTargetDragEvent e)
Called when a drag-and-drop operation is pending, and the mouse is hovering over the destination component. |
void |
drop(java.awt.dnd.DropTargetDropEvent e)
|
void |
dropActionChanged(java.awt.dnd.DropTargetDragEvent e)
|
protected int |
getDroppedTabIndex(javax.swing.JTabbedPane tabbedPane,
java.awt.Point p)
Returns the index at which to add a tab if it is dropped at the mouse location specified by p . |
int |
getSourceActions(javax.swing.JComponent c)
We can only move tabs, we cannot copy them. |
protected boolean |
hasTabFlavor(java.awt.datatransfer.DataFlavor[] flavors)
Does the flavor list have a Tab flavor? |
boolean |
importData(javax.swing.JComponent c,
java.awt.datatransfer.Transferable t)
Called when the drag-and-drop operation has just completed. |
protected void |
selectTab(javax.swing.JTabbedPane tabbedPane,
int index)
Selects the specified tab in the specified tabbed pane. |
Methods inherited from class javax.swing.TransferHandler |
---|
canImport, exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation, importData |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.awt.Point mouseLocation
Constructor Detail |
---|
public TabbedPaneTransferHandler()
Method Detail |
---|
public boolean canImport(javax.swing.JComponent c, java.awt.datatransfer.DataFlavor[] flavors)
canImport
in class javax.swing.TransferHandler
protected java.awt.datatransfer.Transferable createTransferable(javax.swing.JComponent c)
createTransferable
in class javax.swing.TransferHandler
public void dragEnter(java.awt.dnd.DropTargetDragEvent e)
dragEnter
in interface java.awt.dnd.DropTargetListener
public void dragExit(java.awt.dnd.DropTargetEvent e)
dragExit
in interface java.awt.dnd.DropTargetListener
public void dragOver(java.awt.dnd.DropTargetDragEvent e)
dragOver
in interface java.awt.dnd.DropTargetListener
public void drop(java.awt.dnd.DropTargetDropEvent e)
drop
in interface java.awt.dnd.DropTargetListener
public void dropActionChanged(java.awt.dnd.DropTargetDragEvent e)
dropActionChanged
in interface java.awt.dnd.DropTargetListener
protected int getDroppedTabIndex(javax.swing.JTabbedPane tabbedPane, java.awt.Point p)
p
.
tabbedPane
- The tabbed pane who would be receiving the tab.p
- The mouse location.
public int getSourceActions(javax.swing.JComponent c)
getSourceActions
in class javax.swing.TransferHandler
c
- This parameter is ignored.
TransferHandler.MOVE
, as we can only move tabs.protected boolean hasTabFlavor(java.awt.datatransfer.DataFlavor[] flavors)
public boolean importData(javax.swing.JComponent c, java.awt.datatransfer.Transferable t)
JTabbedPane
.
importData
in class javax.swing.TransferHandler
c
- The component receiving the "drop" (the instance of
JTabbedPane
).t
- The data being transfered (information about the tab and the
component contained by the tab).
protected void selectTab(javax.swing.JTabbedPane tabbedPane, int index)
tabbedPane
- The tabbed pane.index
- The index of the tab to select.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |