java Programming Glossary: gettransferdata
Java - How to drag and drop JPanel with its components http://stackoverflow.com/questions/11201734/java-how-to-drag-and-drop-jpanel-with-its-components JPanel panel this.panel panel @Override public DataFlavor getTransferDataFlavors return flavors @Override public boolean isDataFlavorSupported.. by subclassing boolean supported false for DataFlavor mine getTransferDataFlavors if mine.equals flavor supported true break return.. JPanel getPanel return panel @Override public Object getTransferData DataFlavor flavor throws UnsupportedFlavorException IOException..
Swing application -> Drag & drop to the desktop / folder http://stackoverflow.com/questions/1204580/swing-application-drag-drop-to-the-desktop-folder data evt.getTransferable DataFlavor flavors data.getTransferDataFlavors if data.isDataFlavorSupported DataFlavor.javaFileListFlavor.. List File list List File data.getTransferData DataFlavor.javaFileListFlavor processFiles list catch UnsupportedFlavorException.. List File files List File data.getTransferData DataFlavor.javaFileListFlavor for File file files listModel.addElement..
Drag and Drop custom object from JList into JLabel http://stackoverflow.com/questions/13855184/drag-and-drop-custom-object-from-jlist-into-jlabel Transferable t support.getTransferable Object value t.getTransferData ListItemTransferable.LIST_ITEM_DATA_FLAVOR if value instanceof.. this.listItem listItem @Override public DataFlavor getTransferDataFlavors return new DataFlavor LIST_ITEM_DATA_FLAVOR @Override.. LIST_ITEM_DATA_FLAVOR @Override public Object getTransferData DataFlavor flavor throws UnsupportedFlavorException IOException..
Copying DefaultTableModel data to clipboard http://stackoverflow.com/questions/15281679/copying-defaulttablemodel-data-to-clipboard model this.model model @Override public DataFlavor getTransferDataFlavors return new DataFlavor TABLE_DATA_FLAVOR HTML_DATA_FLAVOR.. flavor boolean supported false for DataFlavor mine getTransferDataFlavors if mine.equals flavor supported true break return.. true break return supported @Override public Object getTransferData DataFlavor flavor throws UnsupportedFlavorException IOException..
java drag and drop http://stackoverflow.com/questions/15520610/java-drag-and-drop this this @Override public Object getTransferData DataFlavor flavor throws UnsupportedFlavorException IOException.. flavor @Override public DataFlavor getTransferDataFlavors DataFlavor df new DataFlavor 2 df 0 DataFlavor.stringFlavor.. try Object o transferable.getTransferData PublicUserFlavor.publicUserFlavor System.out.println o if..
Enable stringFlavor of Transfersupport in Java Swing http://stackoverflow.com/questions/17297481/enable-stringflavor-of-transfersupport-in-java-swing String line try line String tansferable .getTransferData DataFlavor.stringFlavor catch Exception e return false JTable.DropLocation.. String line try line String tansferable.getTransferData DataFlavor.stringFlavor catch Exception e e.printStackTrace.. transferable new Transferable @Override public DataFlavor getTransferDataFlavors return new DataFlavor DataFlavor.stringFlavor @Override..
Copy BufferedImage to clipboard http://stackoverflow.com/questions/4552045/copy-bufferedimage-to-clipboard public TransferableImage Image i this.i i public Object getTransferData DataFlavor flavor throws UnsupportedFlavorException IOException.. new UnsupportedFlavorException flavor public DataFlavor getTransferDataFlavors DataFlavor flavors new DataFlavor 1 flavors 0 DataFlavor.imageFlavor.. DataFlavor flavor DataFlavor flavors getTransferDataFlavors for int i 0 i flavors.length i if flavor.equals flavors..
|