Can not display ImageIcon in a JLabel where you want in the code ???

Hello, everybody. I need your help to solve a problem I am on it for 2 days now :
In the constructor of my class, I have a lot of initializing methods. If I try to display an image (with ImageIcon in a JLabel) within one of these methods, there is no problem and the image is correctely displayed. To try that, I use an image stored on my local disk in "c:\\".
public class Bedes extends javax.swing.JFrame {
public Bedes() {
initComponents();
-- further initializations
initConnection();
public void initConnection() {
try {
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
Properties systemProperties = System.getProperties();
systemProperties.put("jdbc.drivers", driverName);
System.setProperties(systemProperties);
String dbURL = "jdbc:odbc:Bandes Dessin�es";
String strUtilisateur = "bedes";
String strMotDePasse = "cdle";
connectBedes = DriverManager.getConnection(dbURL,strUtilisateur,strMotDePasse);
catch (Exception e) {
System.out.println("Exception in DB Contact " + e);
// Here, I display an image in my JLabel, and it works :
couvertureAlbumString = "c:\\myImage.jpg";
couvertureAlbumsIcon = new ImageIcon(couvertureAlbumString);
couvertureAlbumsJLabel.setIcon(couvertureAlbumsIcon);
couvertureAlbumsJLabel.repaint();
}The problem is that I do not want to display these images there, but in a method that read some data's in a Database (with "try"-"catch" blocks). If there is a name of an image store in the DB, then it must be displayed in the JLabel (located in a JFrame -> JDeskTopPane -> JTabbedPane -> JPanel).
private void searchDetailsForAlbum(String albumsDetailsToSearch) {
String nomImageCouverture;
String couvertureAlbumString;
ImageIcon couvertureAlbumsIcon;
try {
PreparedStatement requeteDetailsAlbums = connectBedes.prepareStatement("SELECT * FROM bandes_dess WHERE bede_nom_tome = ?");
requeteDetailsAlbums.setString(1, albumsDetailsToSearch);
ResultSet resultatDetailsAlbums = requeteDetailsAlbums.executeQuery();
resultatDetailsAlbums.next();
collectionAlbumsJTextField.setText(resultatDetailsAlbums.getString(6));
genreAlbumsJTextField.setText(resultatDetailsAlbums.getString(9));
dessinateurAlbumsJTextField.setText(resultatDetailsAlbums.getString(10));
scenaristeAlbumsJTextField.setText(resultatDetailsAlbums.getString(11));
coloristeAlbumsJTextField.setText(resultatDetailsAlbums.getString(12));
prixAchatAlbumsJTextField.setText(resultatDetailsAlbums.getString(13));
// Here is the name of the Image to de read
nomImageCouverture = resultatDetailsAlbums.getString(14);
catch (Exception e) {
System.out.println("Exception in searchDetailsForAlbum" + e);
couvertureAlbumString = "c:\\";
// Here, I check if there is a name for a picture in the DB
if (!(nomImageCouverture.equals("No"))) {
// If Yes, I want to display it
couvertureAlbumString = couvertureAlbumString + nomImageCouverture;
couvertureAlbumsIcon = new ImageIcon(couvertureAlbumString);
couvertureAlbumsJLabel.setIcon(couvertureAlbumsIcon);
couvertureAlbumsJLabel.repaint();
}My JLabel is well displayed, but empty, without any image on it. WHY ???
MLK, you asked me to add some debug code. OK, with pleasure, but what is that "debug code" ???
Thanks a lot in advance if you could help me.
Christian.

DEBUG: couvertureAlbumString: c:\Aldebaran-La-Photo
OK, the extension of the file was NOT present !!!
I added it and ..... it works pretty good !!!
Thank you for your idea of the DEBUG.
Christian.

Similar Messages

  • I am trying to complete a form but can't get to the final drop down question as it is not displayed because it falls below where my screen ends.  i have tried changing the resolution but that doesn't work.  any suggestions?

    i am trying to complete a form but can't get to the final drop down question as it is not displayed because it falls below where my screen ends.  i have tried changing the resolution but that doesn't work.  any suggestions?

    brilliant
    google chrome works where safari doesn't on my macbook air.  many thanks
    i now have an embarrassing qu.  have dowloaded spider solitaire (sad!) and i can't add cards at the bottom of a column for the same reason - the display cuts short.  i have tried to extend it with the arrows in the bottom corners but it makes no difference.  any ideas?

  • Strange scenario,Oracle can not display the data in mysql correctly

    I use Heterogeneous Service+ODBC to achieve "oracle access mysql"(any other method?),and now i find Oracle can not display the data in mysql correctly:
    -------mysql------------
    mysql> create table tst(id int,name varchar(10));
    Query OK, 0 rows affected (0.00 sec)
    mysql> insert into tst values(1,'a');
    Query OK, 1 row affected (0.00 sec)
    mysql> select * from tst;
    ------------+
    | id | name |
    ------------+
    | 1 | a |
    ------------+
    1 row in set (0.00 sec)
    mysql> show create table tst\G
    *************************** 1. row ***************************
    Table: tst
    Create Table: CREATE TABLE `tst` (
    `id` int(11) DEFAULT NULL,
    `name` varchar(10) DEFAULT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8
    1 row in set (0.00 sec)
    -------------oracle ------------------
    SQL> select count(*) from "tst"@mysql;
    COUNT(*)
    49
    SQL> select * from "tst"@mysql;
    id
    1
    SQL> desc "tst"@mysql;
    Name Null? Type
    id NUMBER(10)

    You can make the following query on the result page:
    "select * from the_table where movietitle = ? and cinema = ?"
    then you set movietitle and cinema to those which the user selected. If the resultset contains more than 0 rows, that means the movie is available.
    Below is the sample code, it assumes you have a connection to the database:
    PreparedStatement stat = myConnection.prepareStatement("select * from the_table where movietitle = ? and cinema = ?");
    stat.setString(1, usersMovieTitleSelection);
    stat.setString(2, usersCinemaSelection);
    ResultSet res = stat.executeQuery();
    if (res.next()) {
    out.print("The movie is available");
    } else {
    out.print("The movie is not available");
    }Now just add that to your JSP page. Enjoy ! =)

  • SuperFrench is found but this font can not display any text

    "SuperFrench" font comes from Autodesk. this fonts's real file name is supef__.ttf
    If it is placed in C:\Windows\Fonts folder then it is available for Windows native apps such as MS Excel.
    Java GraphicsEnvironment finds "SuperFrench" font
    but this font can not display any text.
    This happens in both Java6(1.6.0_34) and Java7(1.7.0_06)
    try this
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    public class FontTest01 {
      public static void main( String[] args ){
        FontTest01 app = new FontTest01();
        app.run();
      void run() {
        String fontName = "SuperFrench"; //** SuperFrench font
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        String[] existFontNames = ge.getAvailableFontFamilyNames(Locale.ENGLISH);
        boolean fontExists = false;
        for( int i=0 ; i<existFontNames.length ; i++ ){
          if( existFontNames.equals( fontName ) ){
    fontExists = true; break;
    if( fontExists==false ){
    System.out.println( fontName +" does not exist" );
    System.exit(-1);
    JLabel label = new JLabel( "ABCDEFG" );
    Font font = new Font( fontName, Font.PLAIN, 20 );
    System.out.println( font.getFontName() );
    label.setFont( font );
    JFrame f = new JFrame();
    f.add( label );
    f.setSize( 180, 120 );
    f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    f.setVisible(true);
    Edited by: TadashiOhmura on 2012/06/17 23:04
    Edited by: TadashiOhmura on 2012/06/18 7:50                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Thank you for your replay.
    I face the same trouble with JavaFX
    I report this problem into Jira and filed as RT-22641
    Some members of Oracle developer team write comments for this issue.
    http://javafx-jira.kenai.com/browse/RT-22641
    This font has some irreguler structure.
    I hope Java font system will deal with it.

  • Why teststand can not display the ASCII character which number up to 128?

    Hello All,
            I have encountered a problem on an application for ASCII character,why teststand can not display the ASCII character which number up to 128?
           For example:an expression  Local.xx=Chr(164),
           xx-->string,I can not get the correct string.
           Have any idea for this?
    OS:WinXP,Teststand2012 SP1.
           Thanks a lot.
    Solved!
    Go to Solution.

    dug9000 wrote:
    [...]On Windows 7 at least, the code page setting for the operating system is located in the "Region and Language" control panel in the "Administrative" tab where it says "Language for non-Unicode programs".
    Hope this helps,
    -Doug
    Ah, that explains why i see "European Set"....
    One question, Doug: Obviously, you can select only the localization there. Is this PostScript Characters for all languages? Or is it possible to switch to something like true types, e.g. "Wingdings"? (I know, bad example, but i hope you get the point)
    thanks,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Date can not display correctly in excel from .jsp

    Hi,
    I create a .jsp report to export the data to excel. the report run OK, except the date field can not display correctly.
    for example in database :start date ='01-oct-2003'
    in the except it displays to 02/06/02.
    It seem all the date field can not be control in the report, and control by somthing else
    Doese anyone come accross this problem?
    Thanks

    Hi Rong,
    Are you using the following demonstration to build your JSP?
    http://otn.oracle.com/products/reports/htdocs/getstart/demonstrations/index.html
    (Output to Excel with Oracle9i Report)
    I tried to do the same, and inserted a database date field in the JSP using Reports. I found the following:
    While making the template inside Excel, if I make sure that the format of the date cells is "Date" - some particular date format, the date field values from Reports does not get exported correctly.
    However, if you make sure that inside the template, the format of the date cells is not date, but "General", then the date field values are correctly exported to Excel.
    Pl try it and let us know.
    Navneet.

  • MenuBar can not display all menuitem

    Hello,everyone!
    There is a Menubar.
    The Menubar has 100 menuitems.
    Problem:Can not display all menuitems.
    Do MenuBar's SubMenu has Scroller?
    Sample:
    <mx:MenuBar id="myMenuBar" width="450" height="50" >
    <mx:dataProvider>
    <mx:XML>
    <menuitem label="menuitem 1"/>
    <menuitem label="menuitem 1"/>
    </mx:XML>
    </mx:dataProvider>
    </mx:MenuBar>
    <menuitem label="menuitem 1"/>
    Can not display all menuitems.

    you might want to use some flexlib components lib
    take a look at this :
    http://code.google.com/p/flexlib/wiki/ComponentList
    and specifically at this component :
    http://flexlib.googlecode.com/svn/trunk/examples/ScrollableMenus/ScrollableMenu_Sample.swf

  • Urgent: Graph can not display

    Hi,
    My report can not display graph correctly if I view the report from report server in html format, because the graph url use report server's hostname, not IP. If I use IP view the graph, there are no problem.
    So my problem is how to config the report server for the graph display correctly?
    I tried to modify the IMAGEURL in rwservlet.properties, it doesn't work.
    I tried to modify the hosts file in local maching to mapping the report server hostname and IP, the praph can display, but it's not a good idea for all user to config their client maching .
    Thanks in advance.
    report url:
    http://172.20.137.205:7777/reports/rwservlet?htportalconn&destype=cache&desformat=HTMLCSS&report=usage_report.rdf&p_conn_string=htportalconn&P_Bill_Period=200806&p_report_id=41
    graph url in report (can not display):
    http://hk8sp202:7777/reports/rwservlet/getfile/HW/YX+J7DBjNFKgUnojRyFXmKwm2qqSnwR277aMm/561014461.jpg
    if replace the hostname with IP in graph url, graph can display:
    http://172.20.137.205:7777/reports/rwservlet/getfile/HW/YX+J7DBjNFKgUnojRyFXmKwm2qqSnwR277aMm/561014461.jpg
    Sammy
    Edited by: Sammy Song on Sep 8, 2008 12:54 AM

    Hello Anek,
    Refer to SAP Note 704604 and 454042.
    Also,
    http://help.sap.com/saphelp_nw04/helpdata/en/76/41d43ab8029b66e10000000a114084/frameset.htm
    and
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4846ac90-0201-0010-099d-d3b4e271849c
    regards
    Atul Shrivastava
    PS:Award points for helpful answer.

  • The admin page can not displayed completely

    Dear all,
    i have install OracleXEUniv,
    the www login page displayed OK, i can login
    after that i run . for update in rel 3.0 .. ..
    @apexins myadminpassword SYSAUX SYSAUX TEMP /i/
    .. the sql ran finish ok
    but when i try access the address
    the login page displayed not OK, image can not displayed, when i enter username and password, and click login, there is massage 'Error in page'
    how to repair that ? is wrong in my step ?
    i used :
    IE Ver 7
    Os XP
    thanks for anwer

    Hi,
    Make sure you followed the post-installation tasks mentioned in the Installation Guide.
    On a Windows system, you can copy the apex\images directory using Windows Explorer or execute a command such as the following from a command prompt:
    xcopy /E /I htmldb\images ORACLE_BASE\ORACLE_HOME\Apache\Apache\images
    On UNIX or Linux based systems, you can copy the apex/images directory by executing a command such as the following:
    cp -rf htmldb/images ORACLE_BASE/ORACLE_HOME/Apache/Apache
    Make sure that you have /i/ defined in one file (httpd.conf, marvel.conf OR dads.conf)
    -Priyanka

  • Hello after the installation of new software iso 6.0 I can not find youtube any more. Where is it now? Thank you.

    Hello after the installation of new software iso 6.0 I can not find youtube any more. Where is it now? Thank you.

    The YouTube app is not included in iOS 6. You will either need to try one of the YouTube apps from the store (there is an iPhone optimised app from google), or try accessing it via Safari : http://m.youtube.com (you can create a home screen shortcut for the site)

  • I am using windows 8. I have downloaded i tunes. but i can not find my i phone any where in i tunes menu. so I am having problem in syncing my phone. please guide me

    I am using windows 8. I have downloaded i tunes. but i can not find my i phone any where in i tunes menu. so I am having problem in syncing my phone. please guide me

    If the device doesn't appear as shown in the following instructions: http://support.apple.com/kb/HT1386
    then the following may help: http://support.apple.com/kb/TS1538

  • It can not displayed sap script

    i have to post invoice in vendor a/c,then run to APP successfully,then execute  spool,actually hear it can displayed ABAP list file, SAP script(otf) file,and SAP script file(otf) but hear only displayed ABAP list file, SAP script(otf) file it can not displayed vendor payment advice list why. pls give me answer

    Hi Shirley,
    I assume the hardware is less on the target than on the source or they are different at least in terms of hardware specs
    If the system is not starting, check the dev_disp.log, the stderr* files, and the dev_w0 log from the work directory to find the exact error. Does the system start if you increase or decrease this value?
    Regards,
    Paul

  • While Installing this error is coming This Program can not display the pag

    When I Try to Install SAP B1 8.8 on Win server 2008.
    I am receiving this message.
    This Program can not display the page
    The website is encountering Problem
    There might be a typing error in the address
    At the time of Installation which site we need to access.
    My Internet is working.
    Still i am facing this Problem please suggest me what should I do.

    HI Ram ,
    Internet is not required while Installation .
    Go through :
    Re: SAP Business Installation
    Thanks
    Ashish

  • IE can not can not display the website

    start -> all Programs -> oracle Home -> Database Control - ORCL
    when I click on ORCL  to open the GUI
    i am getting a internet error http:/localhost:1158/em
    IE can not can not display the web site How can I get the GUI to open
    Please advise

    In version 4.2 on the controller SSLv2 is disabled by default. IE by default doesn't do SSLv3. Either enable SSLv2 on the controller or SSLv3 on the client.

  • Layout - This Program can not display the webpage

    Hi Experts,
    I am trying to create adobe forms in Webdynpro ABAP, for that I created a Webdynpro component and then view in it and created the required attributes and nodes and the pdfsource as xstring type.
    When I go to Layout tab it showing "This Program can not display the webpage" and in route element container I created an element and gave as of Interactive forms but the system is not creating any interface nor going into adobe live cycle designer.
    Is it the problem with the Live Cycle Designer or what exactly I have to do now.
    Please help me out.
    Thanks,
    Praveen

    Hi.,
    This seems that u didnt maintained host entries.,
    Click Run -> enter drivers -> goto etc folder -> double click on hosts file -> open with note pad.
    there u need to enter the host entries., like .. 192.....<server_address> <tab> <domain> <tab> <host>
    ask ur basis team., they will configure that..,
    hope this helps u.,
    reply if u need some more clarifications.,
    Thanks & Regards
    Kiran

Maybe you are looking for