本文整理匯總了Java中java.awt.dnd.DropTargetDragEvent.getLocation方法的典型用法代碼示例。如果您正苦於以下問題:Java DropTargetDragEvent.getLocation方法的具體用法?Java DropTargetDragEvent.getLocation怎麽用?Java DropTargetDragEvent.getLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.dnd.DropTargetDragEvent
的用法示例。
在下文中一共展示了DropTargetDragEvent.getLocation方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: WidgetDropTargetDragEvent
import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
/**
* Creates a drop target drag event.
* @param id the event id
* @param event the Swing event
*/
public WidgetDropTargetDragEvent (long id, DropTargetDragEvent event) {
this.id = id;
this.event = event;
Point location = event.getLocation ();
x = location.x;
y = location.y;
}
示例2: setupDropLine
import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
private void setupDropLine( DropTargetDragEvent dtde, CategoryList list, int dropIndex ) {
boolean verticalDropBar = list.getColumnCount() > 1;
Rectangle rect = list.getCellBounds( dropIndex, dropIndex );
if( verticalDropBar )
dropBefore = dtde.getLocation().x < (rect.x + rect.width/2);
else
dropBefore = dtde.getLocation().y < (rect.y + rect.height/2);
Point p1 = rect.getLocation();
Point p2 = rect.getLocation();
if( verticalDropBar ) {
p2.y += rect.height;
if( !dropBefore ) {
p1.x += rect.width;
p2.x += rect.width;
}
} else {
p2.x += rect.width;
if( !dropBefore ) {
p1.y += rect.height;
p2.y += rect.height;
}
}
p1 = SwingUtilities.convertPoint( list, p1, palette.getRootPane() );
p2 = SwingUtilities.convertPoint( list, p2, palette.getRootPane() );
Line2D line = new Line2D.Double( p1.x, p1.y, p2.x, p2.y );
dropPane.setDropLine( line );
targetItem = (Item)list.getModel().getElementAt( dropIndex );
}
示例3: dragOver
import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
public void dragOver(DropTargetDragEvent e) {
if (tab != null) {
Point p = e.getLocation();
int tabNumber = tab.getUI().tabForCoordinate(tab, p.x, p.y);
if (tabNumber >= 0 && tabNumber != tab.getSelectedIndex()) {
tab.setSelectedIndex(tabNumber);
tab.repaint();
}
}
}
示例4: dragOver
import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
public void dragOver(DropTargetDragEvent e)
{
if (!((mxGraphTransferHandler) graphContainer.getTransferHandler())
.isLocalDrag()
&& JTableRenderer.this != dragSource)
{
Point p = e.getLocation();
int row = rowAtPoint(p);
getSelectionModel().setSelectionInterval(row, row);
}
}
示例5: dragOver
import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
public void dragOver(DropTargetDragEvent e) {
if (!((mxGraphTransferHandler) graphContainer.getTransferHandler()).isLocalDrag()
&& JTableRenderer.this != dragSource) {
Point p = e.getLocation();
int row = rowAtPoint(p);
getSelectionModel().setSelectionInterval(row, row);
}
}
示例6: dragEnter
import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
@Override
public final void dragEnter(DropTargetDragEvent dtde) {
Point pt = dtde.getLocation();
int action = dtde.getDropAction();
if (drawImage) {
paintImage(pt);
}
if (controller.canPerformAction(tree, draggedNode, action, pt)) {
dtde.acceptDrag(action);
} else {
dtde.rejectDrag();
}
}
示例7: dragOver
import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
@Override
public final void dragOver(DropTargetDragEvent dtde) {
Point pt = dtde.getLocation();
int action = dtde.getDropAction();
autoscroll(tree, pt);
if (drawImage) {
paintImage(pt);
}
if (controller.canPerformAction(tree, draggedNode, action, pt)) {
dtde.acceptDrag(action);
} else {
dtde.rejectDrag();
}
}
示例8: dropActionChanged
import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
@Override
public final void dropActionChanged(DropTargetDragEvent dtde) {
Point pt = dtde.getLocation();
int action = dtde.getDropAction();
if (drawImage) {
paintImage(pt);
}
if (controller.canPerformAction(tree, draggedNode, action, pt)) {
dtde.acceptDrag(action);
} else {
dtde.rejectDrag();
}
}