jdragtable.java
来自「优秀的打印控件全源代码,类似水晶表的设计器!」· Java 代码 · 共 57 行
JAVA
57 行
/* * JDragTable.java * * Created on 14 novembre 2003, 0.43 */package it.businesslogic.ireport.gui;import java.awt.dnd.*;import it.businesslogic.ireport.*;import it.businesslogic.ireport.gui.dnd.*;import java.awt.datatransfer.*;/** * * @author Administrator */public class JDragTable extends javax.swing.JTable implements DragGestureListener, DragSourceListener { public JDragTable() { DragSource dragSource = DragSource.getDefaultDragSource(); // creating the recognizer is all that's necessary - it // does not need to be manipulated after creation dragSource.createDefaultDragGestureRecognizer( this, // component where drag originates DnDConstants.ACTION_COPY, // actions this); // drag gesture listener } public void dragGestureRecognized(DragGestureEvent e) { // drag anything ... TransferableObject to = new TransferableObject(this.getValueAt(this.getSelectedRow(), this.getSelectedColumn() )); try{ if (to != null) e.startDrag(DragSource.DefaultCopyDrop , // cursor to); //, // transferable //this); // drag source listener } catch (Exception ex) { System.out.println("NOOOOOOOOOOOOOOOOOOOOOO22"); ex.printStackTrace(); System.out.println("NOOOOOOOOOOOOOOOOOOOOOO11"); } } public void dragDropEnd(DragSourceDropEvent e) {} public void dragEnter(DragSourceDragEvent e) {} public void dragExit(DragSourceEvent e) {} public void dragOver(DragSourceDragEvent e) {} public void dropActionChanged(DragSourceDragEvent e) {}}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?