?? slideshowservice.java
字號:
package connex.plugins.slideshow;
import connex.session.plugin.Plugin;
import javax.swing.JPanel;
import net.jxta.jxtacast.JxtaCastEventListener;
import net.jxta.jxtacast.JxtaCastEvent;
import net.jxta.jxtacast.JxtaCast;
import connex.core.WS.Workspace;
import java.io.File;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class SlideShowService implements Plugin , JxtaCastEventListener{
private SlideShowGUI gui;
private JxtaCast jc;
private Workspace ws;
private static SlideShowService instance = null;
public SlideShowService() {
instance = this;
}
public void initPlugin(Object param) {
this.ws = (Workspace) param;
jc = new JxtaCast(ws.getPeerAdv(),ws.getPeerGroup(),"ConneX_SlideShow");
gui= new SlideShowGUI();
}
public void startPlugin() {
jc.addJxtaCastEventListener(this);
jc.logEnabled=true;
jc.start();
}
public JPanel getMainUI() {
return gui;
}
public void stopPlugin() {
jc.removeJxtaCastEventListener(this);
jc.stop();
}
public void pausePlugin() {
}
public void createSession(String id) {
}
public void sendPicture(File file){
System.out.println(file.getAbsoluteFile());
jc.sendFile(file,"ConneXSlide");
}
public void jxtaCastProgress(JxtaCastEvent e) {
gui.updateProgress(e.percentDone);
if (e.transType == 0) {
gui.setState("Sending...");
} else {
gui.setState("Receiving from " + e.sender);
}
if (e.percentDone == 100) {
long en = System.currentTimeMillis();
System.err.println(en + " :MyFile: type" +
e.transType + " : caption" + e.caption +
e.percentDone);
if (e.transType != 0) {
try {
gui.display( e.filename);
} catch (Exception ex) {
}
}
gui.setState("Waiting for Picture");
}
}
public static SlideShowService getInstance(){
if(instance==null){
instance= new SlideShowService();
}
return instance;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -