火曜日, 12月 12, 2006

Writing to/from the system clipboard in Java

You can write to/from the system clipboard in Java. For example;

1. Reading from the system clipboard

Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable contents = clipboard.getContents(null);
String buf;
if ((contents != null) && contents.isDataFlavorSupported(DataFlavor.stringFlavor))
{
try
{
buf=(String)contents.getTransferData(DataFlavor.stringFlavor);
}
catch (Exception e) {e.printStackTrace();}
}


2. Writing to the system clipboard

Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable contents = clipboard.getContents(null);
if ((contents != null) && contents.isDataFlavorSupported(DataFlavor.stringFlavor))
{
clipboard.setContents(new StringSelection(tag),null);
}

I2S プロトコル

I²S(Inter-IC Sound)は、マイコンやオーディオ機器間で音声データをやり取りするために設計された、シリアル通信プロトコルです。I²CやSPIと名前は似ていますが、I²Sは音声専用のプロトコルです。 I²Sは、以下の3つの主要な信号線を使って通信します。 BCLK (...