如何在Applet表列中链接.pdf文档

时间:2022-10-31 18:42:03

I wanted to link a .pdf file to an Applet

我想将.pdf文件链接到Applet

I am using the following code

我使用以下代码

try {


 //if (column == docColId) {

String doccolvalue = this.getTable().getValueAt(row,
   column).toString();

String lPathPrefix = "gopher://muceap10.muc.amadeus.net/User Step Folders/BPS_Files/Outlooksoft CPM/01 - Production Environment/01 -
   Documentation Library/01 -
   Documents/Daily_Checks/";

String lPath = (lPathPrefix + doccolvalue).replace(" ", "%20");
 URI lURI = new URI(lPath);
 //lPathPrefix = lPathPrefix.replace(" ", "%20");
  //URI lURI = new URI(lPathPrefix + doccolvalue);
   java.awt.Desktop lDesktop = java.awt.Desktop.getDesktop();
   lDesktop.open(new File(lURI));

   } catch (Exception e) {
    e.printStackTrace();
     }

But I am getting the following error

但是我收到以下错误

URI scheme is not "file"
 at java.io.File.<init>(Unknown Source)
 at client.cpm.dailyT0.CBRCPMDailyT0View.table_mouseClicked(CBRCPMDailyT0View.java:371)
 at client.cpm.dailyT0.CBRCPMDailyT0View.access$1(CBRCPMDailyT0View.java:325)

Can any one help me ,

谁能帮我 ,

Thank in Advance.

预先感谢。

1 个解决方案

#1


0  

In absence of full code I tried using this...

在没有完整代码的情况下,我尝试使用这个......

import java.net.URI;

public class SimpleTableDemo {
    public static void main(String[] args) throws Exception{
        String lPathPrefix = "gopher://muceap10.muc.amadeus.net/User Step Folders/BPS_Files/Outlooksoft CPM/01 - Production Environment/01 -  Documentation Library/01 -"+
        "Documents/Daily_Checks/";

        String lPath = (lPathPrefix + "test").replace(" ", "%20");
        URI lURI = new URI(lPath);

        System.err.println(lURI);
    }
}

And it seems it is working ...

似乎它正在发挥作用......

Output

gopher://muceap10.muc.amadeus.net/User%20Step%20Folders/BPS_Files/Outlooksoft%20CPM/01%20-%20Production%20Environment/01%20-%20%20Documentation%20Library/01%20-Documents/Daily_Checks/test

Post full snippet if possible....

如果可能的话,发布完整的片段....

#1


0  

In absence of full code I tried using this...

在没有完整代码的情况下,我尝试使用这个......

import java.net.URI;

public class SimpleTableDemo {
    public static void main(String[] args) throws Exception{
        String lPathPrefix = "gopher://muceap10.muc.amadeus.net/User Step Folders/BPS_Files/Outlooksoft CPM/01 - Production Environment/01 -  Documentation Library/01 -"+
        "Documents/Daily_Checks/";

        String lPath = (lPathPrefix + "test").replace(" ", "%20");
        URI lURI = new URI(lPath);

        System.err.println(lURI);
    }
}

And it seems it is working ...

似乎它正在发挥作用......

Output

gopher://muceap10.muc.amadeus.net/User%20Step%20Folders/BPS_Files/Outlooksoft%20CPM/01%20-%20Production%20Environment/01%20-%20%20Documentation%20Library/01%20-Documents/Daily_Checks/test

Post full snippet if possible....

如果可能的话,发布完整的片段....