GIF icon wont display in JList
Hello.
During development of a single application I've encountered a strange bug:
I am unable to display a gif icon in JList using JLabel as the cell renderer. Png icons work.
Could someone please point me to the obvious flaw in my example? :)
Example as netbeans project:
http://www.megaupload.com/?d=GVCDVO1F
Example code:
* GifIconInList.java
* Created on 28. srpen 2008, 11:03
package gificoninlist;
import java.awt.Color;
import java.awt.Component;
import java.net.URL;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
* @author Bedla
public class GifIconInList extends javax.swing.JFrame {
DefaultListModel listModel = new DefaultListModel();
/** Creates new form GifIconInList */
public GifIconInList() {
initComponents();
class labelCellRenderer extends JLabel implements ListCellRenderer {
public labelCellRenderer() {
setOpaque(true);
public Component getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
if (value instanceof JLabel) {
JLabel label = (JLabel) value;
if (isSelected) {
label.setBackground(list.getSelectionBackground());
label.setForeground(list.getSelectionForeground());
} else {
label.setBackground(Color.white);
label.setForeground(Color.black);
return label;
return this;
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jList = new javax.swing.JList();
addPngButton = new javax.swing.JButton();
addGifButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jList.setModel(listModel);
jList.setCellRenderer(new labelCellRenderer());
jScrollPane1.setViewportView(jList);
addPngButton.setText("Add PNG");
addPngButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addPngButtonActionPerformed(evt);
addGifButton.setText("Add GIF");
addGifButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addGifButtonActionPerformed(evt);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 287, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(addPngButton)
.addComponent(addGifButton))
.addContainerGap())
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(addPngButton)
.addGap(37, 37, 37)
.addComponent(addGifButton))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)))
.addContainerGap())
pack();
}// </editor-fold>
private void addPngButtonActionPerformed(java.awt.event.ActionEvent evt) {
URL iconURL = GifIconInList.class.getResource("otevren.PNG");
Icon icon = new ImageIcon(iconURL);
JLabel label = new JLabel("PNG icon: " + icon, icon, JLabel.CENTER);
listModel.addElement(label);
private void addGifButtonActionPerformed(java.awt.event.ActionEvent evt) {
URL iconURL = GifIconInList.class.getResource("otevrenblik.gif");
Icon icon = new ImageIcon(iconURL);
JLabel label = new JLabel("GIF icon: " + icon, icon, JLabel.CENTER);
listModel.addElement(label);
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new GifIconInList().setVisible(true);
// Variables declaration - do not modify
private javax.swing.JButton addGifButton;
private javax.swing.JButton addPngButton;
private javax.swing.JList jList;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration
}
I had write a program to display gif images inside a JList.
Here is the code
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.*;
import javax.imageio.ImageIO;
import javax.swing.*;
public class ImageList
BufferedImage[] images;
JList list;
public ImageList()
loadImages();
list = new JList(images);
list.setCellRenderer(new ImageRenderer());
private void loadImages()
String[] fileNames = {
"1", "2", "3", "4"
images = new BufferedImage[fileNames.length];
for(int i = 0; i < images.length; i++)
try
String path = "images/" + fileNames + ".gif";
URL url = getClass().getResource(path);
images[i] = ImageIO.read(url);
catch(MalformedURLException mue)
System.out.println("url: " + mue.getMessage());
catch(IOException ioe)
System.out.println("read: " + ioe.getMessage());
public static void main(String[] args)
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(new JScrollPane(new ImageList().list));
f.setSize(400,400);
f.setLocation(200,200);
f.setVisible(true);
class ImageRenderer extends DefaultListCellRenderer
public Component getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
// for default cell renderer behavior
Component c = super.getListCellRendererComponent(list, value,
index, isSelected, cellHasFocus);
// set icon for cell image
((JLabel)c).setIcon(new ImageIcon((BufferedImage)value));
((JLabel)c).setText("");
return c;
Here is netbeans project:
[http://www.mediafire.com/?nl29dl4tteu]
Note: If you check image 2.gif inside the src/images dir you will found that it is an animated gif but JList is displaying it as static image.
Bedla if you want both image and text then create a class like thisclass ListItem {
private BufferedImage image;
private String value;
public ListItem(
BufferedImage c, String s) {..}
public Color getImage() {..}
public String getValue() {..}
Similar Messages
-
I have downloaded the new Lion OS X but the AirPlay icon wont appear in my menu bar. The option of AirPlay mirroring is turned on in the Display settings. No issues Air playing through iTunes. Need help. Thanks
AirPlay
AirPlay Mirroring requires a second-generation Apple TV or later, and is supported on the following Mac models: iMac (Mid 2011 or newer), Mac mini (Mid 2011 or newer), MacBook Air (Mid 2011 or newer), and MacBook Pro (Early 2011 or newer).
Several Apple Articles Regarding AirPlay
Apple TV (2nd and 3rd gen)- How to use AirPlay Mirroring
How to set up and configure AirPort Express for AirPlay and iTunes
Troubleshooting AirPlay and AirPlay Mirroring
Using AirPlay -
9iDS forms 9i gif icons won't display
I have been on metalink and have yet to get a ggod answer on how to make my gif icons appear on my forms in 9iDS Forms 9i. I am on adevelopment machine and have modified my %ORACLE_HOME%\forms90\j2ee\orion-web.xml by addidng the folling lines:
<virtual-directory virtual-path="/webicons"
real-path="d:\webicons" />
Then I modified %ORACLE_HOME%\forms90\java\forms\registry\registry.dat file to read:
default.icons.iconpath=/webicons/
default.icons.iconextension=gif
and I've tried
default.icons.iconpath=/webicons
default.icons.iconextension=gif
and I've tried
default.icons.iconpath=webicons/
default.icons.iconextension=gif
My %ORACLE_HOME%\forms90\server\formsweb.cfg reads:
imageBase=DocumentBase
I was told to remove imageBase=DocumentBase from %ORACLE_HOME%\forms90\server\basejini.htm but I only found:
<PARAM NAME="imageBase" VALUE="%imageBase%">
imageBase="%imageBase%"
in that file. But, even commenting on or the other or both did not yield positive results.
After each modification to the above files I made sure that I closed the browser and stopped and re-started the OC4J Instance before opening the browser.
Once again, I am doing this on a development computer with all files on that computer and I am NOT deploying any of this to 9iAS.
What is wrong?
TIA,
Ed.Ed,
You're right, there's no reason that you must use the jar file method. For testing, it makes sense to use your images "as is".
I think I see the problem with your config. You should always do this test to to verify that you can see your icons before running your Form: look at your icon in a browser.
You said that you modified %ORACLE_HOME%\forms90\j2ee\orion-web.xml and created the following virtual path:
<virtual-directory virtual-path="/webicons" real-path="d:\webicons" />Restart your OC4J listener, and see if you can see the icon in your browser:
http://host:port/[color=red]forms90[color]/webicons/someicon.gif
I bet you can. That's because you edited the orion-web.xml for Forms, which affects everything under the /forms90/ path. That is, host:port/forms90/ is the document root to that orion-web.xml. This is perfectly ok, but in your registry.dat, you need to put in the full thing:
default.icons.iconpath=/[color=red]forms90[/color]/webiconsIf you want to do it the "normal" way, modify the following:
%ORACLE_HOME%\j2ee\Oracle9iDS\application-deployments\default\defaultWebApp\orion-web.xml
This is the xml file for the base web listener. Now you can see the icon in your browser:
http://host:port/webicons/someicon.gif
which will let you use the following in your Registry.dat file:
default.icons.iconpath=/webiconsSee, I told you that you were close!
Regards,
Robin Zimmermann
Forms Product Management -
Menu toolbar icons not displayed in colour when deployed on the Web
Hello!
We are developing an application using Forms6i on Windows NT.
Our problem is that menu toolbar icons are not displayed in colour when the application is deployed on the Web using lookAndFeel = generic. This is the case both when using Microsoft IE5 and Netscape 4.5. When lookAndFeel = oracle, however, the icons are displayed in colour.
The icons are stored as *.gif files in the same directory as the application *.html file. It does not help to create a virtual path /web_icons/ in the www listener and edit the parameter default.icons.iconpath in the file Registry.dat.
When running the application as client/server, the menu toolbar icons are displayed in colour as expected.
Any ideas on how to solve this problem?
Regards,
Kjell Pedersen
Nera SatCom AS
Norway
nullHi,
I got the same problem and I didn't figure out, how to solve this problem.
But did you try to printout the form anyway? I guess you will see the icons on the printout, won't you?
Regards
Dirk -
I am getting problem in displaying icons in the toolbar.
Before posting here, i have gone through all the threads related to it, but could not get my problem fixed.
Following steps have been followed:
1- created jar file of the GIF images i.e. my.jar. All the images were in the root directory.
2- Copied the jar file to G:\DevSuiteHome\forms\java directory.
3- In the form, in the property of menu item, i specified the exactly same image file name with no extension.
4- Modified the formsweb.cfg file with following changes:
archive_jini=f90all_jini.jar,my.jar
imagebase=codebase
i can access the jar file in the browser using the following url:
http://<servername>:8891/forms/java/my.jar
The platform is Windows 2003 with Developer suit 10g.
Kindly help me to fix this problem.
ThanksWithout changing any configuration, however, when i execute the application by entering the following command into the start->run menu
iexplore http://ssi-mmunir.ssilhr.com.pk:8891/forms/frmservlethttp://ssi-mmunir.ssilhr.com.pk:8891/forms/frmservlet?config=summit
then application successfully display the icons in the toolbar.
But when it is executed from form builder, no icons are displayed. -
Icon wont appear in Cover Flow_Help
I can't get Cover Flow to show any of my personalized Icons. What am I doing wrong?
Here's what I've done so far:
I copy the new image that I want to use as a new icon
In finder I open *"get info"* and highlight the current icon
then I select paste from the edit menu
and the new icon saves
Once I closed get info the new icon is displayed in the finder window, the side bar and even the dock. Cover Flow shows a blank space as if nothing's there. I've tried saving the image icon as gif, jpeg, and tiff...
Any suggestions for a Fashionista????
And while your here maybe you can help me solve a Quick Look issue
Pages 08' displayed in Quick Look is a 'hot mess'. Quick Look snatches the images from my beautiful layout and mashes them all together on the last page of the document, then reformats the text into a gobbledygook mess. I even tried saving a unedited Mac Template and Quick Look destroyed that as well.
What can I do to solve this?
Thanx in advance,
Dolshea, +Cre8ivePros.com (coming soon)+I have exactly same problem.
-
my facebook (f) icon wont go away and i have no new notifications or messages. same thing with my myspace icon. anyone know how to fix this please???
Are those Facebook and MySpace notificiation icons in the upper part of your homescreen?
Tips for clearing that unread message... try them in order.
If you have a rogue New Message icon on your Homescreen, or a negative count (-1), any one of these solutions could clear it, or reset it to zero:
Try these options:
* Hard Reset the BlackBerry by holding ALT, CAP (right Shift key), and DEL (or with the BlackBerry powered ON, remove the battery and reinserting the battery)
* View Messages > Saved Messages
* View Messages > View Folders, check each folder (missed calls, SMS in and out boxes, MMS in and out boxes, Saved, browser, phone logs etc)
* Scroll to top of message folder, over the date heading, click or press menu to MARK PRIOR OPEN
* Change your theme and see if it persists, and change back to your desired theme. (Options > Theme > select.)
* Wipe and reload your OS.
1. If any post helps you please click the below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!
3. Install free BlackBerry Protect today for backups of contacts and data.
4. Guide to Unlocking your BlackBerry & Unlock Codes
Join our BBM Channels (Beta)
BlackBerry Support Forums Channel
PIN: C0001B7B4 Display/Scan Bar Code
Knowledge Base Updates
PIN: C0005A9AA Display/Scan Bar Code -
Dev 6 Tree and Gif icons, SDI mode on WEB URGENT
Has anybody successfully displayed an icon in GIF format in the
Dev 6 hierarchical tree in a browser?
Even when I hardcode the path to the GIF icon it is not
displayed as part of a node in the browser window. Everything is
fine in C/S mode.
Second problem is that in Netscape Navigator or MS IE the window
is displayed inside he browser even when I give usesdi=NO as a
parameter. So some things are not displayed correctly and my
users really like the separate window.
Thanks for any answer
Frank
nullFrank Huether (guest) wrote:
: Has anybody successfully displayed an icon in GIF format in the
: Dev 6 hierarchical tree in a browser?
: Even when I hardcode the path to the GIF icon it is not
: displayed as part of a node in the browser window. Everything
is
: fine in C/S mode.
: Second problem is that in Netscape Navigator or MS IE the
window
: is displayed inside he browser even when I give usesdi=NO as a
: parameter. So some things are not displayed correctly and my
: users really like the separate window.
: Thanks for any answer
: Frank
Hi Frank,
The gif image in the tree item works well. The fact is that you
have to put the image in the directory where the registry.dat
file in the forms60\java\oracle\forms\registry directory points
to. Nearby the end of the file you find the possibiity to enter
the directory of your gif files. It's advisable to use the
absolute URL pointing to your gifs.
To achieve a separate window for the forms applet just implement
the parameter "SeparateFrame=true" to yout start HTML File.
Since
you are using IE you should do it like follows:
<PARAM NAME="separateFrame" VALUE="true">
Hope it helps
Frank
null -
Error in applying gif icon on a button in 10g forms
Dear users...I wanna apply a gif image on a push button named "Pb_Ext" in my form but I'm being failed in this simple task :( For this purpose I've taken the following steps.
1: I made Iconic property to "Yes" and in icon filename property I gave the gif file name, in my case that is "bdone", which I got from 10g forms directory. (Is it necessary to write file extension with file name? Although I've tried both ways.)
2: I set up icons path value in registry.dat file as: default.icons.iconpath=H:\10g_Tst\03\03
default.icons.iconextension=gif
3: In formsweb.cfg file registry.dat file is defined as:
serverApp=default
So is there anything else remaining to be set up? Can u guess that where is the fault?One of this may help
Re: icons not displaying in oracle forms.
Re: Icon deploy issue in 10g forms
Re: cannot show icon images
Re: Step by step creation of iconic buttons -
My email (and messages) icon wont clear. It says I have 19 unread messages and the only thing in my email are 2 unread messages.
I have done the following:
Deleting everything in my message folder
Turning the phone off
Taking the battery out
Sending additional email to see if that re-sets it before taking the battery out
Nothing is working... Any thoughts?
Solved!
Go to Solution.You are very much welcome!
Would you mind, though, saying specifically what worked? The KB I linked for you was not terribly much different than my first reply to you -- so I'd like to know what worked for you so that I can provide that quicker to others in the future.
Thanks!
Occam's Razor nearly always applies when troubleshooting technology issues!
If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
Join our BBM Channels
BSCF General Channel
PIN: C0001B7B4 Display/Scan Bar Code
Knowledge Base Updates
PIN: C0005A9AA Display/Scan Bar Code -
Owner Informatio​n wont Display
Hi I have just got a Blackberry Curve 8520 but the owner information wont display when the phone is keylocked as on my last phone...anyone know why?
Hello,
Depending on the OS version, the function of locking has changed. In the more recent versions, the simple keylock (via the top button) does not display the owner info. Only by assigning a device lock password AND locking in that manner (either via timing out or by using the on-screen password lock icon) does the owner info display.
Good luck!
Occam's Razor nearly always applies when troubleshooting technology issues!
If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
Join our BBM Channels
BSCF General Channel
PIN: C0001B7B4 Display/Scan Bar Code
Knowledge Base Updates
PIN: C0005A9AA Display/Scan Bar Code -
Animated gif icon for an exception instead of the standard icon?
Hello,
is there a possibillity to use an animated gif icon for an exception instead of the red standard icon in a web template?
I tried to change the standard icon s_s_ledr.gif against an animated gif icon in the mime repository, but it does not work. In the IE the icon is still shown without animation.
Maybe I´ve changed the wrong icon?
Can you please help me?
Greetings
Andreas
Edited by: Andreas Zenner on Feb 25, 2009 1:22 PMHi Andreas,
it is possible to integrate own symbols for exceptions. If you can use animated gif I don't know. However there is a post over here explaining the usage of the modification for symbols:
Re: BI 7 Web Design API - Parameter modification - Exception symbol
If you have questions just let us know.
Brgds,
Marcel -
Double clicking on an Icon to display a frame....
Hi! I have an icon whereby when double clicked on should display a frame. To display the icon, I have it as an ImageIcon placed on a label, which works fine. But my problem now is what kind of listener can I add to this label, if any that will cause this frame to be displayed? OR if you have an idea of going about or around this, I'll really appreciate it!! Thanks a lot in advance!!
Cheers,
BoloThanks a lot again Radish! It worked fine. I got another question, which I hope you'll be willing to answer. Hope I'm not being a pain in the butt?
After the user double clicks on an icon to display a window(step by step wizard), the panel on the frame contains "back" and "next" buttons. And of course the button on the last panel will say finish instead of next. All of this is working fine. My problem is that whenever I re-launch the wizard, it displays the last panel which contains the finish button instead of the first panel. Do you have any ideas of how I can fix this? Thanks a lot in advance!!
Cheers,
Bolo -
Hi,
Acrobat xi - RE: Add sound icon- skin displayed is a 'blank white box' until it is clicked to activate it- can you lock skin to display before its activated so that in a print run the skin shows up (ie the controls-or any kind of greyed out rectangle, like video controls before 1st activation) and not the blank white box- if no, I guess I have to activate all sound icons before doing a print run?thanks)).Many of your points are totally legitimate.
This one, however, is not:
…To put it another way, the design of the site seems to be geared much more towards its regular users than those the site is supposedly trying to "help"…
The design and management of the forums for more than five years have driven literally dozens of the most valuable contributors and "regulars" away from the forums—permanently.
The only conclusion a prudent, reasonable person can draw from this state of affairs is that Adobe consciously and deliberately want to kill these forums by attrition—without a the PR hit they would otherwise take if they suddenly just shut them down. -
MBP wont display 1080p on monitor any more
I have an early 2011 Macbook pro and a hp 2511x monitor. The setup worked flawlessly before I went off to school. Now that Im back home my macbook wont display 1080p on the monitor, only 720p. While attempting to display 1080p the monitor screen is blank but I am able to move my mouse over to the external dispaly just fine, just no picture. My mac will display 1080p on other external monitors & the monitor will work fine with other computers or xbox on 1080p.
Just upgraded from 10.7 to 10.9 and still not working properly.
Connecting from mini display to hdmi
Thanks!Hey adz2k14!
Here is an article that will help you troubleshoot this issue with your AirPlay functionality:
iOS: Troubleshooting AirPlay and AirPlay Mirroring
http://support.apple.com/kb/ts4215
Take care, and thanks for visiting the Apple Support Communities.
Cheers,
Braden
Maybe you are looking for
-
HI Apex Community I want to hide a column in a report based on an item(#item#) of the same report . for ex , if invoice is zero then hide DUE row of that particular client I tried with condition value is null equal to #invoice# but it hide the whole
-
Error Creating Web Application in Sharepoint Foundation 2010.
Hi, I am getting below error while creating new Web Application in SharePoint. Could not connect to Sharepoint using integrated security: SQL server at has an unsupported version 10.0.2531.0. I am using SharePoint Foundation 2010. SQL Server Version
-
hi all I would like to run JMS with Tocmat 4.1.24. and SUN J2EE. I encountered following problem. three days .... I can't solve this problem. there is a lot of this question in this forum. but no answer. so I try to again. this is very important to m
-
Hello Experts! I am using Oracle ImpDP to import a fresh DB to a test system. I was the impdp to create all the schema. My original import was done using sys as sysdba I am running the import using the same user. What option should I set in the par f
-
My appstore n camera icon has gone..anyone can help me..i already try to go setting and restriction but did not works.. I also cannot update ios..how to solve this problem..?