JavaFX 2.0 :: Display Image In WebView From External Directory

Jun 18, 2014

I have a WebView and a Javascript that appends an <img> tag in a webview.
 
Like so:
 
function insertImg(src) {
   $("body").append("<img src='" + src + "'/>");
}
 
I call this function with the following code:
 
String path = "file://Users/rod/Desktop/123.gif";
webengine.executeScript("insertImg('" + path + "')");
 
However, this does not work and no image is displayed.
 
How can this be achieved?

View Replies


ADVERTISEMENT

JavaFX 2.0 :: Show SVG-Image In WebView

Dec 2, 2014

I would like to reopen the following discussion: Show SVG-Image in WebView (JavaFX 8)
 
In our IDE (Eclipse Luna) running with jdk1.8.0_25 we load a html page into the webengine. The html page contains <img> tags with '.png' and '.svg' as src. Everything looks fine.

But if we execute the programm with java -jar, the WebEngine doesn't display the svg-files. Instead it shows the 'File not find'-Icon. The .png files still work
 
The files are definitly included into the jar and will be displayed if we link to them via <a href="someSvg.svg"></a>
 
So why it doesn't work.

View Replies View Related

JavaFX Will Not Display Image

Oct 21, 2014

I've been on this for a while and for some reason I just can't seem to get this to work. I know my code is solid, but it won't display my image. I've tried swithcing the image to different directories and also using different image sizes and types. I even used Orcale's guide to display your image, but still no go! All I get is a blank canvas? There are no errors. I'm also running NetbeansIDE 8 that supports JavaFX and I made sure the project is a JavaFX Application project.

All I get is a blank new window, but no images.

Here's my code:

package javafxapplication3;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.image.Image;

[code]....

The homework called for me to display it three times - the first one regular, second resized, and the last one rotated. I even deleted the extra images in hope at least one appears.

View Replies View Related

JavaFX 2.0 :: ImageView Image Created In Scene Builder 2.0 Doesn't Display In Running App

Sep 9, 2014

I'm using Scene Builder 2.0 and have added an ImageView to the parent AnchorPane.  I've added my PNG files for the app icon and the various buttons. I select the ImageView in Scene Builder and then crawl the filesystem to the project package folder and select the PNG for the Image.  The assigned image is displayed in the Imageview in Scene Builder in both design mode and Preview mode.
 
While everything else shows up properly when the app is executed, the image assigned to the ImageView does not display.
 
From the FXML file:

<ImageView fx:id="ivBRULogo" fitHeight="64.0" fitWidth="64.0" layoutX="14.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0">
         <image>
            <Image url="@BRU_PE_B_64.png" />
         </image>
      </ImageView>
 
What might be occurring between the compiled app and what Scene Builder generates?

View Replies View Related

JavaFX 2.0 :: WebView And OpenLayers3

Sep 22, 2014

I'm using WebView to display an OpenLayers3 map, e.g. Animation example from openlayers.org. When I lock my screen and unlock it, none of the openlayers layers are re-drawn. Sometimes bringing the window in to focus or a small resize of the component will cause the map to go blank. This doesn't occur in any browser I've tested, so it seems to be a WebView specific issue, although it also seems to be layer specific and possibly cache related. I've only tested on Windows, 1.7.0_51 x64 and 1.8.0_05 x64 ....

View Replies View Related

JavaFX 2.0 :: Printing WebView Causes NullPointerException

Jun 17, 2014

I tried to print something using the new JavaFX 8 printing logic. Unfortunately, it does not work.
 
System:
Linux Mint 17x64
Oracle JDK 8u5
Default printer is cups pdf
 
Code:

package sample;
import javafx.fxml.FXML;
import javafx.print.PrinterJob;
import javafx.scene.control.TextField;

[Code].....
 
Debugging shows the array MediaPrintableArea[] mpa at J2DPrinter:839 is missing its first element, which causes the exception at line 844.

If I execute

service.getSupportedAttributeValues(MediaPrintableArea.class, null, null)
instead of

service.getSupportedAttributeValues(MediaPrintableArea.class, null, pras)
I get an array with an element on the first position.
 
The msn object used for the PrintRequestAttributeSet is "iso-a4", which causes the missing first element in the MediaPrintableArea[] array.

So why does this happen? Am I missing some important config stuff? I tried to fix it myself, but I am not able to debug service.getSupportedAttributeValues(...).

View Replies View Related

JavaFX 2.0 :: Playing Youtube Video In WebView

Aug 24, 2014

I'm building app using Javafx Webview, but I have problems with running any Youtube video in Webview. The strange thing is that rarely it plays ok but more often it shows info "An error occurred, please try again later".
 
I tried to figure it out, so I made simple app using Youtube iframe API and firebug lite to show where is the problem:

