开发者

How do I Link a .pdf document in the Applet table column

开发者 https://www.devze.com 2023-01-16 19:37 出处:网络
I wanted to link a .pdf file to an Applet I am using开发者_如何学Go the following code try { //if (column == docColId) {

I wanted to link a .pdf file to an Applet

I am using开发者_如何学Go 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.


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....

0

精彩评论

暂无评论...
验证码 换一张
取 消