JButtons not appearing problem

Hi,
First of all I am using NetBeans environement.
I have just started writing short menu program.I am creating two panes,in the southern on I intend to put four buttons,unfortunately when i click compile these buttons sometimes seems to appear but usaully nothing apart from background images seems to be appear.Please help me solve my problem.Thanks in advance.
My code:
Main:
package q;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;
import java.util.*;
* @author Piotr
public class Main {
     * @param args the command line arguments
    public static void main(String[] args) {
        GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
        Rectangle b =env.getMaximumWindowBounds();
        System.out.println(b);
        Ramka pierwsza = new Ramka(b);
        pierwsza.setVisible(true);
        pierwsza.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}Ramka (Frame ) code:
package q;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;
import java.util.*;
import java.awt.image.BufferStrategy;
class Ramka extends JFrame{
        private Panel_wstepny panel_wstepny;
        private Panel_wstepny_g panel_wstepny_g;
        //public static final int szer =800;
        //public static final int wys= 700;
        public Ramka(Rectangle k)
           Dimension j = k.getSize();
           j.setSize((int)(k.width*0.3),(int)(0.7*k.height));
           this.setSize(j.getSize());
           setTitle("Asteroids");
           setLayout(new BorderLayout());
           panel_wstepny=new Panel_wstepny();
           panel_wstepny_g=new Panel_wstepny_g();
           panel_wstepny.setPreferredSize(new Dimension (j.width,(int)(j.height*0.3)));
           panel_wstepny.setPreferredSize(new Dimension (j.width,(int)(j.height*0.7)));
           this.add(panel_wstepny_g,BorderLayout.CENTER);
           this.add(panel_wstepny,BorderLayout.SOUTH);
}Panel_wstepny_g:
package q;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;
import java.util.*;
class Panel_wstepny_g extends JPanel {
    Image tlo =Toolkit.getDefaultToolkit().getImage("tytul_big.gif");
    Dimension size;
            private Image doubleBuffer;
        public void update(Graphics g) {
            Dimension size = getSize();
            if (doubleBuffer == null ||doubleBuffer.getWidth(this) != size.width ||doubleBuffer.getHeight(this) != size.height)
                    doubleBuffer = createImage(size.width, size.height);
            if (doubleBuffer != null)
                Graphics g2 = doubleBuffer.getGraphics();
                paint(g2);
                g2.dispose();
                g.drawImage(doubleBuffer, 0, 0, null);
            else
                paint(g);
    public void paint(Graphics g){
        size=getSize();
        Graphics2D g2=(Graphics2D)g;
        super.paintComponent(g);
        setBackground(Color.BLACK);
        Image z2=tlo.getScaledInstance((int)(0.55*size.width),(int)(0.8*size.height),Image.SCALE_FAST);
        MediaTracker trop = new MediaTracker(this);
        trop.addImage(z2,0);
        try { trop.waitForID(0);}
        catch(InterruptedException exception) {}
        g.drawImage(z2,(int)(0.2*size.width),(int)(0.05*size.height),null);
}Panel wstepny(HERE I NEED TO PUT THESE BUTTONS ,BUT IAS I HAVE ALREADY WRITTEN ,WHEN I PRESS COMPILE sometimes they does appear,but usually nothing appears,aprat form background)
package q;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;
import java.util.*;
class Panel_wstepny extends JPanel {
    Dimension size;
    Image tlo;
    JButton nowa;
    JButton koniec;
    JButton autor;
    JButton info;
public Panel_wstepny(){
     //GridLayout b2 =new GridLayout(200,0);
     setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    nowa=new JButton  (" Nowa gra ");
    koniec=new JButton("Koniec gry");
    autor=new JButton ("  Autorzy  ");
    info=new JButton  ("   Pomoc   ");
     tlo =Toolkit.getDefaultToolkit().getImage("background.gif");  
    public void paint(Graphics g){
             size =getSize();
         //  add(Box.createVerticalStrut((int)(size.height/4)));         
add(Box.createHorizontalStrut((int)(size.width/50)));
//add(Box.createRigidArea(new Dimension(size.width/4,size.height)));
          add(nowa);
add(Box.createVerticalStrut((int)(size.height/20)));
add(koniec);
add(Box.createVerticalStrut((int)(size.height/20)));
add(autor);
add(Box.createVerticalStrut((int)(size.height/20)));
add(info);
        System.out.println(size);
        Graphics2D g2=(Graphics2D)g;
        super.paintComponent(g);
        Image z2=tlo.getScaledInstance(this.size.width,this.size.height,Image.SCALE_FAST);
          MediaTracker trop = new MediaTracker(this);
          trop.addImage(z2,0);
          try { trop.waitForID(0);}
          catch(InterruptedException exception) {}
          g.drawImage(z2,0,0,null);
}

There are so many thing wrong with your program I don't know where to start.
a) never override the update() method. (that is an old AWT trick)
b) newver override the paint() method (see above comment)
c) if you do override the paint() method, then why would you invoke super.paintComponent()? The idea of using super.() is to invoke the parent method of the method you are overriding.
d) don't use a MediaTracker in the paint() method. The IO to read the image should only be done once.
e) don't use a BufferStrategy. Swing is double buffered by default.
f) if you are trying to use a "background image" then search the forum using those words as the search keywords. This question is asked and answered all the time.
I suggest you start by read the [Swing Tutorial|http://java.sun.com/docs/books/tutorial/uiswing/TOC.html]. There is a section on "Custom Painting" as well as examples of adding buttons to a frame.

Similar Messages

  • Word Search not appear Problem

    Hello Guy I need to help about Power Q & A word not appear
    Example
    Product name , Revenue in England it work
    But
    Product name , Revenue in America it not work and Wording "America" is white color (not appear)
    But when i filter (filter function in the Right Hand i Choose America information is appear
    Why this ..
    Help me please Thank a lot all guy

    Any suggestions for My?
    Thanks!
    Ed Price, Azure & Power BI Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • JTextField and JButtons not appearing until clicked.

    I'm writing a program to refresh my CS1 java skills. For some reason when I try to add a JTextField and two JButtons to my container they don't appear until Ive clicked them.
    Actually more specifically, this only happens after a 100ms wait after setting the frame visible. Any less and the components wind up visible, but scrunched up in the top middle of my frame.
    Ive found that if I add the components before and after the wait they are visible and in the correct place, but this makes a noticeable flicker.
    I'm running windows vista if that matters.
    If someone could help me I would appreciate it.
    snippet of code:
    public scrollText()
         drawingThread.start();
         mainFrame.setSize(640,160);
         mainFrame.setContentPane(draw);
         mainPane = mainFrame.getContentPane();
         mainPane.setBackground(Color.white);
         mainFrame.setResizable(false);
         mainFrame.setVisible(true);
         try
              Thread.sleep(100);
              addInterface();
         catch(InterruptedException e){}
    public void addInterface()
         textInput.setBounds(1,103,501,31);
         play.setBounds(502,103,65,30);
         play.addActionListener(this);
         stop.setBounds(568,103,65,30);
         stop.addActionListener(this);
         mainPane.add(textInput);
         mainPane.add(play);
         mainPane.add(stop);
    }

    Postings can't be moved between forums. Now you know for the next time.
    The general form for building a GUI is
    frame.getContentPane().add( yourComponentsHere );
    frame.pack();
    frame.setVisible( true );Then all the compnoent will show up according to the rules of the layout managers used.
    However is you add components to the GUI "after" the GUI is visible then the components are not automatically painted. You need to tell the GUI to invoke the layout manager again so your code would be:
    frame.getContentPane().add( componentsToVisibleGUI );
    frame.getContentPane().validate();

  • Hi all, I upgraded my MBP to Lion , but on the screen where i need to type my password, click  on my photo and it does not appear the place for me to type my password and it stay stuck there. Can anyone solve this problem for me?

    Hi all, I upgraded my MBP to Lion , but on the screen where i need to type my password, click  on my photo and it does not appear the place for me to type my password and it stay stuck there. Can anyone solve this problem for me?

    Reboot the machine holding Command and r keys down, you'll boot into Lion Recovery Partition
    In there will be Disk Utility, use that to select your Lion OS X Partition and Repair Permissions.
    After that is done reboot the machine and see if you can log in.
    If not repeat the above steps to get into Lion Recovery, get online and reinstall Lion again, it will overwrite the installed version and hopefully after that it wil work.
    Reboot and try again.
    If not follow my steps to create a Snow Leopard Data Recovery drive, then option boot from it and grab a copy of your files off the machine.
    Then reinstall all your programs onto the external drive like setting up a new machine, then use Disk Utility to erase the entire internal boot drive (select the drive media on the far left, not the partiton slightly indented) format Option: GUID , 1 partition OS X Extended and then use Carbon Copy Cloner to clone the external to the newly formatted internal drive. Once that is finished reboot and disconnect the external drive.
    Once you go that, boot into Snow Leopard and update to 10.6.8, use the AppStore and option click on Purchases and download Lion again and install.
    Lots of work, but there is no Lion disks.
    https://discussions.apple.com/message/16276201#16276201

  • I have a problem with my apple tv, I can watch my music of my mac in the TV but I cant transmit  music or video from my mac to my apple tv because not appear the logo Apple Tv in my itunes.  Somebody help me?

    I have a problem with my apple tv, I can watch my music of my mac in the TV but I cant
    transmit  music or video from my mac to my apple tv because not appear the logo
    Apple Tv in my itunes.  Somebody help me?

    Welcome to the Apple Community.
    The Apple TV 2 doesn't show up under devices like the Apple TV 1, to send video and music to the Apple TV you need to use the Airplay Option which appears in the lower right corner of iTunes.

  • Good night recently my iphone 4s was exchanged for a new one because was defective and was in warranty. the problem is that now I try to use the same apple id on itunes and applications while had bought the old iphone does not appear and I think should ap

    good night recently my iphone 4s was exchanged for a new one because was defective and was in warranty. the problem is that now I try to use the same apple id on itunes and applications while had bought the old iphone does not appear and I think should appear. Can someone help?

    ?

  • Jbutton in applet not appearing when embedded in webpage(jre1.6.0_02)

    Hi,
    I am accessing a webcam from an applet embedded in a webpage using JMF 2.1. I am using JButtons using Image Icons. When i view the applet using applet viewer both the player and buttons appear fine. However when the applet is embedded in a jsp page the image JButtons don't appear at all. I am using jre1.6.0_02.
    Following is the code( The capture and cancel JButtons dont appear when viewed in webpage):
    import java.awt.*;
    import java.io.*;
    //import java.awt.Graphics;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.image.*;
    import java.net.URL;
    import java.net.URLConnection;
    import javax.media.format.*;
    import javax.media.control.*;
    import javax.media.util.*;
    import javax.media.*;
    import javax.swing.ImageIcon;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGEncodeParam;
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
    public class WebCamUnit extends JApplet implements ActionListener
         static final long serialVersionUID = -116069779446114664L;
         private static final String FILENAME_HEADER = "fileName";
         private static final String FILELASTMOD_HEADER = "fileLastMod";
         public static Player player = null;
         public CaptureDeviceInfo captureDeviceInfo = null;
         public MediaLocator ml = null;
         public JButton captureButton, cancelButton = null;
         public Buffer buf = null;
         public Image img = null;
         public VideoFormat vf = null;
         public BufferToImage btoi = null;
         public Component comp;
         public static boolean isTrue = true;
         public JPanel buttonPanel, playerPanel;
         public static String localDirectoryName = null;
         public static String serverDirectoryName = null;
         public static String servletURL = null;
         public static String localImageName = null;
         public static String serverImageName = null;
         String webCamDriverName = null;
         String middleButtonFilename = "TakePicture.JPG";
         String frontButtonFilename = "Cancel.JPG";
         public void init()
              localImageName = getParameter("LOCAL_IMAGE_NAME");
              serverImageName = getParameter("SERVER_IMAGE_NAME");
              localDirectoryName = getParameter("LOCAL_DIRECTORY_NAME");
              serverDirectoryName = getParameter("SERVER_DIRECTORY_NAME");
              servletURL = getParameter("SERVLET_URL");
              webCamDriverName = getParameter("WEBCAM_DRIVER_NAME");
              setLayout(new BorderLayout());
              setSize(320, 340);
              ImageIcon middleButtonIcon = new ImageIcon(middleButtonFilename);
              ImageIcon frontButtonIcon = new ImageIcon(frontButtonFilename);
              captureButton = new JButton(middleButtonIcon);
              cancelButton = new JButton(frontButtonIcon);
              captureButton.setBackground(Color.WHITE);
              captureButton.setContentAreaFilled(false);
              captureButton.setBorderPainted(false);
              captureButton.setFocusPainted(false);
              captureButton.addActionListener(this);
              captureButton.setEnabled(true);
              cancelButton.setBackground(Color.WHITE);
              cancelButton.setContentAreaFilled(false);
              cancelButton.setBorderPainted(false);
              cancelButton.setFocusPainted(false);
              cancelButton.addActionListener(this);
              cancelButton.setEnabled(true);
              buttonPanel = new JPanel();
              buttonPanel.add(captureButton);
              buttonPanel.add(cancelButton);
              buttonPanel.setBackground(Color.WHITE);
              getContentPane().add(buttonPanel, BorderLayout.CENTER);
              if(null==webCamDriverName)
                   webCamDriverName = "vfw:Microsoft WDM Image Capture (Win32):2";
              captureDeviceInfo = CaptureDeviceManager.getDevice(webCamDriverName);
              ml = captureDeviceInfo.getLocator();
                   try
                        player = Manager.createRealizedPlayer(ml);
                   catch (Exception e)
                   try
                        player.start();
                   catch (Exception e)
         public void destroy()
              player.close();
         public void start()
              try
                   if ((comp = player.getVisualComponent()) != null)
                        playerPanel = new JPanel();
                        comp.setBounds(0, 0, 320, 240);
                        playerPanel.add(comp);
                        getContentPane().add(playerPanel, BorderLayout.NORTH);
                   player.start();
              catch (Exception e)
              setVisible(true);
              invalidate();
              repaint();
         public boolean action(Event e, Object o)
              return true;
         public void paint(Graphics g)
              super.paint(g);
         public static void playerclose()
              player.close();
              player.deallocate();
         public void actionPerformed(ActionEvent e)
              JComponent c = (JComponent) e.getSource();
              if (c == captureButton)
                   player.stop();
                   FrameGrabbingControl fgc = (FrameGrabbingControl) player
                             .getControl("javax.media.control.FrameGrabbingControl");
                   buf = fgc.grabFrame();
                   btoi = new BufferToImage((VideoFormat) buf.getFormat());
                   img = btoi.createImage(buf);
                   String newDir = localDirectoryName;
                   boolean success = (new File(newDir)).mkdirs();
                   String imageServername = localDirectoryName + localImageName;
                   saveJPG(img, imageServername);
                   isTrue = false;
              else
                   if ((comp = player.getVisualComponent()) != null)
                        getContentPane().add(comp, BorderLayout.NORTH);
                        player.start();
                   isTrue = true;
         public void stop()
              player.stop();
              player.deallocate();
              getContentPane().removeAll();
         public static void saveJPG(Image img, String s)
              img = img.getScaledInstance(160, 120, 1);
              BufferedImage bi = new BufferedImage(img.getWidth(null), img
                        .getHeight(null), BufferedImage.TYPE_INT_RGB);
              Graphics2D g2 = bi.createGraphics();
              g2.drawImage(img, 0, 0, null, null);
              FileOutputStream out = null;
              try
                   out = new FileOutputStream(s);
              catch (java.io.FileNotFoundException io)
                   String message = "File Not Found";
                   JOptionPane pane = new JOptionPane(message);
                   JDialog dialog = pane.createDialog(new JFrame(), "Dilaog");
                   dialog.show();
              JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
              JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
              param.setQuality(0.50f, false);
              encoder.setJPEGEncodeParam(param);
              try
                   encoder.encode(bi);
                   out.close();
                   try
                   transferFile(localDirectoryName+localImageName,serverImageName,"",-1);
                   catch (Exception e1)
                        String message = "Error occurred while transferring image to server!!";
                        JOptionPane pane = new JOptionPane(message);
                        JDialog dialog = pane.createDialog(new JFrame(), "Dilaog");
                        dialog.show();
                   String message = "Image saved successfully!!";
                   JOptionPane pane = new JOptionPane(message);
                   JDialog dialog = pane.createDialog(new JFrame(), "Dilaog");
                   dialog.show();
              catch (java.io.IOException io)
                   String message = "Error occurred while saving image!!";
                   JOptionPane pane = new JOptionPane(message);
                   JDialog dialog = pane.createDialog(new JFrame(), "Dilaog");
                   dialog.show();
              catch (Exception e)
            // this method transfers the prescribed file to the server.
            // if the destination directory is "", it transfers the file to      "d:\\".
            //11-21-02 Changes : This method now has a new parameter that references the item
            //that is being transferred in the import list.
            public static String transferFile(String srcFileName, String
         destFileName,
                                              String destDir, int itemID)
               if (destDir.equals(""))
                  destDir = serverDirectoryName;
               // get the fully qualified filename and the mere filename.
               String fqfn = srcFileName;
               String fname = fqfn.substring(fqfn.lastIndexOf(File.separator)+1);
               try
                  //importTable importer = jbInit.getImportTable();
                  // create the file to be uploaded and a connection to      servlet.
                  File fileToUpload = new File(fqfn);
                  long fileSize = fileToUpload.length();
                  // get last mod of this file.
                  // The last mod is sent to the servlet as a header.
                  long lastMod = fileToUpload.lastModified();
                  String strLastMod = String.valueOf(lastMod);
                  URL serverURL = new URL(servletURL);
                  URLConnection serverCon = serverURL.openConnection();
                  // a bunch of connection setup related things.
                  serverCon.setDoInput(true);
                  serverCon.setDoOutput(true);
                  // Don't use a cached version of URL connection.
                  serverCon.setUseCaches (false);
                  serverCon.setDefaultUseCaches (false);
                  // set headers and their values.
                  serverCon.setRequestProperty("Content-Type",
                                               "application/octet-stream");
                  serverCon.setRequestProperty("Content-Length",
                  Long.toString(fileToUpload.length()));
                  serverCon.setRequestProperty(FILENAME_HEADER, destDir + destFileName);
                  serverCon.setRequestProperty(FILELASTMOD_HEADER, strLastMod);
                 // if (webadminApplet.DEBUG) System.out.println("Connection with FTP server established");
                  // create file stream and write stream to write file data.
                  FileInputStream fis = new FileInputStream(fileToUpload);
                  OutputStream os = serverCon.getOutputStream();
                  try
                     // transfer the file in 4K chunks.
                     byte[] buffer = new byte[4096];
                     long byteCnt = 0;
                     //long percent = 0;
                     int newPercent = 0;
                     int oldPercent = 0;
                     while (true)
                        int bytes = fis.read(buffer);
                        byteCnt += bytes;
                        //11-21-02 :
                        //If itemID is greater than -1 this is an import file      transfer
                        //otherwise this is a header graphic file transfer.
                        if (bytes < 0) break;
                        os.write(buffer, 0, bytes);
                     os.flush();
                     //if (webadminApplet.DEBUG) System.out.println("No of bytes sent: " + byteCnt);
                  finally
                     // close related streams.
                     os.close();
                     fis.close();
                 // if (webadminApplet.DEBUG) System.out.println("File Transmission complete");
                  // find out what the servlet has got to say in response.
                  BufferedReader reader = new BufferedReader(
                                 new
         InputStreamReader(serverCon.getInputStream()));
                  try
                     String line;
                     while ((line = reader.readLine()) != null)
                       // if (webadminApplet.DEBUG) System.out.println(line);
                  finally
                     // close the reader stream from servlet.
                     reader.close();
               } // end of the big try block.
               catch (Exception e)
                  System.out.println("Exception during file transfer:\n" + e);
                  e.printStackTrace();
                  return("FTP failed. See Java Console for Errors.");
               }  // end of catch block.
               return("File: " + fname + " successfully transferred.");
            }  // end of method transferFile().
    }

    >
    I am accessing a webcam from an applet embedded in a webpage using JMF 2.1. I am using JButtons using Image Icons. When i view the applet using applet viewer both the player and buttons appear fine. However when the applet is embedded in a jsp page the image JButtons don't appear at all. >That is probably because of security. Add 10 Dukes to the thread to indicate you are serious about resolving this, and I might expand on that answer.

  • I have installed the font Broadway on my computer and it works in Microsoft Word but does not appear in the font list in InDesign.  How can I fix this problem?

    I have installed the font Broadway on my computer and it works in Microsoft Word but does not appear in the font list in InDesign.  How can I fix this problem?

    Start by rebooting the computer. If that doesn't work, search for adobefnt*.lst and delete all instances where * becomes a 2-digit number.

  • When I forgot my password, my husband received the instructions at his email. His email does not appear any where in my account. How do I solve this problem?

    When I forgot my password, my husband received the instructions at his email. His email does not appear any where in my account. How do I solve this problem?

    When you set up your ipad did you or your husband also set up a rescue e-mail address for you? If so, that would be why he received the instructions. Or do you sync your ipad with his computer?
    Actually in terms of it being a problem, it actually makes it easier for you to answer your security questions and follow the instuctions to get back on your ipad. Otherwise, you'll have to call Apple Support.
    To delete the rescue e-mail account pleases read this thread. (Poster's photos did not come through with the instructions.)
    https://discussions.apple.com/thread/5218141?start=0&tstart=0

  • A word document was emailed to me.  I can open the document without a problem.  Is there a way for me to type on the document.... to fill out the form?  When I click the fields, the virtual keyboard does not appear.

    A word document was emailed to me.  I can open the document without a problem on my iPad 2.   Is there a way for me to type on the document.... to fill out the form?  When I click the fields, the virtual keyboard does not appear.

    If you want to edit a word document then you will need an app on your iPad that supports word so that you can copy them to it via 'open in' e.g. Apple's Pages app or a third-party app such as Documents To Go or QuickOffice HD

  • When registering my iphone on itunes the message - the sim card insertedin this iphone does not appear to be supported - can anyone shed some light on this and tell me a way around this problem?

    when registering my iphone on itunes the message - the sim card insertedin this iphone does not appear to be supported - can anyone shed some light on this and tell me a way around this problem? the phone itself is an english phone and tried to register with a spanish sim and that message appeard, so i tried with my iphone sim which is english and the same message appeared!
    thanks

    Is the English sim from the original carrier as that is usually the message you get with a carrier locked phone.

  • I rented a movie (dark shadows) but I can not see it, because a message appear "Problem loading...try again later". Is not a problem connection. I tried a lot of times to watch the movie and I didn't can.

    I rented a movie (dark shadows) but I can not see it, because a message appear "Problem loading...try again later". Is not a problem connection. I tried a lot of times to watch the movie and I didn't can.
    Thanks
    Celeste

    I rented a movie (The Hobbit)...but  it stops loading.
    The movie costs CHF 7.50.
    A phone call to the support team costs CHF 46.-- !!!!!
    What do you think I will do?
    Pisella Verde

  • Datasource does not appear on the console, intermittent problem

    I am using Weblogic 9.2 MP3
    I've created an Oracle DataSource and successfully targeted it to a Managed Server.
    When I click on it in the console and navigate to the "Monitoring" tab, it would sometimes appear in the "Test DataSource" table and sometimes it would not. I am able to successfully click the Test button when it does appear in the table.
    I do not have this issue with Weblogic 9.2 MP1.
    Is this a known issue and is there a patch for it?
    Thanks,
    Sohel

    hi, I have not this problem, but have read some forums with people having the same problem. It seems to be with people using PC and not mac. Are you using iTunes 9? If so, it seems to be a screen resolution problem, and some of the image is cut and not shown on the screen. Just adjust your screen resolution so the image is all on the screen and the photo tag (the last on the list!!!) will show up!
    Hope this helps
    xavier

  • Been using an Avastor HDX-800 for storage and backup, also a SUPERDISK for smaller stuff; recently the SUPERDISK does not appear on the screen, and the light blinks while you hear it spin, also the Avastor has started to have the same problem, both USB

    Been using an Avastor HDX-800 for storage and backup, also a SUPERDISK for smaller stuff; recently the SUPERDISK does not appear on the screen, and the light blinks while you hear it spin, also the Avastor has started to have the same problem, both USB conncected, both worked well before, but both now spinning, blinking, and not showing up on the screen as before,
    Interestingly they both appear in the System Profiler, but just not working the same as before
    I have tried other USB ports, but the same responce,

    yes I did reset the PRAM, but no benefit, still the same problem
    my usb devices are:  keyboard, mouse, printer, SD-USB-M3, and LaCie d2 DVDRW:
    the mouse and printed are plugged into the keyboard: i have tried to move, these around, and have even tried just the mouse, printer and SD-USB-M3, but still the same problem
    here is a cut and paste of the current  "System Profiler>Hardware>USB"   (usb device tree)
    USB Bus:
      Host Controller Location:          Built In USB
      Host Controller Driver:          AppleUSBOHCI
      PCI Device ID:          0x0026
      PCI Revision ID:          0x0000
      PCI Vendor ID:          0x106b
      Bus Number:          0x18
    Hub in Apple Pro Keyboard:
      Version:          1.22
      Bus Power (mA):          500
      Speed:          Up to 12 Mb/sec
      Manufacturer:          Mitsumi Electric
      Product ID:          0x1002
      Vendor ID:          0x05ac  (Apple Computer, Inc.)
    HL-1270N series:
      Version:          1.00
      Bus Power (mA):          100
      Speed:          Up to 12 Mb/sec
      Manufacturer:          Brother
      Product ID:          0x0008
      Serial Number:          L9J286292
      Vendor ID:          0x04f9
    Basic Optical Mouse:
      Version:          0.00
      Bus Power (mA):          100
      Speed:          Up to 1.5 Mb/sec
      Manufacturer:          Microsoft
      Product ID:          0x0084
      Vendor ID:          0x045e
    Apple Pro Keyboard:
      Version:          1.22
      Bus Power (mA):          250
      Speed:          Up to 12 Mb/sec
      Manufacturer:          Mitsumi Electric
      Product ID:          0x0204
      Vendor ID:          0x05ac  (Apple Computer, Inc.)
    SuperDisk USB 120MB drive:
      Version:          0.0e
      Bus Power (mA):          500
      Speed:          Up to 12 Mb/sec
      Manufacturer:          Imation
      Product ID:          0x0002
      Vendor ID:          0x0718
    Hub in Apple Pro Keyboard:
      Version:          1.22
      Bus Power (mA):          500
      Speed:          Up to 12 Mb/sec
      Manufacturer:          Mitsumi Electric
      Product ID:          0x1002
      Vendor ID:          0x05ac  (Apple Computer, Inc.)
    HL-1270N series:
      Version:          1.00
      Bus Power (mA):          100
      Speed:          Up to 12 Mb/sec
      Manufacturer:          Brother
      Product ID:          0x0008
      Serial Number:          L9J286292
      Vendor ID:          0x04f9
    Basic Optical Mouse:
      Version:          0.00
      Bus Power (mA):          100
      Speed:          Up to 1.5 Mb/sec
      Manufacturer:          Microsoft
      Product ID:          0x0084
      Vendor ID:          0x045e
    Apple Pro Keyboard:
      Version:          1.22
      Bus Power (mA):          250
      Speed:          Up to 12 Mb/sec
      Manufacturer:          Mitsumi Electric
      Product ID:          0x0204
      Vendor ID:          0x05ac  (Apple Computer, Inc.)
    HL-1270N series:
      Version:          1.00
      Bus Power (mA):          100
      Speed:          Up to 12 Mb/sec
      Manufacturer:          Brother
      Product ID:          0x0008
      Serial Number:          L9J286292
      Vendor ID:          0x04f9
    Basic Optical Mouse:
      Version:          0.00
      Bus Power (mA):          100
      Speed:          Up to 1.5 Mb/sec
      Manufacturer:          Microsoft
      Product ID:          0x0084
      Vendor ID:          0x045e
    Apple Pro Keyboard:
      Version:          1.22
      Bus Power (mA):          250
      Speed:          Up to 12 Mb/sec
      Manufacturer:          Mitsumi Electric
      Product ID:          0x0204
      Vendor ID:          0x05ac  (Apple Computer, Inc.)
    SuperDisk USB 120MB drive:
      Version:          0.0e
      Bus Power (mA):          500
      Speed:          Up to 12 Mb/sec
      Manufacturer:          Imation
      Product ID:          0x0002
      Vendor ID:          0x0718
    USB Bus:
      Host Controller Location:          Built In USB
      Host Controller Driver:          AppleUSBOHCI
      PCI Device ID:          0x0026
      PCI Revision ID:          0x0000
      PCI Vendor ID:          0x106b
      Bus Number:          0x19
    LaCie d2 DVDRW USB:
      Capacity:          451.76 MB
      Removable Media:          Yes
      Detachable Drive:          Yes
      BSD Name:          disk2
      Version:          0.00
      Bus Power (mA):          500
      Speed:          Up to 12 Mb/sec
      Manufacturer:          LaCie
      OS9 Drivers:          No
      Product ID:          0x1011
      Serial Number:          FFFFFFFFFFFF
      S.M.A.R.T. status:          Not Supported
      Vendor ID:          0x059f
    LaCie d2 DVDRW USB:
      Capacity:          451.76 MB
      Removable Media:          Yes
      Detachable Drive:          Yes
      BSD Name:          disk2
      Version:          0.00
      Bus Power (mA):          500
      Speed:          Up to 12 Mb/sec
      Manufacturer:          LaCie
      OS9 Drivers:          No
      Product ID:          0x1011
      Serial Number:          FFFFFFFFFFFF
      S.M.A.R.T. status:          Not Supported
      Vendor ID:          0x059f

  • Content type problem for 'does not appear to be a proper arcive'

    Hi all,
    The following code will create a ZipOutputStream using ByteArrayOutputStream (not FileOutputStream) and attach the outputstream to a MIME multipart email using ByteArrayDataSource (so the file never exists physically).
    It works and sends the email but the zip 'does not appear to be a valid archive' even though it looks about the right size. If I do the same and use FileOutputStream to create a physical file it works OK. I think it is an issue with the content type, or maybe this just isn't possible!
    I have tried:
    byteArray.toByteArray(),
    byteArray.toString().getBytes() and application/zip & application/unknown.
    Can anyone help or suggest an alternative way to create a 'in-memory' zip file that can then be emailed?
    Many thanks
        // Specify files to be zipped
                                                                 String[] filesToZip = new String[3];
                                                                 filesToZip[0] = "C:\\Program Files\\NetBeans3.6\\firstfile.txt";
                                                                 filesToZip[1] = "C:\\Program Files\\NetBeans3.6\\secondfile.txt";
                                                                 filesToZip[2] = "C:\\Program Files\\NetBeans3.6\\thirdfile.txt";
                                                                 byte[] buffer = new byte[18024];
                                                                 // Specify zip file name
                                                                  String zipFileName= eq_rt.getReportName() + ".zip";
                                                                 try {
                                                                   // Create ZipOutputStream to store the FileOutputStream
                                                                   //ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName));
                                                                   ByteArrayOutputStream byteArray = new ByteArrayOutputStream();                                                             
                                                                   ZipOutputStream out = new ZipOutputStream(byteArray);                                                              
                                                                   // Set the compression ratio
                                                                   out.setLevel(Deflater.DEFAULT_COMPRESSION);
                                                                   // iterate through the array of files, adding each to the zip file
                                                                   for (int a = 0; a < filesToZip.length; a++) {
                                                                     System.out.println(a);
    //                                                                 // Associate a file input stream for the current file
                                                                     FileInputStream in = new FileInputStream(filesToZip[a]);
                                                                     // This ROCKS as it is passing a array into the text file .getBytes() seems
                                                                     // to be the KEY in getting ByteArrayInputStream to WORK
                                                                     String strSocketInput = "TAIWAN";
                                                                     ByteArrayInputStream baIn = new ByteArrayInputStream(strSocketInput.getBytes());
                                                                     //ByteArrayInputStream baIn = new ByteArrayInputStream( getAttachementNoFormat(eq_rt.getStoredProc() ) );                                                               
                                                                     // Add ZIP entry to output stream.
                                                                     out.putNextEntry(new ZipEntry(filesToZip[a]));
                                                                     // Transfer bytes from the current file to the ZIP file
                                                                     int len;
                                                                     while ((len = baIn.read(buffer)) > 0)
                                                                     out.write(buffer, 0, len);
                                                                     // Close the current entry
                                                                     out.closeEntry();
                                                                     // Close the current file input stream
                                                                     baIn.close();                                                   
                                                                  // DataSource sourcezip = new FileDataSource(zipFileName);
                                                                   //DataSource sourcezip = new ByteArrayDataSource(byteArray.toByteArray(), zipFileName, "application/octet-stream");   
                                                                    DataSource sourcezip = new ByteArrayDataSource(byteArray.toByteArray(), zipFileName, "application/octet-stream" );
                                                                   // Create a new MIME bodypart
                                                                   BodyPart attachment = new MimeBodyPart();
                                                                   attachment.setDataHandler(new DataHandler(sourcezip));
                                                                   attachment.setFileName(zipFileName);                       
                                                                   /* attach the attachemnts to the mail */
                                                                   multipart.addBodyPart(attachment);                                                                
                                                                   // Close the ZipOutPutStream
                                                                   out.close(); 

    Many thanks Dr Clap. Moving the Closing the ZipOutputStream before I attached it to the email solved my problem.
                                          /* Close the ZipOutPutStream (very important to close the zip before you attach it to the email) Thanks DrClap */
                                                                    out.close();                                                    
                                                                    /* Create a datasource for email attachment */
                                                                    // DataSource sourcezip = new FileDataSource(zipFileName);
                                                                    DataSource sourcezip = new ByteArrayDataSource(byteArray.toByteArray(), zipFileName, "application/zip" );
                                                                    /* Create a new MIME bodypart */
                                                                    BodyPart attachment = new MimeBodyPart();
                                                                    attachment.setDataHandler(new DataHandler(sourcezip));
                                                                    attachment.setFileName(zipFileName);                       
                                                                    /* attach the attachemnts to the mail */
                                                                    multipart.addBodyPart(attachment);  

Maybe you are looking for