Problem using url on local image

Hi,
i'm currently playing around with javaFx for a udpClient and i wanted to use Image included into my jar but doesn't work.
ImageView {     
                    image: bind Image { url: ".//image//gradient.jpg" }
...it gives me:
java.net.MalformedURLException: no protocol: image//favicon.ico
        at java.net.URL.<init>(URL.java:567)
        at java.net.URL.<init>(URL.java:464)
        at java.net.URL.<init>(URL.java:413)any idea why? is it mean to be only deployed and not forcast to run as an application with internal reference to image?
thx you in advance

ok forget it.
too late over here :)
ImageView {                    
                    image: bind Image { url: "file:./image/gradient.jpg" }will do the trick

Similar Messages

  • Problem using RescaleOp to brighten image

    Hi, I'm trying to use java.awt.image.RescaleOp to brighten or darken an image. My code:
    (Using java.awt.image.BufferedImage, java.awt.RenderingHints)
         protected static Image createBrightImage(Graphics g, BufferedImage bi)
              float scaleFactor = 1.3f;
              RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
              RenderingHints.VALUE_ANTIALIAS_ON);
              hints.put(RenderingHints.KEY_RENDERING,
              RenderingHints.VALUE_RENDER_QUALITY);
              RescaleOp op = new RescaleOp(scaleFactor, 0, hints);
              return op.filter(bi, null);
    There is no error, but when I try to display the image I don't see anything. The image I have (a .PNG) is a coloured circle on a square background; the background is 100% transparent (alpha transparency). I also tried setting hints to null (which is perfectly legal AFAIK) but no change.
    It also doesn't work with a .JPG.
    Any idea what I've done wrong with this filter?
    I found if I create a new BufferedImage and write the image data to it (in the context of the BufferedImage) then perform this code, then the filter DOES work (and I see an image)... unfortunately the transparent background (alpha channel) was converted to a solid black background. So this technique is flawed (regardless of the fact that it shouldn't be necessary IMO).
    BTW, the code for making this new image:
         BufferedImage bi = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB);
         java.awt.Graphics2D g2d = bi.createGraphics();
         g2d.drawImage(image, 0, 0, null);
         g2d.dispose();
    Any ideas how to make this work? BTW, I've had success with the ColorSpace filter to create grayscale images...
    TIA
    Phil

    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    import javax.swing.*;
    public class RescaleExample {
        public static void main(String[] args) throws IOException {
            File file = new File("junk.png");
            createPNGFile(file);
            BufferedImage image = copy(ImageIO.read(file), BufferedImage.TYPE_INT_ARGB);
            BufferedImage copy = copy(image, BufferedImage.TYPE_INT_ARGB);
            brighten(copy);
            JPanel cp = new JPanel(new GridLayout(1,2));
            URL url = new URL("http://today.java.net/jag/bio/JagHeadshot.jpg");
            cp.setBorder(new CentredBackgroundBorder(ImageIO.read(url)));
            cp.add(new JLabel(new ImageIcon(image)));
            cp.add(new JLabel(new ImageIcon(copy)));
            final JFrame f = new JFrame("RescaleExample");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setContentPane(cp);
            f.pack();
            SwingUtilities.invokeLater(new Runnable(){
                public void run() {
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
        public static void createPNGFile(File file) throws IOException {
            file.delete();
            BufferedImage bi = new BufferedImage(250,250, BufferedImage.TYPE_INT_ARGB);
            //starts out transparent
            Graphics2D g = bi.createGraphics();
            //add some dark colors, suitable for rescaling.
            g.setColor(new Color(128,0,0));
            g.fillRect(50,50,50,150);
            g.setColor(new Color(0,128,0));
            g.fillRect(100,50,50,150);
            g.setColor(new Color(0,0,128));
            g.fillRect(150,50,50,150);
            g.dispose();
            ImageIO.write(bi, "png", file);
        public static BufferedImage copy(BufferedImage bi, int type) {
            BufferedImage result = new BufferedImage(bi.getWidth(), bi.getHeight(), type);
            Graphics2D g = result.createGraphics();
            g.drawRenderedImage(bi, null);
            g.dispose();
            return result;
        public static void brighten(BufferedImage bi) {
            float scaleFactor = 1.5f;
            RenderingHints hints = new RenderingHints(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
            RescaleOp op = new RescaleOp(scaleFactor, 0, hints);
            op.filter(bi, bi);
    class CentredBackgroundBorder implements javax.swing.border.Border {
        private final BufferedImage image;
        public CentredBackgroundBorder(BufferedImage image) {
            this.image = image;
        public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
            x += (width-image.getWidth())/2;
            y += (height-image.getHeight())/2;
            ((Graphics2D) g).drawRenderedImage(image, AffineTransform.getTranslateInstance(x,y));
        public Insets getBorderInsets(Component c) {
            return new Insets(0,0,0,0);
        public boolean isBorderOpaque() {
            return true;
    Notes
    1. RescaleOp seems to have problems with images that have an alpha channel. The fix I finally found
    was to pass the same bufferedimage as both args to filter:op.filter(bi, bi);As the API states:
    ... in-place operation is allowed (i.e. the source and destination can be the same object).
    Just be aware that you need to make a copy first, If you want to retain the original image.
    2. Be aware of the difference between TYPE_INT_RGB and TYPE_INT_ARGB.
    3. This is not an error, but realize only certain hints are relevant. Again, from the API:
    If a RenderingHints object is specified in the constructor, the color rendering hint and the dithering
    hint may be used when color conversion is required.

  • Problem using parameters in dynamic image loading

    Hello experts!!!
    I am using Crystal Reports 2008.  I am trying to make use of a class servlet application that returns an image based on a number of parameters.  I have put a formula behind a default image that should access the servlet and change the image at runtime.
    This works fine in the CR2008 designer.  However when it is published to my webapp, it doesn't work. 
    The problem is that for some reason, something somewhere is removing the '?' before the parameters in the URL.
    My formula
    "http://localhost:8080/demoMYSQL/servlet/em.cabbench.CabBenchSrv?requestType=getStaticDrawing&imageType=2D&scale=1.6&layerscale3d=0.03&extrusionlength3d=0.4&corelabellevel=1&solid=1&topLevel=1&userid=admin&password=admin&design=" + {designHeader/header/headerAtt.design}
    Image loading in designer
    [http://farm4.static.flickr.com/3503/3179649422_ebd760fa61.jpg?v=0]
    Web application log showing correct path name /em.cabbench.CabBenchSrv to servlet and a succesful request
    /em.cabbench.CabBenchSrv
    1231497711203|10:41:51:203|/demoMYSQL|null|requestType=getStaticDrawing&design=MV-120-XLPE-001&layerscale3d=0.03&scale=1.6&imageType=2D&userid=admin&topLevel=1&solid=1&extrusionlength3d=0.4&corelabellevel=1
    10:41:51:218  binding session 872DB3467263966DC9D5CEBB645C8A5D
    Image loading in viewer - NOT WORKED, default image displayed
    [http://farm4.static.flickr.com/3126/3179649516_5df47fa7fd.jpg?v=0]
    Web application showing incorrect path name to servlet because '?' is missing - result = null request!
    /em.cabbench.CabBenchSrvrequestType=getStaticDrawing&design=MV-120-XLPE-001&imageType=2D&scale=1.6&layerscale3d=0.03&extrusionlength3d=0.4&corelabellevel=1&solid=1&topLevel=1&userid=admin&password=admin&design=MV-120-XLPE-001
    1231498144859|10:49:4:859|/demoMYSQL|null|requestType=null
    1231498144859|10:49:4:859|End of
    Has anybody got any ideas of what to do with the question mark and how to get the image to change properly?????? Like it is doing in the report designer!
    Best Regards
    Nick Hirst

    Hi Nick,
    Since, the issue you have is with the web app only, I would request you to post this thread on the Dev Forum.
    Please click on the appropriate link below: -
    For .Net - SAP Crystal Reports, version for Visual Studio
    For Java - SAP Crystal Reports, version for Eclipse
    The people there would be the perfect people to help you with this.
    Hope this helps.
    Regards,
    Jay.

  • Problem using email to upload image files to Mobile Me gallery

    I will cross post this question to both Mail and Mobile Me discussion groups because I don't know where my problem lies.
    I have published a gallery page from iPhoto to my Mobile Me gallery. There are two ways to upload additional photos. I am not having trouble adding image files with the Upload feature. I cannot get the email function to work. The emails I send to the email address for the gallery bounce back to my mail inbox.
    Subject: Delivery Notification: Delivery has failed
    and in the body of the bounced email:
    Recipient address: [email protected]
    Reason: SMTP transmission failure has occurred
    Diagnostic code: smtp;521 5.2.1 Fatal failure of WOA
    Remote system: dns;post.mac.com (TCP|10.150.69.91|51195|10.13.19.27|25) (mbin002.mac.com ESMTP [2.3.3/gso-r197-19Feb2007] ready to rumble)
    Original-envelope-id: [email protected]
    Reporting-MTA: dns;asmtp028-bge351000 (tcp-daemon)
    Original-recipient: rfc822;[email protected]
    Final-recipient: rfc822;[email protected]
    Action: failed
    Status: 5.2.1 (SMTP transmission failure has occurred)
    Remote-MTA: dns;post.mac.com (TCP|10.150.69.91|51195|10.13.19.27|25)
    (mbin002.mac.com ESMTP [2.3.3/gso-r197-19Feb2007] ready to rumble)
    Diagnostic-code: smtp;521 5.2.1 Fatal failure of WOA
    One of the images I am trying to attach is a jpeg file of 61 kb.
    I have tried to drag the image from my desktop to the body of the email. I have tried using the "attach" function and selecting the file name. I am not sending any text with these files.
    When I built these albums, I checked and enabled all the options.
    I am having this same issue when I try to upload via email to any of my Mobile Me gallery pages.
    There is currently one photo displayed here:
    http://gallery.me.com/tplattenberger#100352
    If anyone wishes to try to upload to that gallery using email (Send to Album) that would be great and if successful, that might provide a clue to my problem.
    As I say, I currently have one photo there. If you find a lot more, please do not add.
    What's the problem?
    Tom

    The images I am trying are newly created and old.
    A weird hint perhaps...
    I just copied an image from Apple's home page and pasted it into the email and tried again...
    it worked.
    So I tried again, dragging from iPhoto and it did not work... the email bounced back.
    So I tried again, this time using copy and paste (like I did from Apple's page) from iPhoto... it did not work.
    Tom

  • Problem using PJA tools Gif/Image Encoder

    hi
    can someone tell me where i am going wrong ...I am getting the following error after i ran a servlet .
    Internal error: Unexpected error condition thrown (java.lang.NoClassDefFoundError: Acme/JPM/Encoders/ImageEncoder,Acme/JPM/Encoders/ImageEncoder), stack: java.lang.NoClassDefFoundError: Acme/JPM/Encoders/ImageEncoder
    at java.lang.ClassLoader.resolveClass0(Native Method)
    at java.lang.ClassLoader.resolveClass(ClassLoader.java:597)
    at com.iplanet.server.http.servlet.NSServletLoader.loadClass(NSServletLoader.java:114)
    at com.iplanet.server.http.servlet.NSServletEntity.load(NSServletEntity.java:337)
    at com.iplanet.server.http.servlet.NSServletEntity.update(NSServletEntity.java:173)
    at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:427)
    I added both the GifEncoder and ImageEncoder class files to the classpath . Still the same problem ...
    I need some help ..pls..
    prabhu

    Try copying the GifEncoder and ImageEncoder files or the jar file to the app server lib directory.

  • Problem using url rewriting

    Hi!
    I am currently developing a struts based BC4J application. This application has to run using the internet explorer without java-script and cookies.
    Currently with cookies enabled everything is fine. But when i disable cookies it seems as if the application does not find the session context anymore.I fall back to the login-screen, which should happen, if the user is not logged in (which i check with a '<logic:notPresent name="user" scope="session">' tag).
    Right now the application is stateful (though it also runs in stateless mode).
    It even seemed to me as if the session id changes before i fall back to the login screen.
    Does anybody know if i make somthing wrong. Or is it possibly a bug?
    thanx
    Hendrik

    Repost!
    Please, if anyone nows something (every hint can be helpfull), it is urgent!

  • How to display the image which in KM folder using url iview

    Hi Friends
    How to display the image, which is under KM folder structur using the url iview.
    i trying using url iview url as  \document\testfolder\abc.jpg as url for the iview.
    but its now working .. so please help me how to slove this problem
    If is not the correct way then please suggest me best way to achive this.
    Thanks
    Mukesh

    Hi Mukesh,
    I think this may work,
    1, Create a HTML Layout.
        You can put your image wherever  u want with HTML Codes.
        Check this, [Article|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3915a890-0201-0010-4981-ad7b18146f81] & [Help|http://help.sap.com/saphelp_nw04/helpdata/en/cc/00c93e9b2c3d67e10000000a114084/frameset.htm]
        With this, u can use the standard KM commands also.
    2, U need to use KM Navigation iView for this rather than KM Doc iView.
    3, In the Nav iView, u can use &rndLayoutSet=nameOfUrHTMLLayout to force the view with this new layout.
    Regards
    BP

  • How to display images by using URLs in Interactive Reporting

    Hello everybody,
    My client has the Hyperion System 9.3 suite.
    We have a report in Interactive Reporting showing product data.
    The source for the report is a relational database (SQL Server).
    The data is grouped by product.
    My client needs the product's picture (jpg) in the report.
    The problem is that product images are not available in the relational database but via URL like this:
    http://client_domanin//Hyperion/id_product.jpg
    (the name of the image equals the id of the product).
    I was thinking to solve this problem using Java Script.
    I don't know Java Script and don't know how to 'integrate' the JavaScript code with Interactive Reporting.
    How should the Java Script look like?
    Any help will be extremely appreciated.
    Thank you all!
    Daniela

    You might be able to do it if you are using the iHTML view of the Report not the Interactive Reporting Web Client (Plug-in)
    I do not have a 9.x server available to test this so it is guess on how i did it once in a Proof of Concept.
    In Results section Create a Computed Item that will be the HTML tag for the Graphic
    the syntax would look something like below
    '<IMG SRC = "http://client_domanin//Hyperion/" + id_product + ".jpg">'
    WHERE id_product is a column in your Data.
    Again this will not show a graphic when viewed with Interactive Reporting Web Client or Desktop Client.
    Good Luck, hope this is helpful
    Wayne

  • Flex 4.5 problem using image in Mobile Application (Android)

    I have a problem using flex and mobile application...
    I have an image with path = "/mnt/sdcard/images/20120202172020990.jpg"
    Simply using
         <s:Image id="image" source="/mnt/sdcard/images/20120202172020990.jpg" />
    Get me an empty image on device, still using it on computer (desktop build / debug) it works fine...
    I have enabled every kind of permission in the app.xml
    Why I got this error?

    I actually solved the problem using:
    image.source = File.desktopDirectory.resolvePath(file_name).url;
    using instead this one it will work only under windows...
    image.source = File.desktopDirectory.resolvePath(file_name).nativePath;
    I don't know if it's a bug or whatelse, but I think that the source property of Image passing a filename that start with / (/ is root for unix based OS, android, linux, ios, etc), will take is as a relative path instead of complete path...

  • Hi. I am just about to move from the UK to Kuwait. Will I have any problems using my iPhone 4 and able to join a local carrier using this device please?

    Hi. I am just about to move from the UK to Kuwait. Will I have any problems using my iPhone 4 and able to join a local carrier using this device please?

    If your phone is locked to a particular carrier, you must contact them to request they unlock it. Once they've taken care of that and you've followed the instructions to complete the unlock process, you will be able to use the phone elsewhere.
    ~Lyssa

  • PROBLEM while using URL in order to open a file from a servlet

    Hi,
    I am having a problem while trying to open a file from my servlet by using URL connection. Following is my code sample. what happens is when I first run my project it opens the file but after that when I rerun it again and again it sometimes opens it and sometimes not. if it can't open it it gives an error saying "the file is damaged and couldn't be repaired". I don't get any exceptions. if you guys can help me I will appreciate it so much... thanks.
    here is my code :
    URL url = new URL("http://demobcs.ibm.com:81/test.pdf");
    resp.setContentType(getContentType("http://demobcs.ibm.com:81/test.pdf"));
              ServletOutputStream sos = null;
              BufferedInputStream bis = null;
              try {
                   sos = resp.getOutputStream();
              } catch (Exception e) {
                   System.out.println("exception !!!!");
                   e.printStackTrace();
              System.out.println("burada2");
              try {
                   byte[] bytes = new byte[4096];
                   //bis = new BufferedInputStream(conn.getInputStream());
                   DataInputStream in = new DataInputStream(url.openStream());
                   //DataInputStream in = new DataInputStream(conn.getInputStream());
                   bis = new BufferedInputStream(in);
                   int j;
                   while ((j = bis.read(bytes, 0, 4096)) != -1) {
                        try {
                             sos.write(bytes, 0, 4096);
                             System.out.println("file is being read ...:");
                        } catch (Exception e) {
                             e.printStackTrace();
                   in.close();
                   bis.close();          
                   //sos.close();
              } catch (Exception e) {
                   System.out.println("exception :"+e.toString());
                   e.printStackTrace();
              }

    You are writing (<filesize> mod 4096) bytes of crap at the end of the file. Use your variable j instead for the number of bytes to write in your loop.

  • Spry Menu problem with using a transparent background image

    Hi-  I'm new to CS5 and Dreamweaver. I just finished the beginning webpage tutorial and I have started to work on a personal project. The Problem: when I use a transparent png image as a backgroun-image for my spry menu it shows up fine in live view, but doesn't work in browser view (safari), in fact the menu reverts to it's original grey and blue boredom. Does anyone have a solution for me? Does this mean it will be grey and blue when it goes live? Thanks, Ruth333333

    Please supply a link to your site.
    Gramps

  • Until recently I was able to send images in the body of my Yahoo emails. Now, I am getting the message "This message has been truncated", and the email does not go through. I do not have this problem using IE. Could you please help? Thank you.

    Until recently I was able to send images in the body of my Yahoo emails. Now, I am getting the message "This message has been truncated", and the email does not go through. I do not have this problem using IE. Could you please help? Thank you.

    Try this -> http://support.apple.com/kb/TA38632?viewlocale=en_US

  • HT204093 I am following the instructions to hyperlink URL to an image in an email, but once I paste the URL, the "ok" button is not highlighted so I cannot complete the task. What is the problem and how do I get around it?

    I am following the instructions to hyperlink URL to an image in an email, but once I paste the URL, the "ok" button is not highlighted so I cannot complete the task. What is the problem and how do I get around it?

    I figured out if I took the http:// off the front of the URL, the "ok" button would highlight, but then link did not work. I tried just linking www.google.com to the image and the link did not work either. What gives?!

  • Problems in creation of workbook using Change query local view.

    Hi Experts,
    I have created a Multiprovider by using union of two infocubes and created a Query based on Multiprovider.  I want to restrict one infocube in Change Query local view for creating new workbooks.  In Query global view we drag and drop the Infocube under Filters, but in the Query local view Filter panel is in disable mode. (My requirement is to create the workbooks using change query local view only)
    How can I restrict the one Infocube values in the workbooks by using Change query local view? 
    Thanks in advance.
    Venkat.

    Hi Venkat Prasad
    As you told that the query is on multi provider and the view is not allowing to declare/define filter value
    Just drag the infoprovider info object avilable under packet dimension to rows and right click on it restrict by selecting the name of the info provider when u right click it will show you the option of restrict once u click on it,it will takes to u a pop up where you can able to see the name of info providers and you specify according to it and finally in the display of results if you dont want to to display the info provider name then just right click on the 0infoprovider object under rows go to properties then choose hide option under display.
    Hope its clear a little..!
    Thanks
    K M R
    **Assigning points is the only way of saying thanks in SDN***
    >
    venkata prasad wrote:
    > Hi K M R,
    >
    > Thanks for ur quick response.  Most of the Infoobjects are common for both infocubes. I didn't understand this sentense "retrict the value with the infoprovider which values you are trying to view".
    > Please explian elaborately how to restrict the values speicfic to infoprovider under rows.

Maybe you are looking for

  • Transferring "Pages" from iMac to iPad

    I downloaded Pages to my iMac, can I transfer and use it on my iPad or do I need to purchase it for the iPad too?

  • Reading INI files with dashes in the section name

    I am trying to read an INI file from a web site. Within that INI file are sections that have dashes in them. I need to be able to read several sections so I can locate specific files to download referenced within the INI files. I found a script for p

  • Using a file as a source of images for a slideshow in CS6

    I was wondering if someone might be able to help me create a slideshow that uses a file to pull images from rather than calling on an individual image source code. As it is right now, I have a basic working jquery slideshow. What I am wanting to get

  • Let the user set in a number

    Hello, I want to make a program where the user can put in a number an get a conversion to another valuta.. //Exchange to NOK                public double beregnTilNok(int antall){                     return antall * kurs / enhet;                // Be

  • Iphone 2.2.1 update, what is "error 9006"?

    What is "error 9006" in the iphone 2.2.1 update? I have tried 'countless times' to update my iphone however everytime the download is nearing completion, i always get the same error! 'error 9006'!! i'm about to give up on it!!