Here is source of Main.java

Here is source of video.html
 
When I run it on my PC I see the result as below:

Error state 5 means "The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.".

When I run this video.html file in firefox, chrome, or internal eclipse browser, everything is ok and always work.
 
I use JRE and JDK 1.8.20 but tried also with older versions, Windows 7 64 bit. I've also installed DivX - did not work. I tried on different PC (also win7 64 bit) and asked 2 people with similar config to run this - and it is not working. As far as I know there is everything ok on Mac.

View Replies View Related

JavaFX 2.0 :: Debugging Connection Timeout In WebView

Nov 4, 2014

I've run in an issue with connection timeout in the WebView. Requesting the URL in a browser will result in an answer, however it may take some time. Running the same request from the WebView results in a connection timeout.

What is the connection timeout for loading a page through the WebView (from issuing the request webEngine.load(url) to the state change failed passes about 40s). The Request in a browser takes about 10s.

Can I manipulate the underlying connection of the WebView (as suggested at java - How to connect to an HTTPS URL from a JavaFX application - Stack Overflow)

Can I set the connection timeout on the WebEngine/WebKit or per request?Is there an issue targeting this?Likewise I would be interested to get a handle on the connection so I can evaluate the header data to retrieve useful information (like response was a PDF which cannot be rendered in the WebView)....

View Replies View Related

JavaFX 2.0 :: How To Handle File Download In WebView

May 6, 2015

I can't find an handler or a listener to intercept the 'Save as' window that should pops up when i click on a download link in a webview embedded page.

View Replies View Related

JavaFX 2.0 :: WebEngine SetAttribute Is Not Reflected In WebView

Sep 6, 2014

