Cant add() a Canvas into a JPane

Hello all!
i having problem to include canvas within a JPanel.
i subclass the Canvas with an image , i test it and its works :
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.*;
import java.net.*;
public class testImage extends JFrame{
  public testImage(){
    imageViewer m = new imageViewer();
    m.initImage("http://127.0.0.1/image/samifox.gif");
    getContentPane().add(m);
  public static void main(String[] args) {
    JFrame frame = new testImage();
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          System.exit(0);
      //frame.pack();
      frame.setSize(300,300);
      frame.setVisible(true);
class imageViewer extends Canvas{
  Image image;
  URL url;
  Toolkit tool;
  public void initImage(String path){
    try{
      url = new URL(path);
    }catch(Exception e){
      System.out.println(e.toString());
    image = Toolkit.getDefaultToolkit().getImage(url);
    setImage(image);
  void setImage(Image image){
    this.image = image ;
    repaint() ;
  public void paint(Graphics g){
    super.paint(g) ;
    try{
       g.drawImage(image,0,0,this) ;
       //g.drawString("ssss",25,25,this);
    } catch (NullPointerException e) {
          System.out.println(e.toString());
}but i cant include this canvas subclass into a JPane i tried :
//xxx
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;              //for layout managers
import java.awt.event.*;        //for action and window events
import com.borland.jbcl.layout.*;
public class testPanel extends JFrame{
  myJPane mypanel;
   public testPanel(){
    mypanel=new myJPane();
    getContentPane().add(mypanel);
  public static void main(String[] args) {
    JFrame frame = new testPanel();
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          System.exit(0);
      //frame.pack();
      frame.setSize(300,300);
      frame.setVisible(true);
class myJPane extends JPanel{
  imageViewer imgViewer;
  public myJPane(){
    imgViewer = new imageViewer();
    imgViewer.initImage("http://127.0.0.1/image/samifox.gif");
    add(imgViewer);
i add and remove from  JPanel lots of component but when i had the use canvas it seem like i dont understand someting that very basic...
any kind of help will be appriciated
Shay

hi Pual!
Are you getting error messages? no , i dont get any compiler or run-time error
Or does the program run and not do what you expect? yes , exectly , you see i extend Canvas and i draw in it an Image. now i have extended JPane , i need to add the extended canvas to JPane, like i said i dont recieve any error but the program doesnt show the canvas on the JPane like i except it.
the Canvas does show in a JFrame but when i try too add the Canvas to JPanel , i faild.
i hope its more understandable now!
thank you
Shay

Similar Messages

  • I cant add .mp4 movie into itunes

    Hello there, I am just wondering why i cant add mp4 moive into my itunes, and I tried to set up automatic adding folder in my pc, but after i drag the moive into the folder, it automaticlly generate a folder called 'NOT ADDED'. I am wondering if there any reason i cant add this moive,it is very small, around 6m.
    thanks

    You can convert .m4p using iTunes.
    Make a playlist of files and burn to "audio CD". Use the new .aiff file in your iMovie Project.

  • Cant add .avi files into itunes

    as above..
    i have been clicking n dragging n it doesnt work..
    it opens fine in quicktime pro though..

    iTunes can't handle .avi files. If you have Quicktime Pro and are able to open them with it, you should also be able to convert to something more palatable using the Export function.

  • Used to convert all my videos into iPhone mp4 format using Any Video Converter - then add it to my iPhone 3GS. But last few days, I cant add video files to iTunes. and the iTunes doesnt even specify the reason except for that "files are not supported"

    Everyting was perfect earlier. Used to convert all my videos into iPhone mp4 format using Any Video Converter - then add it to my iPhone 3GS. But last few days, I cant add video files to iTunes. and the iTunes doesnt even specify the reason except for that "files are not supported"
    Everything is fine.
    -They are the right format
    -Quicktime is updated
    -I have tried simply dragging them into the 'movie' library
    -I have tried going to file<add file to library
    Nothing works, has anyone else had this problem and found a way around it?
    Any and all help appreciated.

    In addition to Mike's suggestions,  you only have 4GB of RAM and Mavericks does use more RAM than other versions. You may also want to look at the apps that startup on login and the possiblity of upgrading RAM.

  • Cant add song into iTunes, the song used to be in iTunes

    hello, i used to have many song in my iTunes library and they can be played. ok, here let me define songA..songZ that are the songs in my iTunes
    today, when i am listening songA, i want to listen songB, so i double click on songB in iTunes but it just response nothing and stop! i try to double click it again, still nothing happen. but when i double click on songA, it works(i can listen songA).
    so i think that's something wrong with my library, i delete songB from library, then, i drag(also try add from the menu botton) songB into library again, it DOESNOT work!! i cant add songB to my library. what's the problem???
    songB had already been in my iTunes for some months, i was fine and playable. but now, i cant listen it using iTunes.
    songB is working fine using other mp3-player. i tried to reinstall iTunes, but it doesnt help.
    there is more than one song that have the same problem! songB is just an example
    hope i made the question clear
    so i am looking for help.
    p.s. i am using WinXPSP2, iTunes 7.0.2.16
    again, those song i cant play and add now was okay before.

    I have the same problem. As soon as I edit a song's ID3 tag via windows XP, iTunes does not add the song back to my library. There is no error notification or something like that, I simply select the song through "add song to library", and than nothing happens.
    The annoying thing is that I edited a lot of my music this way, and now I can't play any of these songs through itunes. This has never been a problem before, but since itunes 7 all this crap started. I have removed libray files etc., but nothing seems to help. Furthermore, all these songs still play with other media players.
    Guesss we simply have to pray and hope that everything is solved with the next itunes update,
    Gregorius

  • Cant add Windows accounts to staff or admin group

    cant add Windows accounts to staff or admin group
    I have one Mac pro workstation on a all windows network, its added to the domain. i can give network users administrative permissions on the pc by selecting allow user to administer this computer in the accounts in system preferences but they dont have file permissions unless i add them explicitly on the file or folder. i'm new with macs and not sure on what to do.

    > local users (Not domain Users) to this Group and then nest this Group
    > into the Local Admin Group Built-in into Windows 8
    You cannot nest local groups.
    Greetings/Grüße,
    Martin
    Mal ein
    gutes Buch über GPOs lesen?
    Good or bad GPOs? - my blog…
    And if IT bothers me -
    coke bottle design refreshment (-:

  • When I plug my ipod in it doesn't say "do not disconnect". I cant add music

    When I plug my ipod in it doesn't say "do not disconnect". I cant add music. Please help me!
    Dell   Windows XP  

    First of all, try another port on your computer. Some ports are not connected direct to the motherboard and do not recognize the iPod as well as those that are. Reset the iPod each time you connect it to another port.
    Still no joy, see these.
    Your Windows PC doesn't recognize iPod.
    iPod appears in Windows Explorer but does not appear in iTunes.
    iPod does not appear in iTunes.
    Fast user switching in Windows XP is not supported.
    Strange iPod behavior.
    When restoring the iPod, put it into disk mode first.
    Putting iPod into disk mode.

  • Panel or canvas into swf

    Dear friends,
    I am developing a simple application to convert a panel or a
    canvas (whatever i am having in that panel or canvas) into swf
    file.
    In that i need how to proceed to convert into swf.
    can anyone help me in this regards?
    thanx,
    Dhinakaran.C
    to convert a panel or a canvas (whatever i am having in that
    panel or canvas) to swf file

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test extends JFrame {
      public Test() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        content.setLayout(null);
        for (int i=0; i<5; i++) {
          JLabel jl = new JLabel(new ImageIcon("C:\\duke.gif"));
          jl.setToolTipText("Tip-" + i);
          jl.setBounds(i%3*40, i/3*40,30,30);
          content.add(jl);
        setSize(200,200);
        setVisible(true);
      public static void main(String[] args) { new Test(); }
    }

  • PLEASE somethings wrong..i cant add my songs

    I have had my ipod video since christmas and have never had any problems with it. i just downloaded the new ipod software and the new itunes and i cant add any songs to it, and when i hook it up to transfer a couple of songs from my brothers computer it wont add songs either. the only option is to transfer his entire library and wipe mine (Again!)
    its bad enough i dont have any songs on my ipod, but now i cant add any either!
    please help

    First off, have you tried doing a RESET on the iPod? Do it a few times since sometimes one reset is not enough to clear out issues. And then have you tried doing a RESTORE on your iPod? The RESTORE is supposed to put your iPod back into a known good (default) state.
    Patrick

  • I cant add my gmail account to my ipod touch. It says wrong username or password is incorrect. Or it will say imap.gmail not available.It worked fine until yesterday.

    So i cant add my email to my ipod touch. It gives me a message that my username or password for imap.gmail.com is incorrect. I've reset it and still no luck.

    Can you log into your Google mail account on a computer? Try that to be sure your email settings are correct.
    Also, try this link: https://accounts.google.com/DisplayUnlockCaptcha
    Google does inexplicable things from time to time. This may be one of them.

  • Cant add mpeg 4 to libary

    mpeg video's play in iTunes, after conversion to mpeg 4, cant add to libary

    i 've converted a dvd i have into a MPEG 4. Format and ive added it to my i-Tunes libary. ive tried updating it into my ipod but a message from i-tunes saying "some songs such as "Dvd Movie" cannot be played on the iPOD" ive had no problem putting videos on to my ipod till this one.
    Problems such as you describe usually fall into two distinct categories. The first is the use of inappropriate settings and the second is a matter of media content. Since this is the first time you've encountered such problems, I would think your current problem stems from the latter.
    No one setting fits all situations. The brightnes of a scene, it's complexity of detail, and/or amount of rapid action can all serve to push the instantaneous data rate of your video beyond your iPod's playback capabilities (for which iTunes error traps before sync). In most cases, simply modifying your conversion settings is sufficient to turn an unplayable file into a playable one. In other instance it may be necessary to modify brightness, contrast, and/or saturation levels with or without modification of video data rate settings. Just remember that achieving maximum returns on your compression techniques is as much an art as it is a science.

  • Cant add account manager from myverizon  keeps throwing error message

    did everything but go into the store. Im 9 months pregnant on bed rest and my verizon gives me an error when i try to add account manager. Called  922 0204  and customer service says its now verizon policy that you cant add anyone to your account until after 30 days   ive added and removed people before on the same day Talked to supervisor he said its a my verizon problem and that the ppl that are supposed to work on it arent in right now So shouldnt they have a way to bypass this??  what is up with this new rule?? Anyone else getting this same error??

       I originally had wireless service with Alltell and I was very concerned when Verizon purchased Alltell ( I had numerous bad experiences with Verizon customer service when I had their FIOS cable service).  For years now that Verizon took over for Alltell I have not had any issues and I believe it was because I did not have to contact customer service.   Now in December I purchased three new phones and my daugther wanted to change her work number to one of the numbers I had on my service.  You would have thought we were trying to pattern a new cure for cancer.  We had to spend hours on the phone with customer service trying to accoumplish a very easy task and each time my daugther tried to deal with these people they all complained because she was not an account manager. 
    For the last wo weeks I have tried to add my daughter thru the website.  Each time I got an error message stating that I needed to call 611 to get this corrected.   Tonight we called 611  and I got the same run around with customer service for the last 45 minutes, but they told me that I had to wait 60 days since we had purchased  new phones.   They also told me that we could go to a Verizon store location and this could be accomplished at the store.  I have already spent more time with customer service than any live person should and I certainly do not want to have to make another trip to a Verizon store.  It is utterly amazing how Verizon can take such simple tasks and turn them into a Federal case.  This waste hours of your time and also the time spent by their employees,  and you don't get anything accomplished.  They must be getting so many complaints that now there is no place on their website where you can write a complaint.         

  • I cant add events to calendar on imac OS X?

    I cant add events to calendar on imac OS X?

    Thanks Skydiver199, but there is no toggle for icloud syncing in "mail, contacts, clalendars".  Oddly enough I was able to go into icloud and toggle calendar to sync with icloud.  This worked but I didn't necessarily want all my calendars, on all my devices to sync.  i guess this is just another limitation.

  • Cant add Crystal References in VS 2008 project

    Hi
    I have a VS 2008 environment. I have three dll references I want to add to my project and I dont see them in .NET or COM tabs in Add Reference dialog. Weird, I can see them good in other projects (references to GAC assemblies) of an existing project, but once I delete them, I cant add them again because they dont show up in the Add reference. How do I make them show up?
    My dev environment is: Windows Server 2008 64bit, VS 2008. If I can add the reference, I am done  with my project. Dll's I want to add are:
    CrystalDecisions.CrystalReports.Engine
    CrystalDecisions.ReportSource
    CrystalDecisions.Shared
    I looked at this link and he didnt explain how he added the references in registry. Does anyone know about this?
    http://channel9.msdn.com/forums/TechOff/451042-VS2008-cannot-add-reference-while-developing-on-x64-hardware/

    I believe you confusion is coming from not understanding how the product works instead of an issue with the product itself.
    Your combining Crystal Reports Developer software, crystal runtime distributable, crystal .NET runtime all into one sentence and talking about installation order leads me to believe this is the case.
    On your development machine you would have VS.NET installed, it comes with the free version of Crystal included (along with its .NET runtimes).  If you want to integrate the stand alone version (say Crystal 2008) and use its .NET runtimes in your app you need to install it after VS is installed to allow it to integrate.  VS.NET can't integrate to a product that is already installed as it would never look.
    The crystal runtime distributable should never be installed on your development machine.  You use the distributable to deploy the Crystal runtimes onto a server where you want to deploy your app. You just need to make sure you are using the runtimes that match the ones you are using in your app.
    I hope that clears up some of the confusion.
    Jason

  • Cant add songs to playlist

    just got a new ipod, transfered songs from old ipod to laptop, put songs onto new ipod.  Now the problem....i cant add songs to a playlist, the arrow doesnt give me the add to option and i cant drag them.....i have multiple devices , ipad, 2 iphones and now this ipod....itunes says downloading song x to match, what the heck is that and why is it taking so long?  do i have a library conflict or something?  i constantly struggle with syncing and manually manage this and that and all these songs will be deleted and synced with this library, etc....you get the picture.....can anybody give me the crash course of apple products 101? i never had any problems when i just had an ipod years ago but when we got multiple devices and accounts and cloud everything has become much more difficult.

    What sort of Playlist?
    You can only drag songs into regular Playlists, but not into Smart Playlists. In the picture below, the highlighted Playlists with the "musical note on paper" are regular Playlists, into which you can add songs:
    The Playlists with a "cog wheel" beside them are Smart Playlists. Songs are added to these lists according to the rules you set for that list. You cannot drag songs into them and if you try, you will see the red circle with the slash.
    Is this the problem?

Maybe you are looking for

  • Are new MB replacements using the same batch of bad 8600M chips?

    My Macbook Pro Santa Rosa from 2007 just died yesterday. I brought it in for Logic Board replacement. It'll cost some days of productivity. But two things occur to me: 1. Do these replacement logic board use the same batch of dodgy nVidia 8600M chips

  • Bi content not imported

    Hi Friends, in saint when I go to support packeges in the System I find SAPKIBIIIH with status not imported. How can I import the package? And furthermore, note 916834 says I have to download the file CSR0120031469_0023365.PAT from service marketplac

  • Will the files that i deleted in the PSE8 organizer be deleted in the Online library after syncing?

    I have been deleting all the unnecessary copies of files in the organizer PS8. As of now, they remain in my Photoshop Online library and gallery, but will they also be automatically deleted after i run the backup/sync in the organizer?

  • Unable to add files from folders

    I am having the strangest of issues.  Whenever I try to add some particular folders via the "Get Photos and Videos --> From Files or Folders" command, It will not let me select certain folders for importing.  Kinda hard to explain, so I made the flas

  • Extra page printing on HP P4015x

    On every printing job I get a page that shows my username and job name and number before my actual job prints.  Any way I can disable this? Thanks.