📄 jtpcomponentsection.java
字号:
package com.sunking.tp.framework;
import java.io.*;
import java.awt.datatransfer.*;
/**
* <p>Title: </p>
* <p>Description: JTP组件复制部件</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author <a href="mailto:sunkingxie@hotmail.com">SunKing</a>
* @version 1.0
*/
public class JTPComponentSection implements Transferable, ClipboardOwner {
/**
*FLAVOR
*/
public static final DataFlavor JTPButtonFlavor = new DataFlavor(
"application/x-java-JTPButton;class="+JTPComponent.class.getName(),null);
private static final DataFlavor[] flavors = {JTPButtonFlavor};
/**
*被复制或传递的组件
*/
private JTPComponent data[];
/**
* @param source 被复制或传递的组件
*/
public JTPComponentSection(JTPComponent source[]) {
data = new JTPComponent[source.length];
for (int i = 0; i < source.length; i++) {
data[i] = (JTPComponent)(source[i].clone());
}
}
public DataFlavor[] getTransferDataFlavors() {
return (DataFlavor[])flavors.clone();
}
public boolean isDataFlavorSupported(DataFlavor flavor) {
for (int i = 0; i < flavors.length; i++) {
if (flavor.equals(flavors[i])) {
return true;
}
}
return false;
}
public Object getTransferData(DataFlavor flavor)
throws UnsupportedFlavorException, IOException
{
if (flavor.equals(flavors[0])) {
JTPComponent result [] = new JTPComponent[data.length];
for (int i = 0; i < data.length; i++) {
result[i]=(JTPComponent)(data[i].clone());
}
return result;
} else {
throw new UnsupportedFlavorException(flavor);
}
}
public void lostOwnership(Clipboard clipboard, Transferable contents){}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -