Having Problems With a Simple Thing: ImageIcons

this is part of my code:
public void buildToolBar(){
saveIcon = new ImageIcon("images/save.jpg");
searchIcon = new ImageIcon("images/search.jpg");
saveButton = new JButton(saveIcon);
searchButton = new JButton(searchIcon);
toolBar = new JToolBar();
toolBar.setFloatable(false);
toolBar.add(saveButton);
toolBar.add(searchButton);
i'm using NetBeans 5.5, and for some reason this doesn't work. the buttons show up in the toolbar but they do not have the images that i want in them. maybe i'm putting the images in the wrong directory?

No size has got nothing to do with it. Troubleshooting, I would ask these questions:
1. What image format are you using? Can Java read it?
2. Double-check the file name and be careful with upper/lower case.
3. Make sure it is in the directory you think it should ne in.
Here's a quick app to see if Java can read and display the file:
import java.io.*;
import java.awt.event.*;
import javax.swing.*;
public class ImageView {
    public static void main(String[] args) {
        final JLabel label = new JLabel("", SwingConstants.CENTER);
        Action open = new AbstractAction("Open"){
            JFileChooser chooser = new JFileChooser();
            public void actionPerformed(ActionEvent evt) {
                if (chooser.showOpenDialog(label) == JFileChooser.APPROVE_OPTION) {
                    label.setIcon(new ImageIcon(chooser.getSelectedFile().getPath()));
        JMenu menu = new JMenu("File");
        menu.add(open);
        JMenuBar bar = new JMenuBar();
        bar.add(menu);
        JFrame f = new JFrame("ImageView");
        f.setJMenuBar(bar);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.getContentPane().add(new JScrollPane(label));
        f.setSize(600,400);
        f.setLocationRelativeTo(null);
        f.setVisible(true);
}

Similar Messages

  • I´m having problems with a simple synchronized move

    When using the "flex_start" function with the parameter AxisOrVectorSpace
    set as 0X00 (MULTIPLE_AXES), is it possible that some axes move ahead of the others or does the Flex Software secure the synchronization?
    I use motion controler 7344.

    Please allow me to clarify my previous statement. Vector spaces greatly simplify synchronized movement across multiple axes because the generated trajectory is done on the vector. It is possible to start and end the moves of multiple axes without using a vector space; however, you will have to use a multi-start and then calculate the appropriate move constraints for each axis that brings it to the end of travel with the other axes.
    The FlexMotion software will attempt to adhere to the calculated trajectory for each axis, and assuming these parameters are properly set such that all axes arrive at their end of travel at the same time, the axes should maintain synchronization. Factors such as one axis facing a significantly greater load than the others m
    ay cause that axis to temporarily get out of sync, but this should only be for one PID loop update period. If you are using a closed-loop stepper system and your motor is missing steps that axis may deviate from its calculated trajectory, and the FlexMotion software will try to compensate for this at the end of the movement by doing up to three pull-in moves.
    I hope this better answers your question. Best wishes!

  • Having problems with ipad mini and Siri. Works sporadically, will work once and then the second time not. Worked all the time with the original Mailbox app. Then started doing the same thing when I installed the new update so wondering if it is software?

    Having problems with ipad mini and Siri. Works sporadically, will work once and then the second time not. Worked all the time with the original Mailbox app. Then started doing the same thing when I installed the new update so wondering if it is software?

    Hi,
    I have the check box on a second Partition  but not on the Time Machine one
    I forget what I did now to get this called "Recovery HD"
    For the rest try https://discussions.apple.com/docs/DOC-4055  User Tip that links to Pondini's work on Time Machine.
    10:17 pm      Friday; May 2, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • After upgrade to ios7, few time i am having problem with my sound/speaker with terroble sound effect like machine or something.but after restart it will be fine.but how this thing can be fix? Because i never had this problem before upgrade to ios7.tq

    After upgrade to ios7, few time i am having problem with my sound/speaker with terroble sound effect like machine or something.but after restart it will be fine.but how this thing can be fix? Because i never had this problem before upgrade to ios7.tq

    Try going into your settings and 'reset all settings'
    You will need to retweak your device but it's been said to help with sound issues.

  • For users having problems with Mail functionality...

    Hello! I have been having problems with Mail functionality as well, so, I took a few steps to see if I could solve the problem on my own.
    My problems were:
    Mail would freeze when sending mail, or, when I pressed quit, it would freeze.
    If I toggled between inboxes too much it would freeze up.
    Even after trying the many techniques others offered on this board, Mail still froze up. So.. here's what I did:
    1.) Turn off the auto-retrieve mail function in the preferences/general menu. Set it to a manual check. Just check it yourself every once in awhile. It may not be as convenient, but it works, trust me.
    2.) Under the fonts and colors menu, set all three fonts to the SAME font (mines Century Schoolbook, but anything works) and turn off fixed-width font. Sometimes mail has a tough time decoding and working with texts, and causes it to freeze.
    3.) Clean our your main inbox! Place the emails that you want to keep, but don't need to be in your inbox in a new folder on your inbox bar (mines aptly named 'Saved Messages.' That way, when you open up Mail to your default account, it doesn't have 1,000+ messages to index. Also, try to keep the inboxes from having more than 100-200 messages per. It seems to frown on any more than that.
    After trying these three easy, steps, restart mail and see if things run smoother. I have had no problems since these changes, and mail runs a ton better. Plus you don't have to worry about deleting your library/mail folder anymore. Let me know if things work out so I can see if my theory is a universally proven thing. Thanks and good luck!
    iMac G5 20"   Mac OS X (10.4.5)  

    Good question. I have worked very little with IMAP other than as a testing device, so, on a daily routine I cannot say how it would function. However, I can only expect that by having the option to download all emails for offline viewing selected, you are right in it being a lag creator. Another suggestion would be, if you are running a single-computer setup, to have the account delete emails from the server after recieving them on your computer. Thus, you reduce the risk of repeat downloads or unnecessary build-up on the server end. DO NOT select this option if you run multiple computer set ups on one AppleMail account system or you will cause some discrepancies and/or data loss from system to system. Or, if you have emails redirected from a seperate server to Mail (i.e. I redirect mail from my university email account into Mail so that I don't have to go to the web-mail site to check it--> just like Gmail or Yahoo etc etc) you won't be able to check them from the web-based email system if you have the system delete them. Ok that sounded confusing. Solution: have the system remove emails from the server after a week (or any period of time, just not immediately) so that, in the off-chance you need to use the online system, you will have access, and will give you a chance to check the emails on other systems without a threat of data corruption (by corruption i mean that frustrating feeling you get when you can't find that super important email that was in your inbox just 10 seconds ago on your desktop etc.)
    I will see if I can learn anything more about IMAP Ernie. Its definitley the biggest problem source for Mail, POP and .Mac being simple and functional as long as you don't play with the settings too much. As far as the issue of Offline viewing goes, try turning it off and seeing how Mail functions.
    BEFORE you turn it off, however, I recommend saving all of your emails in your inbox as a text file or something so, in case the server burps and has a brain flatuence, you don't lose anything. Been there, done that, thrown the books against the wall in a frustrated rage.
    My only reserve about the Offline Viewing is whether or not Mail will, when you click "recieve mail," have to re-download the emails from the server each time. If so, then it may end up taking longer and lagging more. The issue here is obviously minimizing the amount of activity between Mail and the email server without jeapordizing information on the server or multiple Mail programs on the same account. When we can find that balance, I think Mail's potential will be realized. Keep the questions coming.

  • Hi Can anyone help. I'm having problem with FaceTime on my IPAD .It connects but cuts out Simolarly when someone calls me it connects , then cuts out ThanksBrian

    Hi Having problem with FACETIME on my IPAD Connects to call but then cuts out , similarly calls in connect & cut out Can someone help. Brian

    My ipad is doing the same thing to it won't let me except a incoming call on Facebook and I don't know what to do

  • I am having problems with my itunes, when plugging my iphone or ipod to the laptop - i can see iphone/ipod in the top right corner of itunes but when i click this to the see what is on theis iphone/ipod the option is no longer there, this was working

    I am having problems with the new itunes set up ........
    when i plug in my iphone or ipod touch it shows in the top right hand corner of itunes
    BUT when i click on the shown iphone/ipod the icon its no longer there, i was useing this fine yesterday and it was showing yesterday what is on this ipod and would allow me to add/remove music, but now this option is no longer availlable - i have added a couple of albums to my itunes i can listen to the music from the laptop but cannot sync the ipods to trancefer these albums to the handheld devices -
    i have been trying to sort this all day with no luck not sure if there is a problems with itunes or is it something i am doing ????
    HELP !!!!!!!!!!!!

    BOB we need you urgently
    Perhaps Bob will see this thread, he is the professor in these cases.
    You do not use a WEP password but wpa/wpa2 on router and equipment.
    All equipment connects to WiFi, but for your iPad.
    Even with all other equipment WiFi off, you cannot connect your iPad.
    Your iPad connects to other WiFi nets correctly.
    All resets etc done on iPad and Router.
    Still I am not sure it is your router for sure, frustrating...
    I want to test 2 other things:
    1. in your iPad, set everything OFF in Settings/Cellular, turn off/then/on your WiFi, and see whether it will still not connect...
    2. If that does not do it: disconnect the router as well as the modem from the power, for 15 seconds, then reconnect the modem, let it fully start, then reconnect the routet let it fully start, turn of your WiFi in iPad, then on, and see whether it will connect.

  • I have been having problems with my iPod touch and my WRT...

    I have been having problems with my iPod touch and my WRT54G router. I am so frustrated right now because after following the various steps mentioned in one of these threads, following Earthlink's prompts, and speaking with Apple, my iPod touch will still not work. It is connected to the internet but will not download the pages. It is quite frustrating. I have changed from WPA to WEP, I switched the 4th Generated key to the 1st. I've disabled this, enabled that. I've done just about everything. I updated the firmware. I made the switch from a partial bridge to a full bridge. Still nothing seems to work. Does anyone have any other suggestions? The one thing I have not done is enter the Apple code into the iPod which searches for website...-- I cannot access the internet with my iPod so this web address does not work. If anyone has been successful, will you please give me step by step instructions? Yesterday I was on the phone with Linksys for about an hour. Before that with Apple for about an hour and before that with Earthlink. How it is that I can walk into a Bread Co. or Apple Store and immediately connect to the internet with my iPod but I can't in my own house?? Everyone seems to think it is someone else's problem so I've gone around and around. Not one of the Linksys support personnel suggested I look here on this community forum. I had to pay the $9 fee to have advanced Linksys help but still my iPod does not work and when I called back, the man I spoke with seemed to think the case was closed because my PC, Laptop, and iPod are connected to the internet -- the iPod just won't download the webpages or get mail. My iPod's IP address begins with 192. I would appreciate any help on this matter
    Message Edited by AlliW on 10-02-2008 02:06 PM

    I had the same issues with my iPod touch & iPhone. It's a known issue with the touch & Linksys G routers. Go into settings on the touch & do the following.
    1. Settings - wifi - linksys
    2. Erase your DNS settings & input same numbers as in router
    Settings.
    3. Http proxy should be
    in off position.
    4. Close out & open safari you should now have a wireless
    connection.

  • Having problem with dead key in Leopard

    Hello. I'm having problem with dead key in Leopard.
    In Tiger it was working, but in Leopard dead key "'" doesn't work.
    In Tiger I could use OPTION key as well to get Latvian special characters (both worked - OPTION Key and dead-key), but in LEOPARD OPTION key is the only possibility to get these characters.
    How can I get dead key "'" working?
    I'm using Latvian language with Latvian keyboard layout.
    Here are images how it looked in Tiger:
    1) Before dead key is pressed:
    http://amerix.no-ip.org/tmp/1.tiff
    2) After dead key is pressed:
    http://amerix.no-ip.org/tmp/2.tiff

    ok, i got answer
    so - first problem was that ukelele didn't work in leopard (it wasn't possible to start new layout), but it was possible to edit Tom Gewecke posted layout.
    There it is possible to change every thing (dead-key as well).
    So I edited it and now i have layout where dead-key works -
    http://amerix.no-ip.org/tmp/LatvianT.keylayout
    Just do what Tom Gewecke said with this layout. It should work!

  • Having Problem With Inspire 5.1 5300 rear speaker...

    After using my inspire 5.1 5300 for few year... right now im having problem with my rear speaker... just one channel was unable to start... Anyone know about repairing for speaker ? I Have try to switch to other channel it seem that just that rear speaker was unable to start... all should be ok... week before i still hearing sound from that rear speaker... but now it was unable to start. Anyone Have Any Idea Please Tell Me. Thank You

    Just to clarify, by "FCP 5 friendly source material," he means video files that are a format (codec) that FCP 5 supports. What FCP 5 supports can be found in the EASY SETUP list. If the format you are working with isn't there, say if your footage is H.264 or MP4 or some other web compressed format, FCP won't work properly.  It needs to be in an editing codec if you want FCP 5 to work with it.
    Also, you need to make sure that your sequence settings match the settings of the footage you are trying to edit. If you add a clip to the sequence, and immediately have to render, that's a big clue to say that something isn't right. You should edit without rendering at all. 
    The most important thing you need to do is properly set up your project from the start, and the best way to do this is to choose a setting from the Easy Setups, located under the Final Cut Pro menu. Once you do this, you’ll need to create a new sequence.  This is because the sequence that is already in your new project is setup for the typical default setting of DV/NTSC, or for the settings of your last project, which might not match what you are currently working with.  So delete SEQUENCE 1 and create a new sequence:
    This new sequence will contain the settings you chose in the Easy Setup menu, and should match the format you captured

  • Having problem with change of name in the datagrid Coding

    I am having problem with changing the name of the datagrid header text name for one of the data either in the flash file or the php file.
    The thing is i want to change the Course_Name to Course Name that has no underscore so that it will look nicer in the datagrid but if I change it in the php file like SELECT Course_Name as 'Course Name' ....., it will not turn out in the datagrid when I CTRL ENTER the flash file but the others like Price,description and display is shown.
    There is no problem with my php code but I do not know how to change the Course_Name into Course Name so please help me resolve this error that I am having.
    This is my flash code
      function goCourse(e : MouseEvent):void
      gotoAndStop(5);
      refreshResponder = new Responder (refreshSuccess, onFault);
      connection = new NetConnection ();
      connection.connect (gateway);
      dataDG.addEventListener (Event.CHANGE, gridItemSelected);
      refreshData (true);
      function gridItemSelected (e: Event): void {
      ID = e.target.selectedItem.ID;
      courseTxt.text = e.target.selectedItem.Course_Name;
      priceTxt.text = e.target.selectedItem.Price;
      descTxt.text = e.target.selectedItem.Description;
      private function getParams () {
      var param: Object = new Object ();
      param.ID = ID;
      param.Course_Name = courseTxt.text;
      param.Price = priceTxt.text;
      param.Description = descTxt.text;
      return param;
      private function refreshData (refresh: Boolean): void {
      if (refresh)
      connection.call ("Course.viewCourse", refreshResponder);
      private function refreshSuccess (result: Object): void {
      dataDG.dataProvider = RecordSetDP.toDataProvider (result);
         dataDG.columns = ["Course_Name","Price","Description","Display"];
      private function onFault (fault: Object): void {
      trace (String (fault.description));
    This is my php file code.
      function viewCourse()
      $this->connect();
      $sql = "SELECT Course_Name,Price,Description,Display
      FROM coursetb";
      return mysql_query($sql,$this->_connection);

    i don't see where you're calling your php file in your code, but change 'Course Name' to 'Course_Name' (or vice-versa) there.

  • I'm having problem with exporting video from premiere pro cc 2014

    I'm using Adobe Premiere Pro CC 2014 and I'm having problem with exporting video.
    When I click Export and media, the window for exporting appears and it starts exporting video.
    But after a few minutes, it looks like it has completed exporting video and says there's a bug in exporting.
    It literally says it has a problem with compiling, but I don't know what the real problem is.
    I tried many things like restarting computer and Premire Pro but it's no use.
    But it works when I use Adobe Media Encoder CC 2014 for exporting video.
    If anyone knows any possibilities about why this problem happens, please let me know.

    I'm having a similar issue.  When I go to export my project, I add it to the render queue, set it up with the h.264 settings that I've used with countless past versions of the program, and then hit render.  Randomly, at some point in the process, the render just stops and the ETA just keeps climbing.  I actually had to save an XMF file of the CC 2014 project and bring it into the previous CC version of Premiere just to finish it.  Even a clean re-install of CC 2014 doesn't work.

  • Hello, i am having problems with itunes store. it wont connect almost as if its hanging, any ideas how to fix this problem

    hello, i am having problems with itunes store. it wont connect almost as if its hanging, any ideas how to fix this problem

    BOB we need you urgently
    Perhaps Bob will see this thread, he is the professor in these cases.
    You do not use a WEP password but wpa/wpa2 on router and equipment.
    All equipment connects to WiFi, but for your iPad.
    Even with all other equipment WiFi off, you cannot connect your iPad.
    Your iPad connects to other WiFi nets correctly.
    All resets etc done on iPad and Router.
    Still I am not sure it is your router for sure, frustrating...
    I want to test 2 other things:
    1. in your iPad, set everything OFF in Settings/Cellular, turn off/then/on your WiFi, and see whether it will still not connect...
    2. If that does not do it: disconnect the router as well as the modem from the power, for 15 seconds, then reconnect the modem, let it fully start, then reconnect the routet let it fully start, turn of your WiFi in iPad, then on, and see whether it will connect.

  • Indesign CS6 on MACs with OS 10.8 are having problems with links

    Hi
    Indesign CS6 on MACs with 10.8 are having problems with links. All links to other files have to be updated when opening a file although definitely nothing has changed to the linked files.
    We can rule out our company's networking and the system hosting the files (HELIOS software on RedHat Linux VM). This happens with newly created Indesign files and with old ones. E.g. we create a file on Tuesday, save it and open it again on the exact same MAC on Wednesday and all links to other fiels (.indd, .png, .bmp, etc. nothing uncommon) have to be updated as they all show the yellow triangle + black exclamation mark symbol next to them. Has anybody else experienced this, What can we do? We have tried absolutley everything and updated all software from MAC OS to CS6 itself but nothing seems to help on the long run.
    Any further information required?
    M. Miller

    Thanks for your quick reply.
    We actually noticed that there also seems to be something wrong with the timestamps:
    If we open the infos via the MAC finder to a file (.psd e.g.) which is linked in one of our indesign files, it states a certain date of creation.
    If we then switch to the Indesign file we just opened in which we had to update all links and open the infos to exactly the same file we looked at in the finder, a different date of creation is stated. So there also seems to be a mistake here (hope it's clear what I mean).
    We are ruling out our network as the error cannot be "re-enacted". We have created numerous test files in Indesign (simple white page containing one link to a .psd file which is also used in one of the supposedly defective files) and have opened them on various MACs with various OS versions over the past days/weeks but unfortunately the files open without any notifications or errors.
    Just as a background: a few months ago, the problem seemed to occur between MACs with differing OS, 10.6 - 10.8 at first. A file which was created on a 10.6 MAC could not be opened without updating all links on a 10.8 MAC. That is why we updated everything to 10.8. The error did not occur for about 2-3 weeks but then reoccured again.?
    Have you heard anything similar?

  • I'm having problems with iPhoto and the facebook set-up.  Every time I attempt to do so it says an error has occured and try again later.  I have not seen a solution posted.  Therefore, how does one contact Apple to solve the problem?  I'm new to the worl

    I'm having problems with iPhoto and the facebook set-up.  Every time I attempt to do so it says an error has occured and try again later.  I have not seen a solution posted.  Therefore, how does one contact Apple to solve the problem?  I'm new to the world of iMac but I find it a bit frustrating trying to solve basic issues/problems:(

    For what it's worth, you posted this in 2011, and here in 2014 I am still having this same issue. Over the last two days, I have had to unlock my apple account 8 times. I didn't get any new devices. I haven't initiated a password reset. I didn't forget my password. I set up two factor authentication and have been able to do the unlocking with the key and using a code sent to one of my devices. 
    That all works.
    It's this having to unlock my account every time I go to use any of my devices. And I have many: iMac, iPad, iPad2, iPad mini, iPhone 5s, iPod touch (daughter), and my old iPhone 4 being used as an ipod touch now.  They are all synced, and all was working just fine.
    I have initiated an incident with Apple (again) but I know they are just going to suggest I change my Apple ID. It's a simple one, and one that I am sure others think is theirs. I don't want to change it. I shouldn't have to. Apple should be able to tell me who is trying to use it, or at least from where.
    Thanks for listening,
    Melissa

Maybe you are looking for

  • Need clarification on BEX variable usage in customer exit.

    hi, i am an ABAP guy,i dont have any idea about BW,But here i got one problem, 1)Variable has been craeted in BEX Report (processed by Customer exit). 2)i am trying to write ABAP code in CMOD customer exit(ZXRSRU01),but when i am calling BEX variable

  • Acl type

    Hello all What is the difference between acl types: accesscontrollist and systemaccesscontrollist. The documentation is not clear. I created a accesscontrollist acl with read permission bundle for a users group, and apply it on some documents. But i

  • Brightness not adjustable in Windows 8.1 Sony Vaio (formerly sleep issue)

    AAAAAARGH. Whenever I hear the word VAIO my blood pressure rises. Model: VPCYB13KX/P (P=Pink) but the problem seems to be a universal oneMajor problems: cannot change brightness at all, closing the lid puts computer in non-responsive but 100% CPU sta

  • Iwork 09 serial number?

    i bought the family pack version but when I install I am being asked for serial number, but nothing was provided

  • DW CS3 Design view problem

    Hi all, I have RS elements on a page and the following code to repeat region, the region does not repeat row after row so I have modified it, but nothing is shown in design view after adding <tr> before "><?php } while ($row_poster_a2 = mysql_fetch_a