FileDialog error :o(

Can someone please help me? I'm not sure why the class "OpenDialogFile" below is not working. I really appreciate your help.
I got this following error:
ChatClient.java:66: cannot resolve symbol
symbol : constructor FileDialog (ChatClient.OpenDialogFile,java.lang.String,int
location: class java.awt.FileDialog
fd = new FileDialog(this, "OPEN", FileDialog.LOAD);
Here is my code:
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class ChatClient {
private TextArea output;
private TextField input;
private Button sendButton;
private Button quitButton;
private Button openFileButton;
public FileDialog fd;
public ChatClient() {
output = new TextArea(10,50);
input = new TextField(50);
sendButton = new Button("Send");
quitButton = new Button("Quit");
openFileButton = new Button("Open File");
public void launchFrame() {
Frame frame = new Frame("Chat Room");
frame.setLayout(new BorderLayout());
frame.add(output,BorderLayout.WEST);
frame.add(input,BorderLayout.SOUTH);
Panel p1 = new Panel();
p1.add(sendButton);
p1.add(quitButton);
p1.add(openFileButton);
frame.add(p1,BorderLayout.CENTER);
// Attach listener to the appropriate components
sendButton.addActionListener(new SendHandler());
frame.addWindowListener(new CloseHandler());
input.addActionListener(new InputHandler());
quitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
openFileButton.addActionListener(new OpenDialogFile());
frame.pack();
frame.setVisible(true);
private void copyText() {
String text = input.getText();
output.setText(output.getText()+text+"\n");
input.setText("");
private class SendHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
copyText();
private class OpenDialogFile implements ActionListener {
public void actionPerformed(ActionEvent e) {
     fd = new FileDialog(this, "OPEN", FileDialog.LOAD);
     fd.show();
private class CloseHandler extends WindowAdapter {
public void windowClosing(WindowEvent e) {
System.exit(0);
private class InputHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
copyText();
public static void main(String[] args) {
ChatClient c = new ChatClient();
c.launchFrame();
}

All constructors for FileDialog require an instance of Frame as a parent. ChatClient.OpenFileDialog apparently doesn't meet this requirement hence compiler is complaining.
DB

Similar Messages

  • FileDialog in SAVE mode does not throw file access error

    Hi,
    We are using FileDialog to SAVE and LOAD files.
    If a file is selected to which the user has no access, then LOAD dialog throws an
    error, but SAVE dialog does not.
    Have I skipped something ??
    Below is a sample code :
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TestClass extends JFrame {
    public TestClass() {
    setSize(400, 400);
    JPanel l_objPanel = new JPanel();
    getContentPane().add(l_objPanel);
    final JButton l_objButton = new JButton("FileOpen");
    l_objPanel.add(l_objButton);
    l_objButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent p_objEvent) {
    FileDialog l_objDlg = new FileDialog(TestClass.this, "Save now", FileDialog.SAVE);
    l_objDlg.show();
    public static void main( String[] strArgs ) {
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch(Exception e) {
    e.printStackTrace();
    TestClass l_objDlg = new TestClass();
    l_objDlg.show();

    The bug you pointed out is pretty different: JWS should work offline if no network connection is available, but no such behaviour is provided, never the less granted, if your server is down. No matter what your 'web-distributed' app is (ASP, SaaS, SOA, RIA, cloud, ...), you may have it work without a network, but no architectural pattern would ever remotely consider it should run if the providing server is down (and is not redirecting or, at least, sending some 'manageble' error).

  • How to create a FileDialog in the following...

    Hey there.
    I'm trying to create a FileDialog window using the parents frame to introduce a SAVE dialog that will
    allow the user to save to a file of their choosing. I'm not sure how to use it.
    If anyone could take the time to explain to me what I'm using and where it goes I'd greatly appreciate it.
    Thanks.
    The following saves the current state of the picture as a text file.
        public void saveImage(Image pic, Frame parent)
            String rgbHex;
            PrintWriter outFile;
            String fileName = "save.txt"
          try  
                outFile = new PrintWriter(new FileWriter(fileName));
                outFile.println("Width " + pic.getWidth() + " Height " + pic.getHeight());
                for (int y=0; y<pic.getHeight(); y++)                
                   for (int x=0; x<pic.getWidth(); x++)            
                      rgbHex = pic.getPixel(x, y);
                      outFile.print(rgbHex + " ");
                   outFile.println();
                outFile.close();
            catch (IOException e){ 
               System.err.println("Error writing file "+ fileName + ": " + e.toString());
    }Edited by: latitudeD6 on Apr 23, 2008 7:06 PM

    Check out the following link for sample code:
    [http://forum.java.sun.com/thread.jspa?forumID=513&threadID=157831|http://forum.java.sun.com/thread.jspa?forumID=513&threadID=157831]

  • OutOf Memory Error while saving image of canvas

    Hi,
    I am facing a weired problem while saving the image of the graphics in Canvas. It's giving me OutOfMemory error. Here is snippet of code:
    if(cmd.equals(C.ACTION_SAVE)){
                try {
                    FileDialog fd = new FileDialog(frame, "Save ProcessInstance as JPEG", FileDialog.SAVE);
                    fd.setFile(processInstance.getProcessDefinition().getName() +processInstance.getProcessOwner() +processInstance.getProcessOwnerId() +".jpeg");
                    fd.show();
                    String name = fd.getDirectory()+fd.getFile();
                        int w = canvas.getWidth(), h = canvas.getHeight();
                        BufferedImage image = new BufferedImage(w, h,
                                BufferedImage.TYPE_INT_RGB);
                        Graphics2D g2 = image.createGraphics();
                        canvas.paint(g2);
                        g2.dispose();
                        ImageIO.write(image, "jpeg", new File(name));
                    } catch (IOException e) {
                        System.err.println(e);
                    }

    Hi,
    I tried to run garbage collector for the same and now its working fine. I want to know is there any drawback of using this approach. I am new to java and waiting for ur expert comments. I added following lines in the above code just below ImageIO.write(image, "jpeg", new File(name));:
             image = null;
                        Runtime r = Runtime.getRuntime();
                        r.gc();

  • LV 8.0 PDA "unknown error"

    Whenever i try to build this VI, I get an unknown error prompt. I have attached the VI's for reference.
    Attachments:
    Filedialog.vi ‏20 KB
    y2kserflnme.vi ‏29 KB

    If it is a fresh install, it is probably not a vi.lib problem.  Besides, it is very rare. 
    Some other things to check are:  Are your eMbedded Visual C++ (sp4) and Pocket PC 2003 SDK (4.2.0) the same version as ours?  I installed and updated mine in December.  If the versions are different, that could be something. 
    Overall, I am not sure why you are getting an error.  Sorry that I am not more help,
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • From JavasSript called signed (FileDialog) Applet Problems...

    Hallo,
    I want to read a by JavaScript opened selected file with the FileDialog in a Byte[], and give this Byte[] back to JavaScript. I have this code for my unsigned applet working fine without reading the selected file in a byte[], but give the filepath and name back to JavaScript:
    import java.applet.Applet;
    import java.awt.FileDialog;
    import java.awt.Frame;
    import netscape.javascript.JSObject;
    public class OpenFileDialogJava6 extends Applet
         private static final long serialVersionUID = -1401553529888391702L;
         private Frame m_parent;
        private FileDialog m_fileDialog;
    *Displays a file dialog, calling standard JavaScript methods when the*
    user selects a file or cancels the dialog.
    *    public void newFileDialog(String onFileJS, String onCancelJS)*
    *          System.out.println("open Dialog...");*
    *         openDialog(onFileJS, onCancelJS);*
    *Displays a file dialog, calling the specified JavaScript functions when*
    the user selects a file or cancels the dialog.
    @param onFile The name of the function to call when the user selects a
    *file.*
    @param onCancel The name of the function to call when the user cancels
    *a dialog selection.*
        public void openDialog(final String onFile, final String onCancel)
             System.out.println("Calling open dialog...");
             if (m_parent == null)
                 m_parent = new Frame();
            if (m_fileDialog == null)
                 m_fileDialog = new FileDialog(m_parent, "Medien hinzuf&uuml;gen", FileDialog.LOAD);             
            m_fileDialog.setVisible(true);       
            m_fileDialog.toFront();
            final String directory = m_fileDialog.getDirectory();  
            final String returnFile = m_fileDialog.getFile();
             m_fileDialog.setVisible(false);     
            m_parent.setVisible(false);
            if (returnFile == null)
                 System.out.println("onCancel");
                 callJavaScript(onCancel);     
            else
                 System.out.println("onFile");
                 System.out.println(directory+returnFile);
                 callJavaScript(onFile, directory+returnFile);
         private void callJavaScript(final String func, final Object... args)
              final JSObject window = JSObject.getWindow(OpenFileDialogJava6.this);
              if (window == null)
                  System.out.println("Could not get window from JSObject!!!");
                  return;
              System.out.println("Calling func through window");
              try
                   window.call(func, args);
              catch (final Exception e)
                  System.out.println("Got error!!"+e.getMessage());
                  e.printStackTrace();
                  showError(e);
              System.out.println("Finished JavaScript call...");
         private void showError(final Exception e)
              final String[] args = new String[]{e.getMessage()};
              final JSObject window = JSObject.getWindow(this);
              try
                   window.call("alert", args);
              catch (final Exception ex)
                   System.out.println("Error showing error! "+ex);
    }I self-sign the Jar and write that byte[] test = (byte[]) java.security.AccessController.doPrivileged(
              new java.security.PrivilegedAction() to the code in where I want to read the file.....
    So now I started to change the code in the public void openDialog(final String onFile, final String onCancel) to get the Byte[] of the selected File
            final String directory = m_fileDialog.getDirectory();  
            final String returnFile = m_fileDialog.getFile();
            final File file = new File(directory+
                    File.separator +returnFile);
            byte[] test = (byte[]) java.security.AccessController.doPrivileged(
              new java.security.PrivilegedAction()
                   public Object run()
                      try
                          FileInputStream fileInputStream = new FileInputStream(file);
                          byte[] data = new byte[(int) file.length()];
                          try
                               fileInputStream.read(data);
                               fileInputStream.close();
                               return data;
                          catch(IOException iox)
                                System.out.println("File read error...");
                                iox.printStackTrace();
                                return null;
                     catch (FileNotFoundException fnf)
                           System.out.println("File not found...");
                           fnf.printStackTrace();
                           return null;
             m_fileDialog.setVisible(false);     
            m_parent.setVisible(false);
    .......Without signing the jar: I get this in IE 8:
    Meldung: java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\xampp\htdocs\index.php" "read")
    Zeile: 6
    Zeichen: 1
    Code: 0
    URI: file:///E:/FH%20Kempten/Semester%206/Java/Java%20Projekte/OpenFileDialogJava6/bin/Neues%20Textdokument.html
    Ok this I understand, but when I sign it, I open my FileDialog, select a file, ok -> nothing happens: Firfox and IE show me:
    uncaught exception: java.lang.reflect.InvocationTargetException*
    And in Java Console nothing: Just my Output:
    open Dialog...
    Calling open dialog...

    Hallo,
    I want to read a by JavaScript opened selected file with the FileDialog in a Byte[], and give this Byte[] back to JavaScript. I have this code for my unsigned applet working fine without reading the selected file in a byte[], but give the filepath and name back to JavaScript:
    import java.applet.Applet;
    import java.awt.FileDialog;
    import java.awt.Frame;
    import netscape.javascript.JSObject;
    public class OpenFileDialogJava6 extends Applet
         private static final long serialVersionUID = -1401553529888391702L;
         private Frame m_parent;
        private FileDialog m_fileDialog;
    *Displays a file dialog, calling standard JavaScript methods when the*
    user selects a file or cancels the dialog.
    *    public void newFileDialog(String onFileJS, String onCancelJS)*
    *          System.out.println("open Dialog...");*
    *         openDialog(onFileJS, onCancelJS);*
    *Displays a file dialog, calling the specified JavaScript functions when*
    the user selects a file or cancels the dialog.
    @param onFile The name of the function to call when the user selects a
    *file.*
    @param onCancel The name of the function to call when the user cancels
    *a dialog selection.*
        public void openDialog(final String onFile, final String onCancel)
             System.out.println("Calling open dialog...");
             if (m_parent == null)
                 m_parent = new Frame();
            if (m_fileDialog == null)
                 m_fileDialog = new FileDialog(m_parent, "Medien hinzuf&uuml;gen", FileDialog.LOAD);             
            m_fileDialog.setVisible(true);       
            m_fileDialog.toFront();
            final String directory = m_fileDialog.getDirectory();  
            final String returnFile = m_fileDialog.getFile();
             m_fileDialog.setVisible(false);     
            m_parent.setVisible(false);
            if (returnFile == null)
                 System.out.println("onCancel");
                 callJavaScript(onCancel);     
            else
                 System.out.println("onFile");
                 System.out.println(directory+returnFile);
                 callJavaScript(onFile, directory+returnFile);
         private void callJavaScript(final String func, final Object... args)
              final JSObject window = JSObject.getWindow(OpenFileDialogJava6.this);
              if (window == null)
                  System.out.println("Could not get window from JSObject!!!");
                  return;
              System.out.println("Calling func through window");
              try
                   window.call(func, args);
              catch (final Exception e)
                  System.out.println("Got error!!"+e.getMessage());
                  e.printStackTrace();
                  showError(e);
              System.out.println("Finished JavaScript call...");
         private void showError(final Exception e)
              final String[] args = new String[]{e.getMessage()};
              final JSObject window = JSObject.getWindow(this);
              try
                   window.call("alert", args);
              catch (final Exception ex)
                   System.out.println("Error showing error! "+ex);
    }I self-sign the Jar and write that byte[] test = (byte[]) java.security.AccessController.doPrivileged(
              new java.security.PrivilegedAction() to the code in where I want to read the file.....
    So now I started to change the code in the public void openDialog(final String onFile, final String onCancel) to get the Byte[] of the selected File
            final String directory = m_fileDialog.getDirectory();  
            final String returnFile = m_fileDialog.getFile();
            final File file = new File(directory+
                    File.separator +returnFile);
            byte[] test = (byte[]) java.security.AccessController.doPrivileged(
              new java.security.PrivilegedAction()
                   public Object run()
                      try
                          FileInputStream fileInputStream = new FileInputStream(file);
                          byte[] data = new byte[(int) file.length()];
                          try
                               fileInputStream.read(data);
                               fileInputStream.close();
                               return data;
                          catch(IOException iox)
                                System.out.println("File read error...");
                                iox.printStackTrace();
                                return null;
                     catch (FileNotFoundException fnf)
                           System.out.println("File not found...");
                           fnf.printStackTrace();
                           return null;
             m_fileDialog.setVisible(false);     
            m_parent.setVisible(false);
    .......Without signing the jar: I get this in IE 8:
    Meldung: java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\xampp\htdocs\index.php" "read")
    Zeile: 6
    Zeichen: 1
    Code: 0
    URI: file:///E:/FH%20Kempten/Semester%206/Java/Java%20Projekte/OpenFileDialogJava6/bin/Neues%20Textdokument.html
    Ok this I understand, but when I sign it, I open my FileDialog, select a file, ok -> nothing happens: Firfox and IE show me:
    uncaught exception: java.lang.reflect.InvocationTargetException*
    And in Java Console nothing: Just my Output:
    open Dialog...
    Calling open dialog...

  • Errors in code that captures images from webcam

    Here is the code
    import javax.swing.*;
    import javax.swing.border.*;
    import java.io.*;
    import javax.media.*;
    import javax.media.datasink.*;
    import javax.media.format.*;
    import javax.media.protocol.*;
    import javax.media.util.*;
    import javax.media.control.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import com.sun.image.codec.jpeg.*;
    // import com.sun.media.vfw.VFWCapture; // JMF 2.1.1c version
    import com.sun.media.protocol.vfw.VFWCapture; // JMF 2.1.1e version
    public class JWebCam extends JFrame
    implements WindowListener, ComponentListener
    protected final static int MIN_WIDTH = 320;
    protected final static int MIN_HEIGHT = 240;
    protected static int shotCounter = 1;
    protected JLabel statusBar = null;
    protected JPanel visualContainer = null;
    protected Component visualComponent = null;
    protected JToolBar toolbar = null;
    protected MyToolBarAction formatButton = null;
    protected MyToolBarAction captureButton = null;
    protected Player player = null;
    protected CaptureDeviceInfo webCamDeviceInfo = null;
    protected MediaLocator ml = null;
    protected Dimension imageSize = null;
    protected FormatControl formatControl = null;
    protected VideoFormat currentFormat = null;
    protected Format[] videoFormats = null;
    protected MyVideoFormat[] myFormatList = null;
    protected boolean initialised = false;
    * Constructor
    public JWebCam ( String frameTitle )
    super ( frameTitle );
    try
    UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    catch ( Exception cnfe )
    System.out.println ("Note : Cannot load look and feel settings");
    setSize ( 320, 260 ); // default size...
    addWindowListener ( this );
    addComponentListener ( this );
    getContentPane().setLayout ( new BorderLayout() );
    visualContainer = new JPanel();
    visualContainer.setLayout ( new BorderLayout() );
    getContentPane().add ( visualContainer, BorderLayout.CENTER );
    statusBar = new JLabel ("");
    statusBar.setBorder ( new EtchedBorder() );
    getContentPane().add ( statusBar, BorderLayout.SOUTH );
    * Initialise
    * @returns true if web cam is detected
    public boolean initialise ( )
    throws Exception
    return ( initialise ( autoDetect() ) );
    * Initialise
    * @params _deviceInfo, specific web cam device if not autodetected
    * @returns true if web cam is detected
    public boolean initialise ( CaptureDeviceInfo _deviceInfo )
    throws Exception
    statusBar.setText ( "Initialising...");
    webCamDeviceInfo = _deviceInfo;
    if ( webCamDeviceInfo != null )
    statusBar.setText ( "Connecting to : " + webCamDeviceInfo.getName() );
    try
    setUpToolBar();
    getContentPane().add ( toolbar, BorderLayout.NORTH );
    ml = webCamDeviceInfo.getLocator();
    if ( ml != null )
    player = Manager.createRealizedPlayer ( ml );
    if ( player != null )
    player.start();
    formatControl = (FormatControl)player.getControl ( "javax.media.control.FormatControl" );
    videoFormats = webCamDeviceInfo.getFormats();
    visualComponent = player.getVisualComponent();
    if ( visualComponent != null )
    visualContainer.add ( visualComponent, BorderLayout.CENTER );
    myFormatList = new MyVideoFormat[videoFormats.length];
    for ( int i=0; i<videoFormats.length; i++ )
    myFormatList = new MyVideoFormat ( (VideoFormat)videoFormats );
    Format currFormat = formatControl.getFormat();
    if ( currFormat instanceof VideoFormat )
    currentFormat = (VideoFormat)currFormat;
    imageSize = currentFormat.getSize();
    visualContainer.setPreferredSize ( imageSize );
    setSize ( imageSize.width, imageSize.height + statusBar.getHeight() + toolbar.getHeight() );
    else
    System.err.println ("Error : Cannot get current video format");
    invalidate();
    pack();
    return ( true );
    else
    System.err.println ("Error : Could not get visual component");
    return ( false );
    else
    System.err.println ("Error : Cannot create player");
    statusBar.setText ( "Cannot create player" );
    return ( false );
    else
    System.err.println ("Error : No MediaLocator for " + webCamDeviceInfo.getName() );
    statusBar.setText ( "No Media Locator for : " + webCamDeviceInfo.getName() );
    return ( false );
    catch ( IOException ioEx )
    statusBar.setText ( "Connecting to : " + webCamDeviceInfo.getName() );
    return ( false );
    catch ( NoPlayerException npex )
    statusBar.setText ("Cannot create player");
    return ( false );
    catch ( CannotRealizeException nre )
    statusBar.setText ( "Cannot realize player");
    return ( false );
    else
    return ( false );
    * Dynamically create menu items
    * @returns the device info object if found, null otherwise
    public void setFormat ( VideoFormat selectedFormat )
    if ( formatControl != null )
    player.stop();
    imageSize = selectedFormat.getSize();
    formatControl.setFormat ( selectedFormat );
    player.start();
    statusBar.setText ( "Format : " + selectedFormat );
    currentFormat = selectedFormat;
    visualContainer.setPreferredSize ( currentFormat.getSize() );
    setSize ( imageSize.width, imageSize.height + statusBar.getHeight() + toolbar.getHeight() );
    else
    System.out.println ("Visual component not an instance of FormatControl");
    statusBar.setText ( "Visual component cannot change format" );
    public VideoFormat getFormat ( )
    return ( currentFormat );
    protected void setUpToolBar ( )
    toolbar = new JToolBar();
    // Note : If you supply the 16 x 16 bitmaps then you can replace
    // the commented line in the MyToolBarAction constructor
    formatButton = new MyToolBarAction ( "Resolution", "BtnFormat.jpg" );
    captureButton = new MyToolBarAction ( "Capture", "BtnCapture.jpg" );
    toolbar.add ( formatButton );
    toolbar.add ( captureButton );
    getContentPane().add ( toolbar, BorderLayout.NORTH );
    protected void toolbarHandler ( MyToolBarAction actionBtn )
    if ( actionBtn == formatButton )
    Object selected = JOptionPane.showInputDialog (this,
    "Select Video format",
    "Capture format selection",
    JOptionPane.INFORMATION_MESSAGE,
    null, // Icon icon,
    myFormatList, // videoFormats,
    currentFormat );
    if ( selected != null )
    setFormat ( ((MyVideoFormat)selected).format );
    else if ( actionBtn == captureButton )
    Image photo = grabFrameImage ( );
    if ( photo != null )
    MySnapshot snapshot = new MySnapshot ( photo, new Dimension ( imageSize ) );
    else
    System.err.println ("Error : Could not grab frame");
    * autoDetects the first web camera in the system
    * searches for video for windows ( vfw ) capture devices
    * @returns the device info object if found, null otherwise
    public CaptureDeviceInfo autoDetect ( )
    Vector list = CaptureDeviceManager.getDeviceList ( null );
    CaptureDeviceInfo devInfo = null;
    if ( list != null )
    String name;
    for ( int i=0; i<list.size(); i++ )
    devInfo = (CaptureDeviceInfo)list.elementAt ( i );
    name = devInfo.getName();
    if ( name.startsWith ("vfw:") )
    break;
    if ( devInfo != null && devInfo.getName().startsWith("vfw:") )
    return ( devInfo );
    else
    for ( int i = 0; i < 10; i++ )
    try
    name = VFWCapture.capGetDriverDescriptionName ( i );
    if (name != null && name.length() > 1)
    devInfo = com.sun.media.protocol.vfw.VFWSourceStream.autoDetect ( i );
    if ( devInfo != null )
    return ( devInfo );
    catch ( Exception ioEx )
    // ignore errors detecting device
    statusBar.setText ( "AutoDetect failed : " + ioEx.getMessage() );
    return ( null );
    else
    return ( null );
    * deviceInfo
    * @note outputs text information
    public void deviceInfo ( )
    if ( webCamDeviceInfo != null )
    Format[] formats = webCamDeviceInfo.getFormats();
    if ( ( formats != null ) && ( formats.length > 0 ) )
    for ( int i=0; i<formats.length; i++ )
    Format[] aFormat = formats;
    if ( aFormat[i] instanceof VideoFormat )
    Dimension dim = ((VideoFormat)aFormat).getSize();
    // System.out.println ("Video Format " + i + " : " + formats.getEncoding() + ", " + dim.width + " x " + dim.height );
    else
    System.out.println ("Error : No web cam detected");
    * grabs a frame's buffer from the web cam / device
    * @returns A frames buffer
    public Buffer grabFrameBuffer ( )
    if ( player != null )
    FrameGrabbingControl fgc = (FrameGrabbingControl)player.getControl ( "javax.media.control.FrameGrabbingControl" );
    if ( fgc != null )
    return ( fgc.grabFrame() );
    else
    System.err.println ("Error : FrameGrabbingControl is null");
    return ( null );
    else
    System.err.println ("Error : Player is null");
    return ( null );
    * grabs a frame's buffer, as an image, from the web cam / device
    * @returns A frames buffer as an image
    public Image grabFrameImage ( )
    Buffer buffer = grabFrameBuffer();
    if ( buffer != null )
    // Convert it to an image
    BufferToImage btoi = new BufferToImage ( (VideoFormat)buffer.getFormat() );
    if ( btoi != null )
    Image image = btoi.createImage ( buffer );
    if ( image != null )
    return ( image );
    else
    System.err.println ("Error : BufferToImage cannot convert buffer");
    return ( null );
    else
    System.err.println ("Error : cannot create BufferToImage instance");
    return ( null );
    else
    System.out.println ("Error : Buffer grabbed is null");
    return ( null );
    * Closes and cleans up the player
    public void playerClose ( )
    if ( player != null )
    player.close();
    player.deallocate();
    player = null;
    public void windowClosing ( WindowEvent e )
    playerClose();
    System.exit ( 1 );
    public void componentResized ( ComponentEvent e )
    Dimension dim = getSize();
    boolean mustResize = false;
    if ( dim.width < MIN_WIDTH )
    dim.width = MIN_WIDTH;
    mustResize = true;
    if ( dim.height < MIN_HEIGHT )
    dim.height = MIN_HEIGHT;
    mustResize = true;
    if ( mustResize )
    setSize ( dim );
    public void windowActivated ( WindowEvent e ) { }
    public void windowClosed ( WindowEvent e ) { }
    public void windowDeactivated ( WindowEvent e ) { }
    public void windowDeiconified ( WindowEvent e ) { }
    public void windowIconified ( WindowEvent e ) { }
    public void windowOpened ( WindowEvent e ) { }
    public void componentHidden(ComponentEvent e) { }
    public void componentMoved(ComponentEvent e) { }
    public void componentShown(ComponentEvent e) { }
    protected void finalize ( ) throws Throwable
    playerClose();
    super.finalize();
    class MyToolBarAction extends AbstractAction
    public MyToolBarAction ( String name, String imagefile )
    // Note : Use version this if you supply your own toolbar icons
    // super ( name, new ImageIcon ( imagefile ) );
    super ( name );
    public void actionPerformed ( ActionEvent event )
    toolbarHandler ( this );
    class MyVideoFormat
    public VideoFormat format;
    public MyVideoFormat ( VideoFormat _format )
    format = _format;
    public String toString ( )
    Dimension dim = format.getSize();
    return ( format.getEncoding() + " [ " + dim.width + " x " + dim.height + " ]" );
    class MySnapshot extends JFrame
    protected Image photo = null;
    protected int shotNumber;
    public MySnapshot ( Image grabbedFrame, Dimension imageSize )
    super ( );
    shotNumber = shotCounter++;
    setTitle ( "Photo" + shotNumber );
    photo = grabbedFrame;
    setDefaultCloseOperation ( WindowConstants.DISPOSE_ON_CLOSE );
    int imageHeight = photo.getWidth ( this );
    int imageWidth = photo.getHeight ( this );
    setSize ( imageSize.width, imageSize.height );
    final FileDialog saveDialog = new FileDialog ( this, "Save JPEG", FileDialog.SAVE );
    final JFrame thisCopy = this;
    saveDialog.setFile ( "Photo" + shotNumber );
    addWindowListener ( new WindowAdapter()
    public void windowClosing ( WindowEvent e )
    saveDialog.show();
    String filename = saveDialog.getFile();
    if ( filename != null )
    if ( saveJPEG ( filename ) )
    JOptionPane.showMessageDialog ( thisCopy, "Saved " + filename );
    setVisible ( false );
    dispose();
    else
    JOptionPane.showMessageDialog ( thisCopy, "Error saving " + filename );
    else
    setVisible ( false );
    dispose();
    setVisible ( true );
    public void paint ( Graphics g )
    g.drawImage ( photo, 0, 0, getWidth(), getHeight(), this );
    * Saves an image as a JPEG
    * @params the image to save
    * @params the filename to save the image as
    public boolean saveJPEG ( String filename )
    boolean saved = false;
    BufferedImage bi = new BufferedImage ( photo.getWidth(null),
    photo.getHeight(null),
    BufferedImage.TYPE_INT_RGB );
    Graphics2D g2 = bi.createGraphics();
    g2.drawImage ( photo, null, null );
    FileOutputStream out = null;
    try
    out = new FileOutputStream ( filename );
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder ( out );
    JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam ( bi );
    param.setQuality ( 1.0f, false ); // 100% high quality setting, no compression
    encoder.setJPEGEncodeParam ( param );
    encoder.encode ( bi );
    out.close();
    saved = true;
    catch ( Exception ex )
    System.out.println ("Error saving JPEG : " + ex.getMessage() );
    return ( saved );
    } // of MySnapshot
    public static void main (String[] args )
    try
    JWebCam myWebCam = new JWebCam ( "TimeSlice Web Cam Capture" );
    myWebCam.setVisible ( true );
    if ( !myWebCam.initialise() )
    System.out.println ("Web Cam not detected / initialised");
    catch ( Exception ex )
    ex.printStackTrace();
    when I run it I get the following errors
    BufferToImage cannot convert buffer
    could not grab frame
    pls help

    Do you expect anyone to read this?
    http://forum.java.sun.com/help.jspa?sec=formatting
    By the way, you have a condition that makes it print those messages. Check why that condiiton isn't rue.

  • Adding "window to a container:illegal argument exception".error plz help

    Thanks to Mr.Andrew and sun for developing the following code for a
    mediaplayer which is implemented in jmf.This is working in core java. But
    when i have converted it to Applet it compiles but an error adding "window
    to a container:illegal argument exception".code is given below plz point
    me where is the error;
    import javax.media.*;
    import java.text.DecimalFormat;
    import java.awt.*;
    import java.awt.FileDialog;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    class nwa extends WindowAdapter{
    frameclass frame;
    public nwa(frameclass frame){
    this.frame=frame;
    public void windowClosing (WindowEvent e)
    //User selected close from System menu.
    //Call dispose to invoke windowClosed.
    frame.dispose ();
    public void windowClosed (WindowEvent e)
    //if (player != null)
    //player.close ();
    System.exit (0);
    class frameclass extends JFrame
    frameclass(){
    nwa n=new nwa(this);
    this.addWindowListener(n);                    
    public class PlayerApplet extends JApplet
              implements
    ActionListener,ControllerListener,ItemListener, KeyListener
    frameclass frame=new frameclass();
    Player player;
    Component vc, cc;
    JProgressBar volumeBar;
         JButton fastRewind;
         JButton fastForward;
         JButton play;
    int sizeIncrease = 2;
    boolean invokedStop = false;
         /** Big */
         int progressFontSize=30;
    boolean first = true, loop = false;
    String currentDirectory;
    public void init(){
    JMenu m = new JMenu ("File");
    JMenuItem mi = new JMenuItem ("Open...");
    mi.addActionListener (this);
    m.add (mi);
    m.addSeparator ();
    JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem ("Loop", false);
    cbmi.addItemListener (this);
    m.add (cbmi);
    m.addSeparator ();
    mi = new JMenuItem ("Exit");
    mi.addActionListener (this);
    m.add (mi);
    JMenuBar mb = new JMenuBar ();
    mb.add (m);
    frame.setJMenuBar (mb);
    setSize (200, 200);
         final JPanel p = new JPanel(new GridLayout(1,0,5,5));
              p.setBorder(new EmptyBorder(3,5,5,5) );
              fastRewind = new JButton("<html><body><font size=+"+
    sizeIncrease+ "><<");
              fastRewind.setToolTipText("Fast Rewind");
              fastRewind.addActionListener( new ActionListener(){
                   public void actionPerformed(ActionEvent ae) {
                        if (player!=null) {
                             invokedStop = false;
                             skipBack();
                        } else {
    JOptionPane.showMessageDialog(play,
                             new JLabel("Open a sound file
    first!"));
              fastRewind.addKeyListener(this);
              p.add(fastRewind);
              JButton stop = new JButton("<html><body><font size=+"+
    sizeIncrease+ ">&#9632;");
              stop.setToolTipText("Stop");
              stop.addActionListener( new ActionListener(){
                   public void actionPerformed(ActionEvent ae) {
                        invokedStop = true;
                        //player.stop();
                        sp();
              stop.addKeyListener(this);
              p.add(stop);
              play = new JButton("<html><body><font size=+"+
    sizeIncrease+ ">>");
              play.setToolTipText("Play");
              play.addActionListener( new ActionListener(){
                   public void actionPerformed(ActionEvent ae) {
                        if (player!=null) {
                             invokedStop = false;
                             player.setRate(1);
                             st();
                        } else {
    JOptionPane.showMessageDialog(play,
                             new JLabel("Open a sound file
    first!"));
              play.addKeyListener(this);
              p.add(play);
              fastForward = new JButton("<html><body><font size=+"+
    sizeIncrease+ ">>>");
              fastForward.setToolTipText("Fast Forward");
              fastForward.addActionListener( new ActionListener(){
                   public void actionPerformed(ActionEvent ae) {
                        if (player!=null) {
                             invokedStop = false;
                             skipForward();
                        } else {
    JOptionPane.showMessageDialog(play,
                             new JLabel("Open a sound file
    first!"));
              fastForward.addKeyListener(this);
              p.add(fastForward);
              p.addKeyListener(this);
              frame.add(p,BorderLayout.CENTER);     
              add(frame);
    // pack ();
    setVisible (true);
    public void start(){
    st();
    public void stop(){
    sp();
    public void destroy(){
    player.stop();
    player.deallocate();
    public void actionPerformed (ActionEvent e)
                   if (e.getActionCommand().equals("Exit"))
                   // Call dispose to invoke windowClosed.
                   frame.dispose ();
                        return;
         FileDialog fd = new FileDialog (frame, "Open File",
    FileDialog.LOAD);
         fd.setDirectory (currentDirectory);
         fd.show ();
         // If user cancelled, exit.
              if (fd.getFile() == null)
         return;
    currentDirectory = fd.getDirectory ();
              if (player != null)
         player.close ();
         try
         player = Manager.createPlayer (new MediaLocator
    ("file:" +
    fd.getDirectory() +
    fd.getFile()));
         catch (java.io.IOException e2)
    System.out.println (e2);
    return;
         catch (NoPlayerException e2)
    System.out.println ("Could not find a player.");
    return;
              if (player == null)
         System.out.println ("Trouble creating a player.");
         return;
    first = false;
    frame.setTitle (fd.getFile ().toString());
    player.addControllerListener (this);
    player.prefetch ();
    public void controllerUpdate (ControllerEvent e)
    if (e instanceof ControllerClosedEvent)
    if (vc != null)
    remove (vc);
    vc = null;
    if (cc != null)
    remove (cc);
    cc = null;
    return;
    if (e instanceof EndOfMediaEvent)
    if (loop)
    player.setMediaTime (new Time (0));
    player.start ();
    return;
    if (e instanceof PrefetchCompleteEvent)
    player.start ();
    return;
    if (e instanceof RealizeCompleteEvent)
    vc = player.getVisualComponent ();
    if (vc != null)
    add (vc);
    cc = player.getControlPanelComponent ();
    if (cc != null){
         this.add (cc, BorderLayout.SOUTH);
                        this.show();
    public void keyReleased(KeyEvent ke) {
    int keycode = ke.getKeyCode();
              if (keycode==KeyEvent.VK_LEFT) {
                   skipBack();
              } else if (keycode==KeyEvent.VK_RIGHT) {
                   skipForward();
         public void keyTyped(KeyEvent ke) {
         int keycode = ke.getKeyCode();
              if (keycode==KeyEvent.VK_LEFT) {
                   skipBack();
              } else if (keycode==KeyEvent.VK_RIGHT) {
                   skipForward();
         public void keyPressed(KeyEvent ke) {
              int keycode = ke.getKeyCode();
              if (keycode==KeyEvent.VK_LEFT) {
                   skipBack();
              } else if (keycode==KeyEvent.VK_RIGHT) {
                   skipForward();
              }else if (keycode==KeyEvent.VK_UP) {
                   st();
              }else if (keycode==KeyEvent.VK_DOWN) {
                   sp();
    public void skipForward() {
    double secs=5;
    double playersecs = player.getMediaTime().getSeconds();
    Time settime = new javax.media.Time(playersecs + secs);
    player.setMediaTime(settime);
    public void skipBack() {
              double secs1=5;
    double playersecs1 = player.getMediaTime().getSeconds();
    Time settime1 = new javax.media.Time(playersecs1 - secs1);
    player.setMediaTime(settime1);
         public void st() {
         player.start();
         public void sp() {
         player.stop();
    public void itemStateChanged (ItemEvent e)
    loop = !loop;
    When i comment add(frame) this error goes but i got a null poiter
    exception
    Plz help
    manu

    Hi Andrew,
    Thanks for ur reply.Sorrry that my code not included in the code block.
    My problem have been solved partly.Now playerapplet is working properly.It can play files from local machine(through open menuitem from file menu) as well as local network (through url menuitem from file menu).
    There is no requirement to play file from internet at present.
    I have given arrow keys to forward/backward/open/close.
    I have now completed my first part of project.Now i have to start the second part ie Controlling arrow keys using a joystick like instrument.The instrument and driver will be provided by my co. and the user is using only this device.Plz help me how to do that.
    The code is given below
    import javax.media.*;
    import java.text.DecimalFormat;
    import java.awt.*;
    import java.awt.FileDialog;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    <APPLET CODE=PlayerApplet.class
    WIDTH=320 HEIGHT=300>
    </APPLET>
    class nwa extends WindowAdapter
         frameclass frame;
         Player player;
         public nwa(frameclass frame,Player player)
          this.player=player;
          this.frame=frame;
         public void windowClosing (WindowEvent e)
          //User selected close from System menu.
          //Call dispose to invoke windowClosed.
          frame.dispose ();
          public void windowClosed (WindowEvent e)
              if (player != null)
                   player.stop();
                player.close ();
                   player.deallocate();
          System.exit (0);
    class frameclass extends JFrame
    Player player;
         frameclass(Player player)
         nwa n=new nwa(this,player);
         this.addWindowListener(n);                    
    public class PlayerApplet extends JApplet
               implements ActionListener,ControllerListener,ItemListener, KeyListener
               Player player=null;
               frameclass frame=new frameclass(player);
                 Component vc, cc;
                 Container f;
                 JProgressBar volumeBar;
                 JButton fastRewind;
              JButton fastForward;
              JButton play;
              int sizeIncrease = 2;
              boolean invokedStop = false;
              /** Big */
              int progressFontSize=30;
                 boolean first = true, loop = false;
                 String currentDirectory;
                 public void init()
                          f=frame.getContentPane();
                         JMenu m = new JMenu ("File");
                         JMenuItem mi = new JMenuItem ("Open...");
                         mi.addActionListener (this);
                         m.add (mi);
                         m.addSeparator ();
                         mi = new JMenuItem ("URL");
                         mi.addActionListener (this);
                         m.add (mi);
                         m.addSeparator ();
                         JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem ("Loop", false);
                         cbmi.addItemListener (this);
                         m.add (cbmi);
                         m.addSeparator ();
                         mi = new JMenuItem ("Exit");
                         mi.addActionListener (this);
                         m.add (mi);
                         JMenuBar mb = new JMenuBar ();
                         mb.add (m);
                         frame.setJMenuBar (mb);
                         setSize (500, 500);
                           JPanel p = new JPanel(new GridLayout(1,0,5,5));
                        p.setBorder(new EmptyBorder(3,5,5,5) );
                        fastRewind = new JButton("<html><body><font size=+"+ sizeIncrease+ "><<");
                        fastRewind.setToolTipText("Fast Rewind");
                        fastRewind.addActionListener( new ActionListener(){
                             public void actionPerformed(ActionEvent ae) {
                                  if (player!=null) {
                                       invokedStop = false;
                                       skipBack();
                                  } else {
                                       JOptionPane.showMessageDialog(play,
                                       new JLabel("Open a sound file first!"));
                        fastRewind.addKeyListener(this);
                        p.add(fastRewind);
                        JButton stop = new JButton("<html><body><font size=+"+ sizeIncrease+ ">&#9632;");
                        stop.setToolTipText("Stop");
                        stop.addActionListener( new ActionListener(){
                                  public void actionPerformed(ActionEvent ae) {
                                       invokedStop = true;
                                       sp();
                        stop.addKeyListener(this);
                        p.add(stop);
                        play = new JButton("<html><body><font size=+"+ sizeIncrease+ ">>");
                        play.setToolTipText("Play");
                        play.addActionListener( new ActionListener()
                                  public void actionPerformed(ActionEvent ae) {
                                       if (player!=null) {
                                            invokedStop = false;
                                            player.setRate(1);
                                            st();
                                       } else {
                                            JOptionPane.showMessageDialog(play,
                                            new JLabel("Open a sound file first!"));
              play.addKeyListener(this);
              p.add(play);
              fastForward = new JButton("<html><body><font size=+"+ sizeIncrease+ ">>>");
              fastForward.setToolTipText("Fast Forward");
              fastForward.addActionListener( new ActionListener(){
                   public void actionPerformed(ActionEvent ae) {
                        if (player!=null) {
                             invokedStop = false;
                             skipForward();
                        } else {
                             JOptionPane.showMessageDialog(play,
                             new JLabel("Open a sound file first!"));
              fastForward.addKeyListener(this);
              p.add(fastForward);
              frame.getContentPane().add(p,BorderLayout.CENTER);
              frame.setVisible (true);
              frame.pack();
              frame.setResizable(false);
      public void stop(){
      sp();
      public void destroy(){
       player.stop();
        player.deallocate();
      public void actionPerformed (ActionEvent e)
              if (e.getActionCommand().equals("Exit"))
                             // Call dispose to invoke windowClosed.
                             player.stop();
                             player.close();
                             player.deallocate();
                             frame.dispose ();
                                  return;
              if (e.getActionCommand().equals("Open..."))
                             FileDialog fd = new FileDialog (frame, "Open File",
                                         FileDialog.LOAD);
                              fd.setDirectory (currentDirectory);
                              fd.show ();
                              // If user cancelled, exit.
                              if (fd.getFile() == null)
                             return;
                              currentDirectory = fd.getDirectory ();
                                   if (player != null){
                                       player.close ();
                                       player.deallocate();
                         try
                  player = Manager.createPlayer (new MediaLocator
                                               ("file:" +
                                               fd.getDirectory() +
                                               fd.getFile()));
                              catch (java.io.IOException e2)
                            System.out.println ("file not found :"+e2);
                            return;
                              catch (NoPlayerException e2)
                            System.out.println ("Could not find a player.");
                            return;
                    if (player == null)
                   System.out.println ("Trouble creating a player.");
                   return;
                    first = false;
                    frame.setTitle (fd.getFile ().toString());
                    player.addControllerListener (this);
                    player.prefetch ();
                   return;
              if (e.getActionCommand().equals("URL"))
                             FileDialog fd = new FileDialog (frame, "Open File",
                                         FileDialog.LOAD);
                         fd.setDirectory (currentDirectory);
                         fd.show ();
                         // If user cancelled, exit.
                              if (fd.getFile() == null)
                             return;
                         currentDirectory = fd.getDirectory ();
                              if (player != null){
                                       player.close ();
                                       player.deallocate();
                   try
                        URL url = new URL ("file://"+fd.getDirectory()+fd.getFile());
                    MediaLocator mediaLocator = new MediaLocator (url);
                        player = Manager.createPlayer (mediaLocator);
                   catch (java.io.IOException e2)
                  System.out.println ("file not found :"+e2);
                  return;
                    catch (NoPlayerException e2)
                  System.out.println ("Could not find a player.");
                  return;
                    if (player == null)
                   System.out.println ("Trouble creating a player.");
                   return;
          first = false;
          frame.setTitle (fd.getFile ().toString());
          player.addControllerListener (this);
          player.prefetch ();
              return;
       public void controllerUpdate (ControllerEvent e)
          if (e instanceof ControllerClosedEvent)
              if (vc != null)
                  frame.getContentPane().remove (vc);
                  vc = null;
              if (cc != null)
                  frame.getContentPane().remove (cc);
                  cc = null;
              return;
          if (e instanceof EndOfMediaEvent)
              if (loop)
                  player.setMediaTime (new Time (0));
                  player.start ();
              return;
          if (e instanceof PrefetchCompleteEvent)
              player.start();
              return;
          if (e instanceof RealizeCompleteEvent)
            if (vc != null)
                  remove (vc);
                  vc = null;
              if (cc != null)
                  remove (cc);
                  cc = null;
              vc = player.getVisualComponent ();
              if (vc != null)
                  frame.getContentPane().add(vc,BorderLayout.NORTH);
              cc = player.getControlPanelComponent ();
              if (cc != null){
                       frame.getContentPane().add (cc, BorderLayout.SOUTH);
                     frame.setVisible(true);
                     frame.pack();
    public void keyReleased(KeyEvent ke) {
    int keycode = ke.getKeyCode();
              if (keycode==KeyEvent.VK_LEFT) {
                   skipBack();
              } else if (keycode==KeyEvent.VK_RIGHT) {
                   skipForward();
         public void keyTyped(KeyEvent ke) {
         int keycode = ke.getKeyCode();
              if (keycode==KeyEvent.VK_LEFT) {
                   skipBack();
              } else if (keycode==KeyEvent.VK_RIGHT) {
                   skipForward();
         public void keyPressed(KeyEvent ke) {
              int keycode = ke.getKeyCode();
              if (keycode==KeyEvent.VK_LEFT) {
                   skipBack();
              } else if (keycode==KeyEvent.VK_RIGHT) {
                   skipForward();
              }else if (keycode==KeyEvent.VK_UP) {
                   st();
              }else if (keycode==KeyEvent.VK_DOWN) {
                   sp();
    public void skipForward() {
    Time settime;
    double secs=5;
    double playersecs = player.getMediaTime().getSeconds();
    double duration = player.getDuration().getSeconds();
              if((playersecs+secs) < duration){
                      settime = new javax.media.Time(playersecs + secs);
                      player.setMediaTime(settime);
              }else {
                        player.setMediaTime(new Time(duration));
    public void skipBack() {
              double secs1=5;
              double secs2=0;
              double playersecs1 = player.getMediaTime().getSeconds();
              Time settime1;
              if((playersecs1 - secs1) > secs2){
                      settime1 = new javax.media.Time(playersecs1 - secs1);
                      player.setMediaTime(settime1);
              }else {
                        player.setMediaTime(new Time(0));
         public void st() {
         player.start();
         public void sp() {
         player.stop();
       public void itemStateChanged (ItemEvent e)
          loop = !loop;
    With Thanks
    manuEdited by: mm_mm on Nov 27, 2007 11:09 PM

  • Filtering in FileDialog (urgent please)

    Hello everybody,
    I was watching one problem with JFileChooser ( Error: "There is no A drive...." at this forum , as i was
    also facing the same problem. BUT when someone suggested , i tried FileDialog and I could get rid of that
    Error
    BUT now i have problem of filtering file , which was so
    easy in JFileChooser . There is getFilenameFilter() and
    setFilenameFilter(FilenameFilter ft) BUT JAVA-Api
    says that
    "...Filename filters do not function in Sun's reference implementation for Windows 95, 98, or NT 4.0."
    I didnt get it properly. Does it mean that we can filter files
    using FileDialog , if i run on these OS..?
    thanx for ur time and help..
    regds,
    Rajesh

    you can also add Windows 2000 to that.
    I am also facing the same problem. The only workaround is to use the setFile("*.ext")
    -aprajit

  • Compile error in paint() method while trying to draw graphics

    Hi ,
    I am trying to draw two lines given the sceen coordinated through a mouse click. I am getting the following error
    Pos.java:90: illegal start of expression
    public void paint(Graphics g)
    ^
    Pos.java:102: ';' expected
    ^
    2 errors
    My code is as follows:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.geom.*;
    public class Pos extends Container {
    //public void paint(Graphics);
    public static void main(String args[]) {
    Pos p = new Pos();
         p.getPosition();
    JButton bn = new JButton("Draw Line");
    int posx=0;
    int posy=0;
    int i=0;
    int x[] = new int[4];
    int y[] = new int[4];
    public void getPosition() {
    JFrame frame = new JFrame("Mouse Position");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel label = new JLabel();
    label.setHorizontalAlignment(JLabel.CENTER);
    /*MouseMotionListener mouseMotionListener = new MouseMotionListener() {
    public void mouseDragged(MouseEvent e) {
    public void mouseMoved(MouseEvent e) {
              MouseListener mouseListener = new MouseListener(){
                   public void mouseEntered(MouseEvent evnt){
                   public void mouseExited(MouseEvent evnt){
                   public void mousePressed(MouseEvent evnt){
                   public void mouseReleased(MouseEvent evnt){
                   public void mouseClicked(MouseEvent evnt) {
                        showMousePos(evnt);
                        //mon.setText("("+MouseInfo.getPointerInfo().getLocation().x+","+
                                            //MouseInfo.getPointerInfo().getLocation().y+")");
                   private void showMousePos(MouseEvent evnt) {
    JLabel src = (JLabel)evnt.getComponent();
                   posx = MouseInfo.getPointerInfo().getLocation().x;
                   posy = MouseInfo.getPointerInfo().getLocation().y;
    System.out.println("x-coordinate="+posx);
                   System.out.println("y-coordinate="+posy);
                   x=posx;
                   y[i]=posy;
                   i=i+1;
              label.addMouseMotionListener(mouseMotionListener);
              label.addMouseListener(mouseListener);
              label.addActionListener(actionListener);
    frame.add(label, BorderLayout.CENTER);
              bn.setSize(10,10);
              frame.add(bn, BorderLayout.NORTH);
    frame.setSize(300, 300);
    frame.setVisible(true);
         ActionListener actionListener = new ActionListener(){
                   public void actionPerformed(ActionEvent ae)
                        Object o = ae.getSource();
                        if (o==button)
                             public void paint(Graphics g)
                                  Graphics2D g2D = (Graphics2D)g;
                                  //int p[]=new int[4];
                                  g2D.setColor(Color.red);
                                  //for (int j=0;j<2;j++)
                                       //Point2D.Int p[j]= new Point2D.Int(x[j],y[j]);                              
                                  //Line2D line = new Line2D.Int(p[0],p[1]);
                                  g2D.drawline(x[0],y[0],x[1],y[1]);
                                  i=0;
    Please tell me what the mistake is.
    lakki

    Thank you all for the sggestions. The error was exactly due to what you mentioned above. I fixed that by drawing the lines on another JPanel and it is working now.
    But I have a bigger problem. How to make a JPanel transparent. I have to draw lines on a video. The panel for drawing lines is opaque and so I can draw lines only if I am able to see the video. setOpaque(false) does not seem to work. I am posting my code below. Please see if you can help me out.
    import javax.media.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import java.lang.Math;
    import javax.media.control.FramePositioningControl;
    import javax.media.protocol.*;
    import javax.swing.*;
    class MPEGPlayer2 extends JFrame implements ActionListener,ControllerListener,ItemListener
         Player player;
         Component vc, cc;
         boolean first = true, loop = false;
         String currentDirectory;
         int mediatime;
         BufferedWriter out;
         FileWriter fos;
         String filename = "";
         Object waitSync = new Object();
         boolean stateTransitionOK = true;
         JButton bn = new JButton("DrawLine");
         MPEGPlayer2 (String title)
              super (title);
              addWindowListener(new WindowAdapter ()
                   public void windowClosing (WindowEvent e)
                        dispose ();
                public void windowClosed (WindowEvent e)
                        if (player != null)
                        player.close ();
                        System.exit (0);
              Menu m = new Menu ("File");
              MenuItem mi = new MenuItem ("Open...");
              mi.addActionListener (this);
              m.add (mi);
              m.addSeparator ();
              CheckboxMenuItem cbmi = new CheckboxMenuItem ("Loop", false);
              cbmi.addItemListener (this);
              m.add (cbmi);
              m.addSeparator ();
              mi = new MenuItem ("Exit");
              mi.addActionListener (this);
              m.add (mi);
              MenuBar mb = new MenuBar ();
              mb.add (m);
              setMenuBar (mb);
              setSize (500, 500);
              setVisible (true);
         public void actionPerformed (ActionEvent ae)
                        FileDialog fd = new FileDialog (this, "Open File",FileDialog.LOAD);
                        fd.setDirectory (currentDirectory);
                        fd.show ();
                        if (fd.getFile () == null)
                        return;
                        currentDirectory = fd.getDirectory ();
                        try
                             player = Manager.createPlayer (new MediaLocator("file:" +fd.getDirectory () +fd.getFile ()));
                             filename = fd.getFile();
                        catch (Exception exe)
                             System.out.println(exe);
                        if (player == null)
                             System.out.println ("Trouble creating a player.");
                             return;
                        setTitle (fd.getFile ());
                        player.addControllerListener (this);
                        player.prefetch ();
         }// end of action performed
         public void controllerUpdate (ControllerEvent e)
              if (e instanceof EndOfMediaEvent)
                   if (loop)
                        player.setMediaTime (new Time (0));
                        player.start ();
                   return;
              if (e instanceof PrefetchCompleteEvent)
                   player.start ();
                   return;
              if (e instanceof RealizeCompleteEvent)
                   vc = player.getVisualComponent ();
                   if (vc != null)
                        add (vc);
                   cc = player.getControlPanelComponent ();
                   if (cc != null)
                        add (cc, BorderLayout.SOUTH);
                   add(new MyPanel());
                   pack ();
         public void itemStateChanged(ItemEvent ee)
         public static void main (String [] args)
              MPEGPlayer2 mp = new MPEGPlayer2 ("Media Player 2.0");
              System.out.println("111111");
    class MyPanel extends JPanel
         int i=0,j;
         public int xc[]= new int[100];
         public int yc[]= new int[100];
         int a,b,c,d;
         public MyPanel()
              setOpaque(false);
              setBorder(BorderFactory.createLineBorder(Color.black));
              JButton bn = new JButton("DrawLine");
              this.add(bn);
              bn.addActionListener(actionListener);
              setBackground(Color.CYAN);
              addMouseListener(new MouseAdapter()
                            public void mouseClicked(MouseEvent e)
                        saveCoordinates(e.getX(),e.getY());
         ActionListener actionListener = new ActionListener()
              public void actionPerformed(ActionEvent aae)
                        repaint();
         public void saveCoordinates(int x, int y)
              System.out.println("x-coordinate="+x);
                   System.out.println("y-coordinate="+y);
                   xc=x;
              yc[i]=y;
              System.out.println("i="+i);
              i=i+1;
         public Dimension getPreferredSize()
    return new Dimension(500,500);
         public void paintComponent(Graphics g)
    super.paintComponent(g);
              Graphics2D g2D = (Graphics2D)g;
              //g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
              g2D.setColor(Color.GREEN);
              for (j=0;j<i;j=j+2)
                   g2D.drawLine(xc[j],yc[j],xc[j+1],yc[j+1]);

  • FileDialog in Applet throwing security exception.

    I am trying to create a simple applet that a user can select a file from and then upload that file to a server somewhere. I am able to accomplish this using the JApplet class and the JFileChooser class. Everything works fine with the signed applet. However I am going to need to make it compliant with the Microsoft VM since it is for a corporate settings and those people won't have admin rights on their machines to toggle between the VM. So JApplet has been changed to Applet, JFileChooser has been changed to FileDailog and now I am getting this error:
    com.ms.security.SecurityExceptionEx[com/java/applet/il/AimsImporter/AimsImportApplet.actionPerformed]: FileDialog creation denied.
         at com/ms/security/permissions/UIPermission.check
         at com/ms/security/PolicyEngine.deepCheck
         at com/ms/security/PolicyEngine.checkPermission
         at com/ms/security/StandardSecurityManager.chk
         at com/ms/security/StandardSecurityManager.checkFileDialog
         at java/awt/FileDialog.<init>
         at com/java/applet/il/AimsImporter/AimsImportApplet.actionPerformed
         at java/awt/Button.processActionEvent
         at java/awt/Button.processEvent
         at java/awt/Component.dispatchEventImpl
         at java/awt/Component.dispatchEvent
         at java/awt/EventDispatchThread.run
    com.ms.security.SecurityExceptionEx[com/java/applet/il/AimsImporter/AimsImportApplet.actionPerformed]: FileDialog creation denied.
    This line of code is where it blows up:
    FileDialog fileDialog = new FileDialog(new Frame(), "Please choose the file to open:", FileDialog.LOAD);The jar is signed, however something of interest to note: there isn't a pop-up asking me if I would like to trust this applet when I use the Microsoft VM?
    jar.exe -cvf k:\applet\lib\Importer.jar com.java.applet.il.AimsImporter/*.class
    jarsigner k:\applet\lib\Importer.jar mykey
    jarsigner -verify Importer.jar
    Is there something that is different when doing this with the Microsoft VM?????
    Help! :)

    I am trying to create a simple applet that a user can select a file from and then upload that file to a server somewhere. I am able to accomplish this using the JApplet class and the JFileChooser class. Everything works fine with the signed applet. However I am going to need to make it compliant with the Microsoft VM since it is for a corporate settings and those people won't have admin rights on their machines to toggle between the VM. So JApplet has been changed to Applet, JFileChooser has been changed to FileDailog and now I am getting this error:
    com.ms.security.SecurityExceptionEx[com/java/applet/il/AimsImporter/AimsImportApplet.actionPerformed]: FileDialog creation denied.
         at com/ms/security/permissions/UIPermission.check
         at com/ms/security/PolicyEngine.deepCheck
         at com/ms/security/PolicyEngine.checkPermission
         at com/ms/security/StandardSecurityManager.chk
         at com/ms/security/StandardSecurityManager.checkFileDialog
         at java/awt/FileDialog.<init>
         at com/java/applet/il/AimsImporter/AimsImportApplet.actionPerformed
         at java/awt/Button.processActionEvent
         at java/awt/Button.processEvent
         at java/awt/Component.dispatchEventImpl
         at java/awt/Component.dispatchEvent
         at java/awt/EventDispatchThread.run
    com.ms.security.SecurityExceptionEx[com/java/applet/il/AimsImporter/AimsImportApplet.actionPerformed]: FileDialog creation denied.
    This line of code is where it blows up:
    FileDialog fileDialog = new FileDialog(new Frame(), "Please choose the file to open:", FileDialog.LOAD);The jar is signed, however something of interest to note: there isn't a pop-up asking me if I would like to trust this applet when I use the Microsoft VM?
    jar.exe -cvf k:\applet\lib\Importer.jar com.java.applet.il.AimsImporter/*.class
    jarsigner k:\applet\lib\Importer.jar mykey
    jarsigner -verify Importer.jar
    Is there something that is different when doing this with the Microsoft VM?????
    Help! :)

  • Problem in FileDialog

    Hi,
    i am new in event handling programs and i make a small program using FileDialog . but FileDialog is nor working properly .
    here is my code
    import java.awt.event.*;
    import java.awt.*;
    import java.io.*;
    public class frameopen extends Frame
    frameopen f;
    String msg = "";
    Panel p1 = new Panel();
    Panel p2 = new Panel();
    Label l = new Label("Enter URL");
    Label l2 = new Label("");
    TextField t = new TextField(50);
    Button b = new Button("OPEN");
    Button b1 = new Button("Browse");
    public frameopen()
    public void frame(frameopen object)
    f=object;
    setTitle("FILE OPENER");
    setBackground(Color.cyan);
    setForeground(Color.red);
    setSize(600,200);
    setLocation(250,250);
    p1.add(l);
    p1.add(t);
    p1.add(b1);
    p2.add(b);
    p1.add(l2);
    add("North",p1);
    add("Center",p2);
    b.addMouseListener(new my(b));
    b1.addMouseListener(new my(b1));
    addWindowListener(new my1());
    class my extends MouseAdapter
    Button temp;
    String s;
              my(Button obj)
                        temp=obj;
    s=temp.getLabel();
              public void mousePressed(MouseEvent evt)
                        if(s.equals(b.getLabel()))
                                  try
                                       File f1 = new File(t.getText());
                                       if(f1.exists())
                                                 Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + f1.getAbsolutePath());
                                       else
                                                 msg = " File Not Found. Please Check URL.";
                                                 error e1 = new error(f,msg);
                                                 e1.setVisible(true);
                                  catch (Exception e)
                                       msg = "" + e;
                                       error e1 = new error(f,msg);
                                       e1.setVisible(true);
                        else
                                  try
    File fd = new File(f,"SELECT");
                                  fd.setVisible(true);
    t.setText(fd.text());
    catch (Exception e)
                                       msg = "" + e;
                                       error e1 = new error(f,msg);
                                       e1.setVisible(true);
    class my1 extends WindowAdapter
    public void windowClosing(WindowEvent evt)
    System.exit(0);
    public static void main(String args[])
    frameopen f = new frameopen();
    f.frame(f);
    f.setVisible(true);
    class error extends Dialog implements ActionListener
    String msg = "";
    Panel p = new Panel();
    Panel p1 = new Panel();
    Label l = new Label();
    Button b= new Button("OK");
    error(Frame parent ,String title)
    super(parent , "ERROR" , false);
    setSize(300,100);
    setLocation(150,50);
    msg = title ;
    l.setText(msg);
    p.add(l);
    p1.add(b);
    add("North",p);
    add("Center",p1);
    b.addActionListener(this);
    addWindowListener(new my());
    public void actionPerformed(ActionEvent evt)
    dispose();
    class my extends WindowAdapter
    public void windowClosing(WindowEvent evt)
    dispose();
    class file extends FileDialog implements ActionListener
    file ob = new file();
    file(Frame obj , String Title)
    super(f,title);
    public void windowClosing(ActionEvent evt)
    dispose();
    public String text()
    String msg = ob.getDirectory()+ ob.getFile();
    in this code all is running well except FileDialog which is extended in file class. event handling of other component are also effected by FileDialog. on executing this code i got one text file of name
    **hs_err_pid3208**
    and the matter inside the file is
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7ca2cd53, pid=3208, tid=1320
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_08-b03 mixed mode)
    # Problematic frame:
    # C [SHELL32.DLL+0x6cd53]
    --------------- T H R E A D ---------------
    Current thread (0x0acae058): JavaThread "AWT-Windows" daemon [_thread_in_native, id=1320]
    siginfo: ExceptionCode=0xc0000005, reading address 0x00000000
    Registers:
    EAX=0x00000000, EBX=0x000df570, ECX=0x000df570, EDX=0x7c90eb94
    ESP=0x0af5d49c, EBP=0x0af5d4b0, ESI=0x000df570, EDI=0x000df6dc
    EIP=0x7ca2cd53, EFLAGS=0x00010246
    Top of Stack: (sp=0x0af5d49c)
    0x0af5d49c: 000df6dc 00000000 000df570 ffffffff
    0x0af5d4ac: 00000000 0af5d504 7c9f8268 00000001
    0x0af5d4bc: 00000000 000af0a0 0af5d538 00002000
    0x0af5d4cc: 0af5d498 0af5d4e0 0af5e450 77d7046f
    0x0af5d4dc: 77d48840 ffffffff 77d4883a 00010015
    0x0af5d4ec: 000ba0f8 00000000 002a01ec 0000000b
    0x0af5d4fc: 00000000 00000000 0af5d538 7ca2cf8a
    0x0af5d50c: 00000003 00000063 00000000 00000000
    Instructions: (pc=0x7ca2cd53)
    0x7ca2cd43: 83 4d f8 ff 83 65 fc 00 53 56 57 8b f1 8b 46 3c
    0x7ca2cd53: 8b 08 8d 96 38 02 00 00 52 8d 55 f8 52 6a 08 bf
    Stack: [0x0af20000,0x0af60000), sp=0x0af5d49c, free space=245k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C [SHELL32.DLL+0x6cd53]
    C [SHELL32.DLL+0x38268]
    C [SHELL32.DLL+0x6cf8a]
    C [COMDLG32.DLL+0x46d4]
    C [COMDLG32.DLL+0x44cc]
    C [COMDLG32.DLL+0x433c]
    C [COMDLG32.DLL+0x3eed]
    C [COMDLG32.DLL+0x3e41]
    C [COMDLG32.DLL+0x3dc4]
    C [COMDLG32.DLL+0x3a84]
    C [COMDLG32.DLL+0x3678]
    C [USER32.dll+0x8744]
    C [USER32.dll+0x15324]
    C [USER32.dll+0x14d17]
    C [USER32.dll+0x14f44]
    C [USER32.dll+0x8744]
    C [USER32.dll+0x8826]
    C [USER32.dll+0xb8ab]
    C [USER32.dll+0x15b68]
    C [USER32.dll+0x16f01]
    C [USER32.dll+0x16f56]
    C [USER32.dll+0x22066]
    C [COMDLG32.DLL+0x35de]
    C [COMDLG32.DLL+0x33e5]
    C [COMDLG32.DLL+0x33bc]
    C [COMDLG32.DLL+0x17cc7]
    C [awt.dll+0xcf68d]
    C [USER32.dll+0x8744]
    C [USER32.dll+0x8826]
    C [USER32.dll+0xb8ab]
    C [USER32.dll+0xb913]
    C [awt.dll+0xcf682]
    C [awt.dll+0xe56e4]
    C [USER32.dll+0x8744]
    C [USER32.dll+0x8826]
    C [USER32.dll+0xb4d0]
    C [USER32.dll+0xb51c]
    C [ntdll.dll+0xeae3]
    C [USER32.dll+0x9412]
    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j sun.awt.windows.WToolkit.eventLoop()V+0
    j sun.awt.windows.WToolkit.run()V+69
    j java.lang.Thread.run()V+11
    v ~StubRoutines::call_stub
    --------------- P R O C E S S ---------------
    Java Threads: ( => current thread )
    0x0ac6ac10 JavaThread "Thread-1" daemon [_thread_in_native, id=3212]
    0x0ac6a9e8 JavaThread "SIGTERM handler" daemon [_thread_blocked, id=3360]
    0x0ac69150 JavaThread "Thread-10" [_thread_in_native, id=2884]
    0x00035858 JavaThread "DestroyJavaVM" [_thread_blocked, id=3204]
    0x0acb3b18 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=3232]
    =>0x0acae058 JavaThread "AWT-Windows" daemon [_thread_in_native, id=1320]
    0x0acadca0 JavaThread "AWT-Shutdown" [_thread_blocked, id=2836]
    0x00acdb30 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=1636]
    0x00a93f28 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=1392]
    0x00a92af8 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3220]
    0x00a91ed8 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1356]
    0x00a88ed8 JavaThread "Finalizer" daemon [_thread_blocked, id=1404]
    0x00a87a90 JavaThread "Reference Handler" daemon [_thread_blocked, id=1408]
    Other Threads:
    0x00a47fb0 VMThread [id=1412]
    0x00a95108 WatcherThread [id=1340]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    Heap
    def new generation total 576K, used 373K [0x02ad0000, 0x02b70000, 0x02fb0000)
    eden space 512K, 60% used [0x02ad0000, 0x02b1d4a8, 0x02b50000)
    from space 64K, 100% used [0x02b60000, 0x02b70000, 0x02b70000)
    to space 64K, 0% used [0x02b50000, 0x02b50000, 0x02b60000)
    tenured generation total 1408K, used 191K [0x02fb0000, 0x03110000, 0x06ad0000)
    the space 1408K, 13% used [0x02fb0000, 0x02fdfef0, 0x02fe0000, 0x03110000)
    compacting perm gen total 8192K, used 3898K [0x06ad0000, 0x072d0000, 0x0aad0000)
    the space 8192K, 47% used [0x06ad0000, 0x06e9eb38, 0x06e9ec00, 0x072d0000)
    No shared spaces configured.
    Dynamic libraries:
    0x00400000 - 0x0040d000      C:\jdk1.5.0_08\bin\java.exe
    0x7c900000 - 0x7c9b0000      C:\WINDOWS\system32\ntdll.dll
    0x7c800000 - 0x7c8f4000      C:\WINDOWS\system32\kernel32.dll
    0x77dd0000 - 0x77e6b000      C:\WINDOWS\system32\ADVAPI32.dll
    0x77e70000 - 0x77f01000      C:\WINDOWS\system32\RPCRT4.dll
    0x77c10000 - 0x77c68000      C:\WINDOWS\system32\MSVCRT.dll
    0x6d730000 - 0x6d8cb000      C:\jdk1.5.0_08\jre\bin\client\jvm.dll
    0x77d40000 - 0x77dd0000      C:\WINDOWS\system32\USER32.dll
    0x77f10000 - 0x77f57000      C:\WINDOWS\system32\GDI32.dll
    0x76b40000 - 0x76b6d000      C:\WINDOWS\system32\WINMM.dll
    0x6d2f0000 - 0x6d2f8000      C:\jdk1.5.0_08\jre\bin\hpi.dll
    0x76bf0000 - 0x76bfb000      C:\WINDOWS\system32\PSAPI.DLL
    0x6d700000 - 0x6d70c000      C:\jdk1.5.0_08\jre\bin\verify.dll
    0x6d370000 - 0x6d38d000      C:\jdk1.5.0_08\jre\bin\java.dll
    0x6d720000 - 0x6d72f000      C:\jdk1.5.0_08\jre\bin\zip.dll
    0x6d070000 - 0x6d1d9000      C:\jdk1.5.0_08\jre\bin\awt.dll
    0x73000000 - 0x73026000      C:\WINDOWS\system32\WINSPOOL.DRV
    0x76390000 - 0x763ad000      C:\WINDOWS\system32\IMM32.dll
    0x774e0000 - 0x7761d000      C:\WINDOWS\system32\ole32.dll
    0x5ad70000 - 0x5ada8000      C:\WINDOWS\system32\uxtheme.dll
    0x73760000 - 0x737a9000      C:\WINDOWS\system32\ddraw.dll
    0x73bc0000 - 0x73bc6000      C:\WINDOWS\system32\DCIMAN32.dll
    0x6d2b0000 - 0x6d2ef000      C:\jdk1.5.0_08\jre\bin\fontmanager.dll
    0x10000000 - 0x10007000      C:\Internet Download Manager\idmmkb.dll
    0x7c9c0000 - 0x7d399000      C:\WINDOWS\system32\SHELL32.DLL
    0x77f60000 - 0x77fd6000      C:\WINDOWS\system32\SHLWAPI.dll
    0x773d0000 - 0x774d3000      C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2649_x-ww_aac16c8b\comctl32.dll
    0x5d090000 - 0x5d12a000      C:\WINDOWS\system32\comctl32.dll
    0x763b0000 - 0x763f9000      C:\WINDOWS\system32\COMDLG32.DLL
    0x77b40000 - 0x77b62000      C:\WINDOWS\system32\appHelp.dll
    0x76fd0000 - 0x7704f000      C:\WINDOWS\system32\CLBCATQ.DLL
    0x77050000 - 0x77115000      C:\WINDOWS\system32\COMRes.dll
    0x77120000 - 0x771ac000      C:\WINDOWS\system32\OLEAUT32.dll
    0x77c00000 - 0x77c08000      C:\WINDOWS\system32\VERSION.dll
    0x77a20000 - 0x77a74000      C:\WINDOWS\System32\cscui.dll
    0x76600000 - 0x7661d000      C:\WINDOWS\System32\CSCDLL.dll
    0x75f80000 - 0x7607d000      C:\WINDOWS\system32\browseui.dll
    0x769c0000 - 0x76a73000      C:\WINDOWS\system32\USERENV.dll
    0x77920000 - 0x77a13000      C:\WINDOWS\system32\SETUPAPI.dll
    0x76990000 - 0x769b5000      C:\WINDOWS\system32\ntshrui.dll
    0x76b20000 - 0x76b31000      C:\WINDOWS\system32\ATL.DLL
    0x5b860000 - 0x5b8b5000      C:\WINDOWS\system32\NETAPI32.dll
    0x77760000 - 0x778cf000      C:\WINDOWS\system32\shdocvw.dll
    0x77a80000 - 0x77b14000      C:\WINDOWS\system32\CRYPT32.dll
    0x77b20000 - 0x77b32000      C:\WINDOWS\system32\MSASN1.dll
    0x754d0000 - 0x75550000      C:\WINDOWS\system32\CRYPTUI.dll
    0x76c30000 - 0x76c5e000      C:\WINDOWS\system32\WINTRUST.dll
    0x76c90000 - 0x76cb8000      C:\WINDOWS\system32\IMAGEHLP.dll
    0x771b0000 - 0x77259000      C:\WINDOWS\system32\WININET.dll
    0x76f60000 - 0x76f8c000      C:\WINDOWS\system32\WLDAP32.dll
    0x20000000 - 0x202c9000      C:\WINDOWS\system32\xpsp2res.dll
    0x75e90000 - 0x75f40000      C:\WINDOWS\system32\SXS.DLL
    0x71b20000 - 0x71b32000      C:\WINDOWS\system32\MPR.dll
    0x75f60000 - 0x75f67000      C:\WINDOWS\System32\drprov.dll
    0x71c10000 - 0x71c1e000      C:\WINDOWS\System32\ntlanman.dll
    0x71cd0000 - 0x71ce7000      C:\WINDOWS\System32\NETUI0.dll
    0x71c90000 - 0x71cd0000      C:\WINDOWS\System32\NETUI1.dll
    0x71c80000 - 0x71c87000      C:\WINDOWS\System32\NETRAP.dll
    0x71bf0000 - 0x71c03000      C:\WINDOWS\System32\SAMLIB.dll
    0x75f70000 - 0x75f79000      C:\WINDOWS\System32\davclnt.dll
    0x0b600000 - 0x0b658000      C:\WINDOWS\system32\PortableDeviceApi.dll
    0x4d4f0000 - 0x4d548000      C:\WINDOWS\system32\WINHTTP.dll
    0x75970000 - 0x75ade000      C:\WINDOWS\system32\MSGINA.dll
    0x76360000 - 0x76370000      C:\WINDOWS\system32\WINSTA.dll
    0x74320000 - 0x7435d000      C:\WINDOWS\system32\ODBC32.dll
    0x0b8a0000 - 0x0b8b7000      C:\WINDOWS\system32\odbcint.dll
    0x77fe0000 - 0x77ff1000      C:\WINDOWS\system32\Secur32.dll
    VM Arguments:
    java_command: frameope
    Launcher Type: SUN_STANDARD
    Environment Variables:
    JAVA_HOME=C:\jdk1.5.0_08\
    CLASSPATH=.;c:\Tomcat\common\lib\servlet.jar;C:\tomcat\common\lib\servlet-api.jar;C:\classes\jl1.0.jar;C:\classes\mp3spi1.9.2.jar;C:\classes\tritonus_share.jar
    PATH=C:\jdk1.5.0_08\bin;E:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Sun\AppServer\bin;;C:\jdk1.5.0_08\bin
    USERNAME=abhishek
    OS=Windows_NT
    PROCESSOR_IDENTIFIER=x86 Family 15 Model 2 Stepping 9, GenuineIntel
    --------------- S Y S T E M ---------------
    OS: Windows XP Build 2600 Service Pack 2
    CPU:total 1 (cores per cpu 1, threads per core 1) family 15 model 2 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2
    Memory: 4k page, physical 253424k(68724k free), swap 620672k(203748k free)
    vm_info: Java HotSpot(TM) Client VM (1.5.0_08-b03) for windows-x86, built on Jul 26 2006 01:10:50 by "java_re" with MS VC++ 6.0
    PLEASE HELP ME TO UNDERSTAND THIS

    dude
    their is a prblm in FileDialog nt in my coding coz i got one file of after the execution of this code
    which states that their is aprblm in java hotspot virtual machine. Here is a content of the file and if u run this prgrm thn i
    think u also get tht. nd i m using java1.5
    # An unexpected error has been detected by HotSpot Virtual Machine:
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7ca2cd53, pid=1576, tid=560
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_08-b03 mixed mode)
    # Problematic frame:
    # C  [SHELL32.DLL+0x6cd53]
    ---------------  T H R E A D  ---------------
    Current thread (0x0acae058):  JavaThread "AWT-Windows" daemon [_thread_in_native, id=560]
    siginfo: ExceptionCode=0xc0000005, reading address 0x00000000
    Registers:
    EAX=0x00000000, EBX=0x000cd7d8, ECX=0x000cd7d8, EDX=0x7c90eb94
    ESP=0x0af5d49c, EBP=0x0af5d4b0, ESI=0x000cd7d8, EDI=0x000cd944
    EIP=0x7ca2cd53, EFLAGS=0x00010246
    Top of Stack: (sp=0x0af5d49c)
    0x0af5d49c:   000cd944 00000000 000cd7d8 ffffffff
    0x0af5d4ac:   00000000 0af5d504 7c9f8268 00000001
    0x0af5d4bc:   00000000 000af2a8 0af5d538 00002000
    0x0af5d4cc:   0af5d498 0af5d4e0 0af5e450 77d7046f
    0x0af5d4dc:   77d48840 ffffffff 77d4883a 00010015
    0x0af5d4ec:   000c3498 00000000 000d01f4 0000000b
    0x0af5d4fc:   00000000 00000000 0af5d538 7ca2cf8a
    0x0af5d50c:   00000003 00000063 00000000 00000000
    Instructions: (pc=0x7ca2cd53)
    0x7ca2cd43:   83 4d f8 ff 83 65 fc 00 53 56 57 8b f1 8b 46 3c
    0x7ca2cd53:   8b 08 8d 96 38 02 00 00 52 8d 55 f8 52 6a 08 bf
    Stack: [0x0af20000,0x0af60000),  sp=0x0af5d49c,  free space=245k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C  [SHELL32.DLL+0x6cd53]
    C  [SHELL32.DLL+0x38268]
    C  [SHELL32.DLL+0x6cf8a]
    C  [COMDLG32.DLL+0x46d4]
    C  [COMDLG32.DLL+0x44cc]
    C  [COMDLG32.DLL+0x433c]
    C  [COMDLG32.DLL+0x3eed]
    C  [COMDLG32.DLL+0x3e41]
    C  [COMDLG32.DLL+0x3dc4]
    C  [COMDLG32.DLL+0x3a84]
    C  [COMDLG32.DLL+0x3678]
    C  [USER32.dll+0x8744]
    C  [USER32.dll+0x15324]
    C  [USER32.dll+0x14d17]
    C  [USER32.dll+0x14f44]
    C  [USER32.dll+0x8744]
    C  [USER32.dll+0x8826]
    C  [USER32.dll+0xb8ab]
    C  [USER32.dll+0x15b68]
    C  [USER32.dll+0x16f01]
    C  [USER32.dll+0x16f56]
    C  [USER32.dll+0x22066]
    C  [COMDLG32.DLL+0x35de]
    C  [COMDLG32.DLL+0x33e5]
    C  [COMDLG32.DLL+0x33bc]
    C  [COMDLG32.DLL+0x17cc7]
    C  [awt.dll+0xcf68d]
    C  [USER32.dll+0x8744]
    C  [USER32.dll+0x8826]
    C  [USER32.dll+0xb8ab]
    C  [USER32.dll+0xb913]
    C  [awt.dll+0xcf682]
    C  [awt.dll+0xe56e4]
    C  [USER32.dll+0x8744]
    C  [USER32.dll+0x8826]
    C  [USER32.dll+0xb4d0]
    C  [USER32.dll+0xb51c]
    C  [ntdll.dll+0xeae3]
    C  [USER32.dll+0x9412]
    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j  sun.awt.windows.WToolkit.eventLoop()V+0
    j  sun.awt.windows.WToolkit.run()V+69
    j  java.lang.Thread.run()V+11
    v  ~StubRoutines::call_stub
    ---------------  P R O C E S S  ---------------
    Java Threads: ( => current thread )
      0x0ac6b1b8 JavaThread "Thread-1" daemon [_thread_in_native, id=256]
      0x0acc1cc8 JavaThread "SIGTERM handler" daemon [_thread_blocked, id=1648]
      0x00aca2e8 JavaThread "Thread-6" [_thread_in_native, id=928]
      0x00035858 JavaThread "DestroyJavaVM" [_thread_blocked, id=1824]
      0x0acb3900 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=800]
    =>0x0acae058 JavaThread "AWT-Windows" daemon [_thread_in_native, id=560]
      0x0acadca0 JavaThread "AWT-Shutdown" [_thread_blocked, id=1220]
      0x00acdb08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=892]
      0x00a93f28 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=1740]
      0x00a92c28 JavaThread "CompilerThread0" daemon [_thread_blocked, id=148]
      0x00a91d08 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1240]
      0x00a88ed8 JavaThread "Finalizer" daemon [_thread_blocked, id=1904]
      0x00a87a90 JavaThread "Reference Handler" daemon [_thread_blocked, id=1644]
    Other Threads:
      0x00a47fb0 VMThread [id=1984]
      0x00a95108 WatcherThread [id=1232]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    Heap
    def new generation   total 576K, used 376K [0x02ad0000, 0x02b70000, 0x02fb0000)
      eden space 512K,  61% used [0x02ad0000, 0x02b1e260, 0x02b50000)
      from space 64K, 100% used [0x02b60000, 0x02b70000, 0x02b70000)
      to   space 64K,   0% used [0x02b50000, 0x02b50000, 0x02b60000)
    tenured generation   total 1408K, used 194K [0x02fb0000, 0x03110000, 0x06ad0000)
       the space 1408K,  13% used [0x02fb0000, 0x02fe0ad8, 0x02fe0c00, 0x03110000)
    compacting perm gen  total 8192K, used 3920K [0x06ad0000, 0x072d0000, 0x0aad0000)
       the space 8192K,  47% used [0x06ad0000, 0x06ea42e8, 0x06ea4400, 0x072d0000)
    No shared spaces configured.
    Dynamic libraries:
    0x00400000 - 0x0040d000      C:\jdk1.5.0_08\bin\java.exe
    0x7c900000 - 0x7c9b0000      C:\WINDOWS\system32\ntdll.dll
    0x7c800000 - 0x7c8f4000      C:\WINDOWS\system32\kernel32.dll
    0x77dd0000 - 0x77e6b000      C:\WINDOWS\system32\ADVAPI32.dll
    0x77e70000 - 0x77f01000      C:\WINDOWS\system32\RPCRT4.dll
    0x77c10000 - 0x77c68000      C:\WINDOWS\system32\MSVCRT.dll
    0x6d730000 - 0x6d8cb000      C:\jdk1.5.0_08\jre\bin\client\jvm.dll
    0x77d40000 - 0x77dd0000      C:\WINDOWS\system32\USER32.dll
    0x77f10000 - 0x77f57000      C:\WINDOWS\system32\GDI32.dll
    0x76b40000 - 0x76b6d000      C:\WINDOWS\system32\WINMM.dll
    0x6d2f0000 - 0x6d2f8000      C:\jdk1.5.0_08\jre\bin\hpi.dll
    0x76bf0000 - 0x76bfb000      C:\WINDOWS\system32\PSAPI.DLL
    0x6d700000 - 0x6d70c000      C:\jdk1.5.0_08\jre\bin\verify.dll
    0x6d370000 - 0x6d38d000      C:\jdk1.5.0_08\jre\bin\java.dll
    0x6d720000 - 0x6d72f000      C:\jdk1.5.0_08\jre\bin\zip.dll
    0x6d070000 - 0x6d1d9000      C:\jdk1.5.0_08\jre\bin\awt.dll
    0x73000000 - 0x73026000      C:\WINDOWS\system32\WINSPOOL.DRV
    0x76390000 - 0x763ad000      C:\WINDOWS\system32\IMM32.dll
    0x774e0000 - 0x7761d000      C:\WINDOWS\system32\ole32.dll
    0x5ad70000 - 0x5ada8000      C:\WINDOWS\system32\uxtheme.dll
    0x73760000 - 0x737a9000      C:\WINDOWS\system32\ddraw.dll
    0x73bc0000 - 0x73bc6000      C:\WINDOWS\system32\DCIMAN32.dll
    0x6d2b0000 - 0x6d2ef000      C:\jdk1.5.0_08\jre\bin\fontmanager.dll
    0x10000000 - 0x10007000      C:\Internet Download Manager\idmmkb.dll
    0x7c9c0000 - 0x7d399000      C:\WINDOWS\system32\SHELL32.DLL
    0x77f60000 - 0x77fd6000      C:\WINDOWS\system32\SHLWAPI.dll
    0x773d0000 - 0x774d3000      C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2649_x-ww_aac16c8b\comctl32.dll
    0x5d090000 - 0x5d12a000      C:\WINDOWS\system32\comctl32.dll
    0x763b0000 - 0x763f9000      C:\WINDOWS\system32\COMDLG32.DLL
    0x77b40000 - 0x77b62000      C:\WINDOWS\system32\appHelp.dll
    0x76fd0000 - 0x7704f000      C:\WINDOWS\system32\CLBCATQ.DLL
    0x77050000 - 0x77115000      C:\WINDOWS\system32\COMRes.dll
    0x77120000 - 0x771ac000      C:\WINDOWS\system32\OLEAUT32.dll
    0x77c00000 - 0x77c08000      C:\WINDOWS\system32\VERSION.dll
    0x77a20000 - 0x77a74000      C:\WINDOWS\System32\cscui.dll
    0x76600000 - 0x7661d000      C:\WINDOWS\System32\CSCDLL.dll
    0x75f80000 - 0x7607d000      C:\WINDOWS\system32\browseui.dll
    0x769c0000 - 0x76a73000      C:\WINDOWS\system32\USERENV.dll
    0x77920000 - 0x77a13000      C:\WINDOWS\system32\SETUPAPI.dll
    0x76990000 - 0x769b5000      C:\WINDOWS\system32\ntshrui.dll
    0x76b20000 - 0x76b31000      C:\WINDOWS\system32\ATL.DLL
    0x5b860000 - 0x5b8b5000      C:\WINDOWS\system32\NETAPI32.dll
    0x77760000 - 0x778cf000      C:\WINDOWS\system32\shdocvw.dll
    0x77a80000 - 0x77b14000      C:\WINDOWS\system32\CRYPT32.dll
    0x77b20000 - 0x77b32000      C:\WINDOWS\system32\MSASN1.dll
    0x754d0000 - 0x75550000      C:\WINDOWS\system32\CRYPTUI.dll
    0x76c30000 - 0x76c5e000      C:\WINDOWS\system32\WINTRUST.dll
    0x76c90000 - 0x76cb8000      C:\WINDOWS\system32\IMAGEHLP.dll
    0x771b0000 - 0x77259000      C:\WINDOWS\system32\WININET.dll
    0x76f60000 - 0x76f8c000      C:\WINDOWS\system32\WLDAP32.dll
    VM Arguments:
    java_command: frameopen
    Launcher Type: SUN_STANDARD
    Environment Variables:
    JAVA_HOME=C:\jdk1.5.0_08\
    CLASSPATH=.;c:\Tomcat\common\lib\servlet.jar;C:\tomcat\common\lib\servlet-api.jar;C:\classes\jl1.0.jar;C:\classes\mp3spi1.9.2.jar;C:\classes\tritonus_share.jar
    PATH=C:\jdk1.5.0_08\bin;E:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Sun\AppServer\bin;;C:\jdk1.5.0_08\bin
    USERNAME=abhishek
    OS=Windows_NT
    PROCESSOR_IDENTIFIER=x86 Family 15 Model 2 Stepping 9, GenuineIntel
    ---------------  S Y S T E M  ---------------
    OS: Windows XP Build 2600 Service Pack 2
    CPU:total 1 (cores per cpu 1, threads per core 1) family 15 model 2 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2
    Memory: 4k page, physical 253424k(66708k free), swap 620672k(257232k free)
    vm_info: Java HotSpot(TM) Client VM (1.5.0_08-b03) for windows-x86, built on Jul 26 2006 01:10:50 by "java_re" with MS VC++ 6.0

  • FileDialog....filter help!

    I'm still utterly confused as to how a FilenameFilter works for a filedialog...can anyone give me any sample code? I tried the following:
    fileDialog.setFilenameFilter(new java.io.FilenameFilter() {
                public boolean accept(File pathname) {
                    if (pathname.getName().endsWith(".ars")) {
                        return true;
                    else {
                        return false;
            });and got this error:
    <anonymous windowResults$6> is not abstract and does not override abstract method accept(java.io.File,java.lang.String) in java.io.FilenameFilterwindowResults being the class this is all in.

    java.io.FilenameFilter accept method takes two parameters a File object and a String. Use it with a java.awt.FileDialog. A javax.swing.filechooser.FileFilter's accept method takes a single String parameter and is used with a javax.swing.JFileChooser.
    Hope that helps
    DB

  • FileDialog doesnt show up!

    hi,
    i have a frame with a menu i implemens an actionlistner and in the actionlistener i want to open a dialog, but the dialog doesnt show up.
    this is my code
    class GameFrame extends Frame
    SubGame apl;
    public GameFrame()
    apl = new SubGame();
    apl.init();
    addWindowListener(
    new WindowAdapter()
    public void windowClosing(WindowEvent e)
    dispose();
    System.exit(0);
    //initilizing menues
    class SaveGameHandler implements ActionListener
    public void actionPerformed (ActionEvent e)
    try{
    FileDialog dlg =
    new FileDialog(GameFrame.this);
    dlg.setVisible (true);
    dlg.show();
    String FileName = new String(dlg.getFile());
    ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(FileName));
    out.writeObject(apl.GetData());
    out.close();
    catch (IOException exp)
    //MessageBox(GameFrame.this,"Error in writing file","Error");
    dispose();
    //SystemExit(0);
    thanks,
    benny

    I assume you have a component which triggers the action event. Probably making the following changes should solve the problem.
    1) Change the construstor to
    FileDialog dlg = new FileDialog(this);and not
    FileDialog dlg = new FileDialog(GameFrame.this);2) remove line
    dlg.setVisible (true);hope this may help you.

  • Java bean File Upload - Error-105101

    We were having earlier the same problem of 105100 error. As the solution, suggested earlier in the thread posted by Teguh Santoso, the classpath settings that was mentioned ealier was done, the certificate was imported in the client machine.
    At the web-browser-client machine, the "Select" button in the "fileupload" demo form is opening the FileDialog(that cleared the earlier problem). But on selecting a file in it, the error ORA-105101 is occuring for the WHEN-CUSTOM-ITEM-EVENT..... But both the progress bars, the one that is there for encoding of the seleced file, and the one that is there for the uploading gets displayed. On searching the "c:\temp" folder(folder where the file is intended to be uploaded to) of the application server, we see that the particular file has not been uploaded.
    The same thing is working alright when we do it in the 9iAS machine, when using the "Run on Web" option in the 6i-FormBuilder.
    What additional settings are to be done for using the file-upload utility through web-forms? Please help..
    Thank you
    Regards
    Ranjith.

    If you press KEY-LISTVAL in the Upload demo form it will message out the current classpath for you. If that fails as well it's because the basic Java Runtime classes cannot be found.
    The general things to have to watch in the setup (on the Application server) are:
    1) A Java 1.2.2+ runtime environment is available
    2) The /jre/bin/classic directory is in the O/S PATH for Windows, or the LD_LIBRARY_PATH for SOLARIS or the SHLIB_PATH for HP. This is so that Forms can locate the JVM.DLL (Windows) or libjvm.sl/so (UNIX)
    3) The CLASSPATH needs to contain the 1.2.2+ Java runtime jar file rt.jar. This is in the /jre/lib directory.
    4) The CLASSPATH should of course also contain the UploadServer.jar

Maybe you are looking for

  • C6180 All In One Photosmart​. Software and drivers will not install on Windows 8.

    C6180 All In One Photosmart on Windows 8 64bit Acer Aspire V5-552PG AMD A10- 5757M Radeon HD 8750M dedicated Software and drivers package will only unpack but not install. When the unpacking bar reaches the end, it disapears without any following act

  • Internal JTA transaction rollback errors

    Hello, I seem to be having an issue where WLS 9.1 is swallowing JTA errors. Our application is using container-managed transactions to perform some database and JMS work inside various MDBs. We are running in a cluster with two managed servers, and w

  • Is Adobe Photoshop Element right for me? Please advise.

    I need an App to allow me to use a laptop and a remote mouse, and to make a formal presentation to a large audience. I need it to show both "photos" and a "video" in my presentation, allowing me to page through the photos one-at-a-time while I talk a

  • BPC YTD data load

    I am in filtering the data extraction for Jan 2010 only in the applicatioin and in the BI cube only Jan 2010 data exist. But in the BPC YTD balance report..It is showing the Jan 2010 actual amounts and Feb 2010 amount as inverted amount of Jan 2010.

  • Release strategies for purchase requisitions

    Hello, I'm having trouble with profiles and roles for release strategies, this is the scenario: -for purchase requisitions we have two approval levels, release code S1 and S2. When release code S1 is cleared, then S2 must be approved. The head of a c