⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jdragtable.java

📁 iReport-0.4.1-src是iReport的源代码,iReport是一个开源的报表项目,可以生成PDF等格式报表
💻 JAVA
字号:
/*
 * 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -