Local "img src" in JComboBox
I've got a JComboBox where one of the elements are added with this text:
"<html><body style=\"padding:0px;margins:0px;\"><table style=\"padding:0px;margins:0px;\"><tr style=\"padding:0px;margins:0px;\"><td style=\"width:20px;height:20px;vertical-align:middle;padding:0px;margins:0px;\"><img src=\"resources/image.png\"></td><td style=\"height:20px;vertical-align:middle;padding:0px;margins:0px;\"><b> MANAGER</b></td></tr></table></body></html>"How do I get this to work for local folders? I've tried absolute paths, I've tried relative paths (like above), but I just can't seem to get it to work. Internet URLs do work though, but they seem to make the JComboBox lag.
Thanks in advance!
Someone has a solution in this post
http://forum.java.sun.com/thread.jspa?forumID=257&threadID=290240
Similar Messages
-
Dreamweaver CSS Mac writes image links wrong... <img src="/www/images/asian_sales_office.jpg" width="x" height="x" alt="x"> Took me a bit to find this, now back to hand coding all image links and also checking other code. Any fixes?
That looks to me like you may have your site definition set up incorrectly and you appear to be using "Site Root Relative" vs "Document Relative"
Go to Site > Manage Sites > click the site you are working on > Click the Edit icon > Advanced Settings > Links relative to: should be set as Document, unless you have a very specific reason for choosing Site Root there
If your server root folder is called www, you'll need to remove that folder from your site root. You are only transferring files from root to root, so the name of your local root folder is not important (the files inside it go to the server root). It is important not to accidentally have a duplicate of the server root folder inside your local root though which would accidentally nest your files within another folder when transferring to the server. -
I want to display BLOB image in JSP Using html tags IMG src=
GoodAfternoon Sir/Madom
I Have got the image from oracle database but want to display BLOB image using <IMG src="" > Html tags in JSP page . If it is possible than please give some ideas or
Send me sample codes for display image.
This code is ok and working no problem here Please send me code How to display using html tag from oracle in JSP page.
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="javax.swing.ImageIcon;" %>
<%
out.print("hiiiiiii") ;
// declare a connection by using Connection interface
Connection connection = null;
/* Create string of connection url within specified format with machine
name, port number and database name. Here machine name id localhost
and database name is student. */
String connectionURL = "jdbc:oracle:thin:@localhost:1521:orcl";
/*declare a resultSet that works as a table resulted by execute a specified
sql query. */
ResultSet rs = null;
// Declare statement.
PreparedStatement psmnt = null;
// declare InputStream object to store binary stream of given image.
InputStream sImage;
try {
// Load JDBC driver "com.mysql.jdbc.Driver"
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
/* Create a connection by using getConnection() method that takes
parameters of string type connection url, user name and password to
connect to database. */
connection = DriverManager.getConnection(connectionURL, "scott", "root");
/* prepareStatement() is used for create statement object that is
used for sending sql statements to the specified database. */
psmnt = connection.prepareStatement("SELECT image FROM img WHERE id = ?");
psmnt.setString(1, "10");
rs = psmnt.executeQuery();
if(rs.next()) {
byte[] bytearray = new byte[1048576];
int size=0;
sImage = rs.getBinaryStream(1);
//response.reset();
response.setContentType("image/jpeg");
while((size=sImage.read(bytearray))!= -1 ){
response.getOutputStream().write(bytearray,0,size);
catch(Exception ex){
out.println("error :"+ex);
finally {
// close all the connections.
rs.close();
psmnt.close();
connection.close();
%>
ThanksI have done exactly that in one of my applications.
I have extracted the image from the database as a byte array, and displayed it using a servlet.
Here is the method in the servlet which does the displaying:
(since I'm writing one byte at a time, it's probably not terribly efficient but it works)
private void sendImage(byte[] bytes, HttpServletRequest request, HttpServletResponse response) throws IOException {
ServletOutputStream sout = response.getOutputStream();
for(int n = 0; n < bytes.length; n++) {
sout.write(bytes[n]);
sout.flush();
sout.close();
}Then in my JSP, I use this:
<img src="/path-to-servlet/image.jpg"/>
The name of the image to display is in the URL as well as the path to the servlet. The servlet will therefore need to extract the image name from the url and call the database. -
Can anyone please help me with this: I have created my own website on IWeb and now I want to use some of my banners on other websites. Problem is: there is something wrong when I fill in the img src code. The banner does not appear, only a question mark. I do not know the answer to that: am I using the wrong URL code or is it something else? I have placed my banners in the public folder, but that makes no difference. Thank you in advance for your help.
Welcome to the discussions. Assuming your image is in the top level of your iDisk's Public folder, the HTML should look similar to this:
<IMG SRC="http://idisk.me.com/membername-Public/Image.jpg"/>
...If the above doesn't help, post back here with the HTML you're using. You can convert it to character entities for display in this forum via _this site_. -
Using multiple img src / with htmlText --display problem
I need help.
I am using multiple <img src /> tag with htmlText and
pictures displays in layers(overlay)?
html_txt.html = true;
html_txt.htmlText = "text<br><img src = '
http://picture1.jpg 'width='500'
height='491' hspace='0' /><br>more text<br><img
src = '
http://picture2.jpg' width='299'
height='612' hspace='101' ><br>end with text";
Is there any way to refresh text field when pictures are
fully loaded so it will display like regular html page?
this is flash version, evrything is shown but it is not
right.
http://www.sosui.jp/flash/test/v001/pages/home/homeBlogV002.swf
I want to show them like this page.
http://sosui.jp/flash/test/v001/pages/home/blog.html
I tried onEnterFrame but pictures will not show. I think it
is because it is trying to load pictures everytime. So I cannot use
onEnterFrame, i need other way to refresh text field.
Please help me. you might of guessed I am not an English
speaker, so my English might be little off.
Thank you.does anybody know anything? how long do i need to wait to see
if someone replies? I just need to know if it is possible or not. -
Has anyone managed to have the "alt" tag on an image <img src="abc.gif" alt="my image descriptor"> or the title tag (such as in ) work in the JavaHelp. If so, how did you accomplish the task. I have exhausted every avenue and have not been able to get those tags to work. They display fine in all browsers (IE, Moz, Firefox and Netscape), I am baffled.
Furthermore, I have still to be able to get any of the org.netbeans.modules.javahelp.* to work of the JavaHelp. Checked all params and values, they are correct, but all i get in the JavaHelp are the cursed ??. Is their a file or library that needs to be included at the top of the HTML file?
This question is also posted in JavaHelp Blogs
Thanks
PabloI have posted similar items in every blog i could think of in order to fetch an answer. Unfortunatelly, my belief is that JavaHelp is unable to support the alt and title tags within html code.
TY Balus
ps I wish I could award more stars for an answer to this dilema...
Edited by: pablodiaz on Dec 4, 2008 9:21 PM -
Dear Friend If I query in a database and the database return a url and with this url I like to generate an image in jspx.
*The syntax work ok with the jsp <img src=<c:out value="${abc.xyz}" />*
*But with jspx it shows syntax error of < What you people recommend for it.*I stored all pix in my Tomcat web server where the url of them is as
http://localhost:8080/pix/anna.jpg etc.
and I stored the same url in the database table.
<?xml version="1.0"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:sql="http://java.sun.com/jstl/sql"
version="1.2">
<jsp:directive.page contentType="text/html"/>
<jsp:directive.page import="java.util."/>
<jsp:directive.page import="java.text."/>
<html>
<head>
<title>Snap Diary</title>
</head>
<body bgcolor="white">
<sql:query var="img">
SELECT snap FROM snap_pix
WHERE name =?
<sql:param value="${param.name}" />
</sql:query>
<img src="${img.snap}" />
<p>
<form action="recentsnap.jsp" method="post" >
<input type="submit" value=" Recent Snap " />
</form>
<form action="oldsnap.jsp" method="post" >
<input type="submit" value="Old Snap" />
</form>
</p>
</body>
</html>
</jsp:root>
the right click on image show this url http://localhost:8080/Snap_Diary/${img.snap}
where the actual folder in which I stored snap is http://localhost:8080/pix/ and the url which I stored in the database
is also as http://localhost:8080/pix/anna.jpg etc...
Query should return the value as http://localhost:8080/pix/anna.jpg not as http://localhost:8080/Snap_Diary/${img.snap}. -
Regular Expresson to Extrcat URLs from img src tags
Hi,
I have a huge string containing html tags, some of these tags being <img src="URL"> ones. I need to extract the urls from all the occurences of these tags in the input string. This is what I am doing:
Pattern p=null;
Matcher m= null;
String word0= null;
String word1= null;
p= Pattern.compile(".*<img[^>]*src=\"([^\"]*)",Pattern.CASE_INSENSITIVE);
m= p.matcher(txt);
while (m.find())
word0=m.group(1);
System.out.println(word0.toString());
}The problem with this code is that this prints only the last URL. For example if there are 5 <img src="URL"> tags, this code prints only the URL contained withn the 5th< img src> tag. Please tell me how to solve this.
Thanking you in advanceHere's another approach:
ok so this is assuming that the source text is not one line of strings, but mulitple lines.
String[] lines = txt.split("\n")this splits the string based on the newline character. then you can iterate through the array and use the pattern on each string. The only thing that can go wrong here is if there are two images in one line of code. Then you can use some of the methods in the String class to find each instance of "img src=", and you can figure out the rest.
another, better, way to split the string is with a string tokenizer (simple method in my library):
* Returns an array of strings from splitting the givin string
* with the given deliminator. See the example<br/>
* <br/>
* <i>Example:</i><br/>
* <code>splitTokens("ID: 1920129 NAME: JOHNY IAMYOURFATHER: IDONOTWANT", ": ")</code> would return:<br/>
* <code>["ID",190129","NAME","JOHNY","IAMYOURFATHER","IDONOTWANT"]</code>
* @param base
* the string to be split
* @param delim
* the deliminator that is used to split the string. If the
* deliminator is <code>", "</code>, then the string will be
* split on any combination of commas and spaces, along with
* individual commas and spaces.
* @return an array of strings split from the base string by the deliminator
public static String[] splitTokens(String base, String delim) {
StringTokenizer toker = new StringTokenizer(base, delim);
String pieces[] = new String[toker.countTokens()];
int index = 0;
while (toker.hasMoreTokens()) {
pieces[index++] = toker.nextToken();
return pieces;
}{code} -
IMG SRC="???" I've read old threads...
Hello,
I've spent 2 days pulling my hair out trying to get a servlet to present an image in html the same old boring easy way you would do it in a web page. I have searched this forum and read many threads, trying what each of them suggested, and uniformly failing to get anything going. In a last ditch effort, I am going to bug you folks with what is obviously an old problem. I certainly appreciate any help. By the way, I am a complete newbie to web programming, just in case that wasn't obvious ;)
Directory Structure
_________ROOT___________
| | |
WEB-INF PotteryPics index.html
| |
| _________
| | |
| Pottery Utility
|
| | |
classes lib web.xml
| |
| catalina-root.jar
|
org
|
apache
|
jsp
In total desperation I tried the following code just to see if it would work on the server machine. It did indeed produce a perfect looking page, but, of course, it failed when accessed from the web:
"<IMG SRC=\"C:/jakarta-tomcat-5.0.24/webapps/ROOT/PotteryPics/Pottery/Picture.jpg\">"
This also worked:
"<IMG SRC=\"C:\\jakarta-tomcat-5.0.24\\webapps\\ROOT\\PotteryPics\\Pottery\\ Picture.jpg\">"
This, however, and MANY other attempts similar to it uniformly fail:
"<IMG SRC=\"../PotteryPics/Pottery/Picture.jpg\">"
I'll refrain from saying anything more for now...no sense in repeating everything I tried with moving directories etc.
Thanks for you time,
Keith MyersNon-mangled version ( I hope )
_________ROOT___________
| | |
WEB-INF PotteryPics index.html
| |
| _________
| | |
| Pottery Utility
|
| | |
classes lib web.xml
| |
| catalina-root.jar
|
org
|
apache
|
jsp -
How to prevent 404 error in Img Src attribute
Hi everyone ,
I'm searching something like "spry:content" to be used with
image source attribute . Why i need this ?
When a spry page is first loaded , browsers try to get image
http://your_server/{image_url}".but
there is no such file and i got lots of 404 errors in w3svc logs .
Here is a simple example:
<div id="regionSolSerit" spry:region="dsSolSerit"
class="SpryHiddenRegion" >
<img alt="" style="display:none;border:0" width="165px;"
height="100px" src="{image_url}"
</div>
Waiting for solutions!I ran into this issue myself. Here is a solution:
1) Give the image a unique id.
2) Leave the "src" blank... // this will keep you from
getting a 404 error.
3) In your javascript, write an observer like this:
Spry.Data.Region.addObserver("regionSolSerit", {
onPostUpdate: function(){ // set observer for when the thumbnail
achors get loaded
var rows = dsSolSerit.getCurrentRow(); // get the data
var daImage = document.getElementById('yourimageId');
var daImage.src = rows['image_url'];
If you want to do something like multiple images like a
thumbnail gallery, you would put a for loop in the observer and
just cylce through the urls and place them.
Hope this helps... -
[javascript://www.google.com.br/ Google]
Use this excellent add-on:
[https://addons.mozilla.org/en-us/firefox/addon/noscript/?src=hp-dl-mostpopular NoScript add-on]
thank you
Please mark "Solved" the answer that really solve the problem, to help others with a similar problem. -
HtmlText: img src= from Library?
Hello Guys
I have a htmlText Field, and I wanna embed a Movieclip from my library into the text.
I've tried everything for about 5 hours, nothing worked, even though the Adobe Help stated that it's possible:
src: Specifies the URL to an image or SWF file, or the linkage identifier for a movie clip symbol in the library. This attribute is required; all other attributes are optional. External files (JPEG, GIF, PNG, and SWF files) do not show until they are downloaded completely.
So you can stick images from your library in html textFields... the question is how?
Thank you in advance.
KenjiWell, I was using the linkage and everything correctly. I found out my fault. I was using a TLF-Textfield which doesn't support the embedding of library images (or does it??)
It works in classic textfields though, but in classic textfields, the textflow is totally broken with images. Instead of inserting it into the textline, it creates a new line, only for the picture. But for my purpose (chat smileys) that's of no use. I need my pictures right in the text line where they have to be...
Like <-- this.
And not like <--- this, as it is with classic textfields.
Does anyone know how to embed library movieclips into a TLF-Text?? -
Hey all
Nevermind!
cheers
Message was edited by:
syncroSeniorProject, don't cross post the same question in multiple forums.
AnanSmriti: No, that is incorrect. That code is for including jsp pages - NOT images.
http://forum.java.sun.com/thread.jspa?threadID=721993&messageID=4165741#4165741 -
How to mark holidays in facory calendar img src='images/watch-16x16.gif'
Hi,
I need a help.
How to mark holidays in facory calendar.
Reward points will be given for helpful answers.HI
Go to Transaction SCAL and Choose Holiday Calendar and click on change (Pencil) button.
Then click on create button and enter holidays and save.
Note: Once you complete creation of Holidays, finally click on transport button on main menu. THis will create transport request.
Hope it helps.
regards
Srinivas -
HTML img tag and src attribute as a byte[]
Hi everybody
I have a question is it possible to send a byte[] to the src attribute in a <img> HTML tag. What i would like to gain is a way of reading an img file from the jar in a custom tag which is no problem. Problems start when i want to send a byte[] which I have read from the InputStream to the StringBuffer which contains the HTML code.
byte[] dataByte = null;
String charEncoding = "UTF-8";
InputStream in = imageURL.openStream(); //InputStream to the img file inside a jar
StringBuffer buffer = new StringBuffer();
StringBuffer sb = new StringBuffer();
String imgData = "";
int data;
while((data = in.read()) != -1)
buffer.append(new Integer(data).toString(), charEncoding);
imgData = buffer.toString();
dataByte = imgData.getBytes();The problem starts in this line, i think i need some encoding to do this.
sb.append("<img src=\""+dataByte.toString()+"\">");thx in advanceI know that u can do something like that :
<html>
<body>
</body>
<IMG
SRC="data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAwAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFzByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSpa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJlZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7"
ALT="Larry">
</html>I want to do exactly the same thing but via custom tags. The problem is as u say i have some data in the src attribute but the web browser doesn't interpret it right. sory for the long html source.
Maybe you are looking for
-
Add data item from a table to another table
I have two tables, "Model" and "Colour". Fields of Model are "Id", "ModelId" and "ModelName" and fields of Colour are "Id", "ColourId" and "ColourName". These two tables have one to many relationship. A model must have a colour. One Colour can have
-
Can we create routine for PO excise duty should calculate at basic amount
Dear All, can we create routine for Purchase order excise duty should calculate at basic amount not after discounted value. actually at per current scenario system is calculating excise duty after discount base amount, but we want to write a routin
-
Hi there, I made a CD booklet and submitted it to an internet print service as a pdf. I was told the document had to be changed from RGB to CMYK 8for ten bucks). Ok. The printout turned out to be very different from the proof print I had made at a lo
-
I have an iBook G4 with external keyboard and mouse. The help screen says if I put the iBook to sleep and close the lid, I can hit any key and my external Monitor will wake-up. Unfortunately it wakes up for just a second and goes right beack to sleep
-
Openbox feh wallpaper overwritten
It's a very strange thing that's happening. feh loads the correct initial wallpaper, but this mild grey 'wallpaper' covers it. And after some programs load (like aMSN), I have to drag, for example, aMSN around the screen to 'clean' off the grey wallp