I have a WebView which displays a site. At a specific page I want to fill in some values into <input> elements. So i use such an event handler (browser is of WebView class)
       
        browser.addEventHandler(MouseEvent.MOUSE_CLICKED,
                                new EventHandler<MouseEvent>(){
          public void handle(MouseEvent e) {           
            Document doc = webEngine.getDocument();
            if (doc == null) {
              System.out.println("Doc is null");

[Code] ....
 
The handler sets the "value" but view doesn't reflect that, field is empty.

View Replies View Related

JavaFX 2.0 :: Store Cookies Permanently In Webview?

Sep 15, 2014

I am trying to develop a app for facebook and other social networks using webview. When the app is closed all the cookies are removed and when it is relaunched we can't get use of cookies.  I want to know how to store cookies permanently and use them when the browser is relaunched. And I also want to know how to save web history permanently.

View Replies View Related

JavaFX 2.0 :: HTML Rendering With Webview Component

Nov 14, 2014

I have a big issue to render this html page with the webview component :
 
<html><head lang="en">  <meta charset="UTF-8">  <title>Pb Rotate</title>  <style type="text/css">   #myDivRotate {
color: purple;   background-color: #d8da3d;   height: 200px;   width: 300px;   margin-top: 20px;   margin-left:20px;   -webkit-transform:perspective(400px) rotateX(30deg);   -webkit-backface-visibility: visible;   }
   </style></head><body>  <div id="myDivRotate">   Coucou
   </div></body></html>

The problem is from "perspective" in -webkit-transform. Without it's ok. But with this one, the result is different from a standard browser like chrome or safari.

View Replies View Related

Reading DICOM Image From Another Directory

May 5, 2014

I am trying to crate an interface for the following file (code). The interface that I am trying to create will display a open dialog box where the user chooses which image (.dcm) it would like to open and then it should open it in a frame. The code below shows opening the image. The image opens when the image is in the same folder as the source code but I need it to open from a given path and I am really confused on how to do that. I have tried a lot of methods but still doesn't seem work. How to make it work.
 
This is the code (assuming the parameter that you are passing in image.dcm, I have tried a full path name on mac computer which is like /Users/Documents/image.dcm, where this path name never works):
 
/**
* This class displays the first frame of a file from any format
* supported by ImageIO.
* In the case of DICOM files, stored values are displayed as
* is, without using Value of Interest or Presentation LUTs.
*/
class Read1 {
  public static void main(String[] s) {

[Code] .....

View Replies View Related

Swing/AWT/SWT :: Loading Image File From Source Directory?

Jan 25, 2014

My problem is that I want to load an Image from the source directory in Canavas' paint() method.

My code is currently (in a try/catch)

g.drawImage(ImageIO.read(new File(imageLocation)), imageX, imageY, null);

Where imageLocation leads to an image on my HDD ("C:UsersVladdeDocumentsFolders-Filesfolder.png")

View Replies View Related

Retrieve Image From MySQL DB And Display In Jtable If Image Type Is Medium Blob Using Swings And Hibernate

Jan 5, 2015

I stored an image into MySQL database using swings and hibernate but I am struggling to retrieve that image from MySQL database and display same image in the jTable cell and same as on jLabel whatever I retrieve from the database using swings and hibernate .

View Replies View Related

Write Interface Directory To Manipulate Entries In Telephone Directory

Mar 12, 2014

this is the following task i am trying to do. Write an interface Directory to manipulate entries in a telephone directory for the University. The interface must support the following operations:

1) The ability to insert new entries into the directory. Entries should be stored in alphabetical order of surname.
2) Delete entries from the directory either by name or number
3) Provide a lookup method that will find the extension no of a member of staff given
his/her name. You should try to make this method run as efficiently as possible.
4) Change a person's telephone number
5) Print the telephone directory in a neatly tabulated fashion.

Write a class ArrayDirectory that implements this interface using an array to store the telephone directory information. The class must store the surname and initial for each member of staff and their telephone extension (a four digit number which may start with a zero). You may find it useful to define a class Entry to store information about individual entries. The entries should be read into the array from a text file consisting of multiple lines in the following format:

Surname<tab>Initials<tab>Telephone extension

The part that i am stuck on is trying to do the entry method, delete entries method, loop up method, change persons telephone number and be able to print it.

View Replies View Related

Servlets :: Url Pattern - Real Directory Vs Virtual Directory

May 26, 2014

Consider the url-pattern:
<url-pattern> /Beer/* </url-pattern>

The web app structure is: -

webapps
|
-->AdviceApp
|
-->WEB-INF
--> {{Beer}} This can be real or virtual.

My book says that /Beer/* can be a real or a virtual directory. What is the difference between the two and how do I create a virtual directory in tomcat ?

View Replies View Related

How To Get Image To Display On JFrame

Nov 13, 2014

I have been trying to make a game lately, but I can't seem to work out how to get an image to display on my JFrame. I have tried everything, copied different codes of the internet, but nothing works. Here is my code of the GUI:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class GUI extends JFrame implements Runnable, ActionListener {
JButton start = new JButton("Start nieuw spel");
JButton instellingen = new JButton("Instellingen");
public GUI() {

[Code]...

View Replies View Related

Display Image (GIF / JPG) On JPanel

Apr 12, 2014

I'm simply trying to make a gui for managing images for my purpose, but i fall at the first step: I'm actually not able to display an image, whether it would be a .gif or .jpg ....

//--------MY PANEL FOR VIEWING IMAGE---------
package graph2D;
 
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit;
import javax.swing.JPanel;
class PannelloConImmagine extends JPanel {
private Image miaImmagine;
 
[Code] .....

it is supposed that i placed the image "pippo.gif" in my project "src" folder, isn't it? anyway I tried to add a new folder to my build Path, and place pippo.gif on it, but it doesn't work.

View Replies View Related

Cannot Display Image For Some Reason

Mar 27, 2014

I am using Netbeans. For some reason I cant display an image.

Java Code:

import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.net.URL;

public class ImageLoadingTutorial extends Applet{
private Image spiral = null;

[Code] ....

View Replies View Related

JSP :: Choose / Display Image Path

Mar 15, 2014

I want to do the followings:

-When i press "choose the Image Path" a window open like a picture 2.
-I want also satisfy the condition written in red.

View Replies View Related

Swing/AWT/SWT :: Doesn't Display Image

Mar 28, 2015

why this code, doesn't display the image?

import java.awt.Graphics;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

[code]...

View Replies View Related

ActionListener To Display Different Image Icons?

May 23, 2014

If you look at line 74 you will see my actionPerformed method where I want to switch the icon displayed on the JButton. I know I still have to add the images to the button however I am running into a few issues here.

In my next class it will be vital that I can decipher what each icon is display on the JButton.

Java Code: import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class Screen implements ActionListener

[code]....

View Replies View Related

Swing/AWT/SWT :: Display Image On Game

Jan 19, 2014

I have a class that retrieves an image, and a class that is a game. I want to put my image onto the game to use it as the main figure. As of right now in eclipse, the game class runs, so the game works, but the image doesn't do anything. Need to put the image into the game? Here is my image class:

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.*;

[code]....

View Replies View Related

Program That Will Have GUI Window And Display Image?

Jun 24, 2014

I am writing a program that will have a GUI window and displays an image when clicked on the image changes and clicked on again the image changes once more. Here is what i have.

package ButtonLab;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

[Code]....

The issue i am having is when i run it the window pops up but with no images. The images wont load, I have tried to use the c: path to the image also.

View Replies View Related

Swing - Display Image On JFrame?

Jan 16, 2014

How to display an image on a JFrame. If you can, pany example code.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved