Uploading bitmapData using FileReference class ?

Hi gurus ;)
Question nr 1.
Is it possibly to upload bitmapData to server using
FileReference class ? How should i approach this issue, is there
any ready classes available for this purpose. I'm generating
bitmaps inside my Flash/Flex App and need to store them under users
profile in server.
Question nr 2.
Can i upload files from remote server to another using
FileReference class
e.g Somehow like :
uploadURL = new URLRequest();
uploadURL.url = "
http://www.[yourDomain
fileURL.url = "
http://www.myLocation.com/myfile.JPG";
file = new FileReference(fileURL.url);
file.upload(uploadURL);
This is just an idea, sure not working ;)
Any ideas are helpful
Thx
iquaaani

I did a small application that uploads a file to the server
every hour. If the server response that a login is required to
upload the file, it goes to a login page to do the login and
retried to upload the file.
I got the server response in order to know if the file did
upload correctly or not (I have to send more form data than just
the file). I didn't try the mime type since it's not relevant for
my application and usualy this information is not very trust worthy
anyways.
I'm not sure what you mean with exceptions, if you are
referring to HTTP errors, I think there is an event for that, but I
used the IOError event for this, and it seems to work good
also.

Similar Messages

  • How can I load and save text using FileReference class

    Let me start by saying I have no intention of using php and I can't wait until flash cs5 comes out with its new read/write capabilities
    I want to load and save XML files (stored on my local hard-drive) in AS3.
    I am using the FileReference class.
    Firstly I have noticed that when using FileReference.save if you replace an existing file instead of writing over the file data is appended to the end of the file. Can I make it so the file is overwritten (as it should be) or make it impossible for the user to save in such a situation.
    Secondly I want to load in text from an external file using FileReference.load I know that somehow you use FileReference.browse first to get it to work but I want to know exactly how to do it.
    I have looked for a tutorial about loading text in this manner and have not found one.
    Any help would be much appreciated especially if you could point me in the direction of a relevant tutorial
    Thanks

    the filereference class is for downloading and uploading files.
    if you want to load xml, use the xml class.
    and, if you want to write to an xml file and don't want to use server-side code, wait.

  • Problem in upload file using oreilly classes

    Hi
    I stucked on a problem......
    I want to upload file from html page....On this page I want only a upload button so that when I click on this button file will upload from my client m/c to server m/c....
    I have code n all but browse button on html page....now I want to remove this browse button n want to give the file path somewhere in the code itself........so that on html page there will only the uplod button and by click on this button file will upload from client to server.......server path already there in code.....Please do the needful
    Abhishek
    I m putting the code here:-
    FileUpload.java
    upload-FileUpload.java
    NOTE: This file is a generated file.
    Do not modify it by hand!
    package upload;
    //custom imports for FileUpload
    //add your custom import statements here
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import com.oreilly.servlet.MultipartRequest;
    import java.util.*;
    public class FileUpload extends javax.servlet.http.HttpServlet
         protected boolean create() throws java.lang.Exception
              return true;
         public FileUpload()
         {   // Constructor.
         private void unhandledEvent( String listenerName, String methodName, java.lang.Object event )
         * destroy Method
         public void destroy()
              super.destroy();
              // TODO: implement
         * doGet Method
         protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
              System.out.println("abhishek");
              response.setContentType( "text/html" );
              PrintWriter out = response.getWriter();
              out.println("<HTML>");
              out.println("<HEAD><TITLE>FileUpload</TITLE></HEAD>");
              out.println("<BODY>");
              out.println("<H1>FileUpload</H1>");
              out.println("Hello World!");
              out.println("<P>Default Implementation From PowerJ</P>");
              out.println("</BODY></HTML>");
              // TODO: implement
         * doPost Method
         protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
              PrintWriter out = response.getWriter();
              try{
                   response.setContentType("text/html");
                   out.println("<HTML>");
                   out.println("<head><Title>Decoded Uploaded File</title><head>");
                   out.println("<body>");
                   out.println("<H1>UploadFile</h1>");
                   // path must be absolute to upload dir
                   // This is the decoder class that extracts the parameters and transfer file
                   // request argument = Http input stream
                   // c:\\temp\\upload = directory to save file
                   // 15*1024*1024 = 15mb max size file
                   MultipartRequest multi = new MultipartRequest(request, "c:\\temp\\upload",15*1024*1024);
                   // Lists form parameters
                   out.println("Params:");
                   Enumeration params = multi.getParameterNames();
                   out.println("<pre>");
                   while (params.hasMoreElements()) {
                        String name = (String)params.nextElement();
                        String value = multi.getParameter(name);
                        out.println(name + " = " + value);
                   out.println("</pre>");
                   // Show details of uploaded file
                   out.println("Files:");
                   Enumeration files = multi.getFileNames();
                   out.println("<pre>");
                   while (files.hasMoreElements()) {
                        String name = (String)files.nextElement();
                        String filename = multi.getFilesystemName(name);
                        String type = multi.getContentType(name);
                        File f = multi.getFile(name);
                        out.println("name: " + name);
                        out.println("filename: " + filename);
                        out.println("type: " + type);
                        if (f != null) {
                             out.println("f.toString(): " + f.toString());
                             out.println("f.getName(): " + f.getName());
                             out.println("f.exists(): " + f.exists());
                             out.println("f.length(): " + f.length());
                             out.println();
                        out.println("</pre>");
              }catch (Exception e){
                   out.println("<pre>");
                   e.printStackTrace(out);
                   out.println("</pre>");
              out.println("</body></html>");
         * init Method
         public void init(ServletConfig config) throws ServletException
              super.init(config);
              // TODO: implement
         * data members
    //     add your data members here
    UploadFile.html
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>File Upload using EAS</title>
    </head>
    <body>
    <form method="POST" enctype="multipart/form-data" action="upload/FileUpload">
    <p><b>File Upload using EAS </b></p>
    <p>Select file to send: <input type="file" name="name" size="30"></p>
    <p>Your Name: <input type="input" name="yourname" size="20"> </p>
    <p align="left"><input type="submit" value="Send File" name="submit"></p>
    </form>
    </body>
    </html>
    You can download the oreilly files from :- (same code is also here)
    http://www.sybase.com/detail?id=1011664

    where I should write down the file path(The file in client pc....e.g. C:\Documents and Settings\abhishek.jain\Desktop\Daily Order Manual.pdf ) in code........I m getting stuck

  • Previewing an image before uploading it using the FileReference class

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

  • Previewing an image before uploading it using the FileReference class in flex 3

    Previewing an image before uploading it using the FileReference class in flex 3 ?

    hai,
              when this code is used in my application ,i got the name of image and new frame is added each time .But image is not displayed.....
    The code  starts like this
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx" initialize="init()"   backgroundColor="white" width="100%" height="100%">
        <fx:Script>
    <![CDATA[ 
                    import mx.controls.Alert;
                    import mx.messaging.Channel;
                    import mx.messaging.ChannelSet;
                    import mx.messaging.channels.AMFChannel;
                    import mx.rpc.events.ResultEvent;
                    import mx.controls.Image;
                    import spark.events.IndexChangeEvent;
                    import mx.managers.DragManager;
      <mx:DataGridColumn headerText="Dimension Value"  width="10" dataField="dimensionValue"/>
                                                   <mx:DataGridColumn headerText="Unit Nmae"  width="10" dataField="dimensionUnitName"/>
                                                   </mx:columns>
                                           </mx:DataGrid>
                                           <mx:Spacer width="2%"/>
                                       </mx:HDividedBox>
                                       </mx:VBox>
                   <mx:Spacer height="0"/>
                <mx:VBox width="100%">
                    <s:HGroup height="90" top="0" left="0" right="0" verticalAlign="justify" gap="10" paddingLeft="5" paddingRight="5" paddingTop="5" paddingBottom="5">
                        <s:Button id="btn_loader" top="5" bottom="24" width="100" label="load" click="loadImages()"/>
                        <s:Group width="100%">
                            <s:Group name="cl" top="0" left="0" bottom="0" width="20" mouseOver="//scroll_on(event)" mouseOut="//scroll_off(event)">
                                <s:BitmapImage source="@Embed('../assets/left.jpg')" top="0" left="0" bottom="0" right="0" fillMode="scale"/>   
                            </s:Group>
                            <s:List id="imgList" skinClass="skins.ListSkin" top="-3" left="27" right="28" bottom="10"
                                    dataProvider="{ImageCollection}" itemRenderer="Image_Render">
                                <s:layout>
                                    <s:HorizontalLayout gap="0"/>
                                </s:layout>
                            </s:List>
                            <s:Group name="cr" top="0" right="0" bottom="0" width="20" mouseOver="//scroll_on(event)" mouseOut="//scroll_off(event)">
                                <s:BitmapImage source="@Embed('../assets/right.jpg')" top="-1" left="0" bottom="0" right="0" fillMode="scale"/>
                            </s:Group>
                        </s:Group>
                    </s:HGroup>
                    <s:SkinnableContainer id="dropCanvas" top="100" left="5" right="5" bottom="5" backgroundAlpha="1.0" alpha="1.0"
                                          dragEnter="dropCanvas_dragEnterHandler(event)"
                                          dragDrop="dropCanvas_dragDropHandler(event)" contentBackgroundColor="#914E4E" backgroundColor="#F7F7F7">
                    </s:SkinnableContainer>
                </mx:VBox>
                <mx:Spacer height="5"/>
                                      </mx:VDividedBox>
        </mx:Panel>
    </mx:Canvas>

  • Using the fileReference class to upload image

    I've been using the loadVars to upload text and pass
    variables to php and onto the server. I've begun using the Flash
    Filereference class so an image can be uploaded directly from a
    Flash movie, not involving an html form. But within the
    Filereference script I can't figure out how to pass a variable to
    php as I did using loadVars method. I've tried a number of hit-miss
    ways but they've all been misses.
    Right now the path to save an image file is "hard-wired" into
    the php script. This is the var that I want to pass.
    thanks
    The script is here if you need to take a peek:

    Someone else asked about this recently. I think the answer
    you're after is here:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1317799
    That's for POST data.
    If you want to send additional GET data you could just append
    it to the url.

  • Using tie-classed to change name of file uploaded through FTP protocol srvr

    Hi,
    I'm trying to use the extendedPreAddItem (or Post) method in an S_TieFolder class to automatically change the name of a file (an S_PublicObject) when it enters a Folder (via an FTP put upload).
    I'm fiddling around with code like this:
    AttributeValue val = AttributeValue.newAttributeValue(newDocName);
    val.setName(Document.NAME_ATTRIBUTE);
    rightpo.setAttribute(val);
    But it does not work: in the FTP client the filename is indeed changed, but somewhere at lower levels the original filename is still being used...
    Any helpfull ideas would be appreciated.
    TOon

    I'm aware of this... My ftp-client (FTP-Voyager) will prompt me if I "put" a file that already exists in the remote folder, and ask me to go ahead and replace the file, or cancel the put-operation.
    However in this case the ftp-client sees file X' remotely and I'm putting file X, so it does not prompt me at all...
    Stopping and restarting the FTP-client (in case it caches remote folder-contents...) does not change the behaviour.
    Timewise this is what happens:
    1) I put file X.
    2) My S_TieFolder class (extendedPreAddItem) changes it's name into X'.
    3) The ftp-put successfully completes
    4) I refresh the remote folder contents and see the X' name instead of the original X name.
    5) I re-put X (and would now like to have it changed into file X'').
    6) Before my S_TieFolder code executes, something (I'm still suspecting the cm-sdk) deletes the X' file first... ==> the logfile does not show any communication with the ftp-client here now.
    7) Then my S_TieFolder code executes and changes the name into X''.
    8) I refresh the remote folder contents: File X' disappears, file X (just re-put) changes into X''.
    More testing has shown that I'm also not able to delete these files (whose names have been changed by S_TieFolder): 'file does not exist' error.
    I need to know:
    a) If changing the files name on-the-fly using S_Tie class is supported at all.
    and
    b) if so, what am I doing wrong?
    Thanks
    Toon

  • How to Upload a File using FileReference + PHP??

    How to Upload a File using FileReference + PHP??
    If you could help me with a two code examples the AS code and
    the PHP code of a working example.
    Thanks
    Jorge

    http://www.flash-db.com/Tutorials/upload/upFiles.php?page=1

  • How do I use FileReference.load() when selecting multiple files???

    Hi All,
    Basically I am developing my own Adobe Air FTP client application (Flex builder 4.6). I have have successfully managed to get the user to select one or more files from their local machine to send via FTP. The file(s) are then added to an arrayCollection which populates a data grid.
    I then have an upload button that when pressed I need to loop through each file that has previously been selected and pick up the file name, size and data stored within the file. I know I can use the FileReference class and the load() method to load the file and access the data via the .data method but the data variable is always null meaning i am obviously not using the load() method in the relevant place in the code.
    Can anyone help me get around this probblem please??
    Below are my snippets of code that I think you will need:
    When the Browse button is selected it fires the selectHandler function below to add files to the data grid:
    private function selectHandler(event:Event):void {
        fileList = fileReferenceList.fileList;
        for (var i:Number=0; i<fileList.length; i++) {
              var file:FileReference = FileReference(fileList[i]);
              arrayCollection.addItem({name:file.name, size:file.size, object:file})
        uploadTest.enabled = true;
    When i click the upload button i need to loop through all of the selected files which I am doing using a for each loop:
    private function uploadFile(event:MouseEvent):void {
             //Loops through each array element
        for each( var obj:Object in arrayCollection ) {
              //Need to get file details in here - PLEASE HELP??
    Thanks
    Paul

    Uhm, as you "check the folder daily", you'll have one or the other junk mail popping up in the preview frame anyway, right?
    Well, as soon as you decided you want to delete all junk mail, you can do so without seeing any of them anymore:
    With any of the other mailboxes selected and showing, right-click on any of the mailboxes (can be Inbox, Flagged, Sent, Junk, Trash), then click Erase Junk Mail and answer the following dialog with Erase.
    The junk mails will be erased without you - or anyone looking over your shoulder - seeing even only one anymore.

  • Storing Orders into Site using streamWriter Class in c# getting Error

    Hi,
        I am using streamWriter class to write orders into text file.It's working.,But not my client asking to change site URL to store orders into that site.
    I need to save orders into below path:
    https://SP2010.org/Departments/Community/Communications/DocForms/Forms/Simple%20View.aspx
    Getting Error: 
    The given path's format is not supported.
    In web.config File:
    <AppSettings>
    <add key="OrdersList" value="https://SP2010.org/Departments/Community/Communications/DocForms/Forms/Simple%20View.aspx"/>
    </AppSettings>
    Under Button control,wrote below code:
     string Orderslist = System.Configuration.ConfigurationManager.AppSettings["OrdersList"].ToString();
                            string fileName = Orderslist;
                            string fileText = fileName + nextorder.ToString();
                            //Check if file already exists. If yes, delete it. 
                            if (File.Exists(fileText))
                                File.Delete(fileText);
                            // Create a new file 
                            using (StreamWriter streamWriter = new StreamWriter(fileText))
                            {streamWriter.WriteLine(listItem["Title"]);
                                    streamWriter.WriteLine(listItem["OrderDate"]);
                                    streamWriter.WriteLine(listItem["OrderCreatedBy"]);
    Thanks in Advance:
    Help Me

    Hi Sadomovalex,
    Thanks for Responding.
    I tried below code,Getting error:
    server Error in '/' Application
    File Not found
    Description: An unhandled exception occured during the exception of the current
    web request. Plaese review the stack trace for more 
    information about the error and where it originated in the code
    Exception Details: System.IO.FileNotFoundException:File not found
    The file is storing in my file system:Orderlist.txt44,
    Orderlist.txt45,
    Orderlist.txt46...
    I am unable to read the file;getting error file not found
    The code Is:
    protected void Button1_Click(object sender, EventArgs e)
            string siteURl = System.Configuration.ConfigurationManager.AppSettings["OrdersList"].ToString();
            string fileName = siteURl.ToString();
            String fileToUpload = fileName;
            //String sharePointSite = "http://sp2010:9596/DocForms/Forms/AllItems.aspx?InitialTabId=Ribbon.Library&VisibilityContext=WSSListAndLibrary";
      String sharePointSite = "http://sp2010:9596/DocForms/Forms/AllItems.aspx";
            Console.WriteLine(sharePointSite);
            String documentLibraryName = "DocForms";
            using (SPSite oSite = new SPSite(sharePointSite))
                using (SPWeb oWeb = oSite.OpenWeb())
                    if (!System.IO.File.Exists(fileToUpload))
                        throw new FileNotFoundException("File not found.", fileToUpload);
                    SPFolder myLibrary = oWeb.Folders[documentLibraryName];
                    // Prepare to upload
                    Boolean replaceExistingFiles = true;
                    String fileNames = System.IO.Path.GetFileName(fileToUpload);
                    FileStream fileStream = File.OpenRead(fileToUpload);
                    // Upload document
                    SPFile spfile = myLibrary.Files.Add(fileNames, fileStream, replaceExistingFiles);
                    // Commit 
                    //Check if file already exists. If yes, delete it. 
                    if (File.Exists(fileName))
                        File.Delete(fileName);
                    // Create a new file 
                    using (StreamWriter streamWriter = new StreamWriter(fileName))
                        streamWriter.WriteLine("Hyderabad");
                        streamWriter.WriteLine("Secundrabad");
                        myLibrary.Update();
    Help me,
    Thanks:

  • File upload, download using ADF UIX and not JSP

    I have examples for the file upload, download using JSP
    But I want to use ADF UIX. Look and feel in this is impressing and I want to use this. Any one have example for this.
    Users will select a file from their desktop
    This will be stored into the database (Any document. Word, Excel)
    When they query the records then the UIX column need to give a hyperlink. Clicking on the link should prompt to download the file to the local system

    Sure, I use the Apache Commons File Upload package, so that is what I will discuss here ( [Commons File Upload|http://commons.apache.org/fileupload/] ).
    The Commons File Upload uses instances of ProgressListener to receive upload progress status. So first create a simple class that implements ProgressListener:
    public class ProgressListenerImpl implements ProgressListener {
        private int percent = 0;
        public int getPercentComplete() {
            return percent;
        public void update(long pBytesRead, long pContentLength, int pItems) {
            if (pContentLength > -1) { //content length is known;
                percent = (new Long((pBytesRead / pContentLength) * 100)).intValue();
    }So in your Servlet that handles file upload you will need to create an instance of this ProgressListenerImpl, register it as a listener and store it in the session:
    ServletFileUpload upload = new ServletFileUpload();
    ProgressListenerImpl listener = new ProgressListenerImpl();
    upload.setProgressListener(listener);
    request.getSession().setAttribute("ProgressListener", listener);
    ...Now create another servlet that will retrieve the ProgressListenerImpl, get the percent complete and write it back (how you actually write it back is up to you, could be text, an XML file, a JSON object, up to you):
    ProgressListenerImpl listener = (ProgressListenerImpl) request.getSession().getAttribute("ProgressListener");
    response.getWriter().println("" + listener.getPercentComplete());
    ...Then your XMLHttpRequest object will call this second servlet and read the string returned as the percent complete.
    HTH

  • Upload file using jsp

    hi all i am trying a code that uploads file to the server using jsp the code goes like this
    <%@ page import = "java.io.*" %>
    <%
    String contentType = request.getContentType();
    String file = "";
    String saveFile = "";
    FileOutputStream fileOut = null;
    if((contentType!=null)&&(contentType.indexOf("multipart/form-data")>=0))
       DataInputStream in = new DataInputStream(request.getInputStream());
       int formDataLength = request.getContentLength();
       byte dataBytes[] = new byte[formDataLength];
       int byteRead = 0;
       int totalBytesRead = 0;
       while(totalBytesRead<formDataLength)
          byteRead = in.read(dataBytes,totalBytesRead,formDataLength);
          totalBytesRead +=byteRead;
       try
          file = new String(dataBytes);
          saveFile= file.substring(file.indexOf("filename=\"")+10);
          saveFile = saveFile.substring(0,saveFile.indexOf("\n"));
          saveFile =
          saveFile.substring(saveFile.lastIndexOf("/")+1,saveFile.indexOf("\""));
          int lastIndex = contentType.lastIndexOf("=");
          String boundary =
          contentType.substring(lastIndex+1,contentType.length());
          int pos;
          pos = file.indexOf("filename=/" +1);
          pos = file.indexOf("\n",pos)+1;
          pos = file.indexOf("\n",pos)+1;
          pos = file.indexOf("\n",pos)+1;
          int boundaryLocation = file.indexOf(boundary,pos) - 4;
          int startPos = ((file.substring(0,pos)).getBytes()).length;
          int endPos =
          ((file.substring(0,boundaryLocation)).getBytes()).length;
          String folder = "07ics01/jsp/"; //is this the folder where i intend to save the file?
          fileOut = new FileOutputStream(folder + saveFile);
          fileOut.write(dataBytes);
          fileOut.write(dataBytes,startPos,(endPos-startPos));
          fileOut.flush();
       catch(Exception e)
          out.println(e);
       finally
          try
             fileOut.close();
          catch(Exception err)
    %> i have been trying to use this code but i can't understand the code. is String folder = "07ics01/jsp" the folder where i intend to save the page on the server? because when i do that i get an exception like
    java.io.FileNotFoundException: 07ics01/jsp/C:\Documents and Settings\s9sharma\Desktop\tt\commons-digester-1.8\commons-digester-1.8.jar (No such file or directory) where C:\Documents and Settings\s9sharma\Desktop\tt\commons-digester-1.8\commons-digester-1.8.jar is the file i am trying to upload to the directory 07ics01/jsp which is a unix directory.
    Can anyone please help..

    So you've copypasted this code from somwhere and are expecting our support on the code, instead of the author's support? That's sad.
    I recommend you to look to the Apache Commons FileUpload API [1]. Then you don't need to write (or copypaste) a multipart parser yourself. Putting business logic in JSP files is also bad practice by the way. Use Java classes for it instead (Servlets, Filters, Beans, Utilityclasses, etc).
    [1] http://commons.apache.org/fileupload/
    To understand the actual code, it might help a lot to first read and understand the HTML spec about multipart request data and read the API documentations of the Java classes involved, e.g. the java.io API.

  • MAT error: 0xHEX is used a class and object...

    Hi there,
    playing around some more with MAT I ran into the following error with some of my dumps. All were taken on 1.5 SUN JVMs (running on either Solaris or Linux).
    org.eclipse.mat.snapshot.SnapshotException: Error: 0x8d776450 is used as class and object simultaneously. Are you using a beta DLL for Sun JDK 1.4.2 to write the heap dump?
    at org.eclipse.mat.hprof.HprofParserHandlerImpl.createRequiredFakeClasses(HprofParserHandlerImpl.java:191)
    at org.eclipse.mat.hprof.HprofParserHandlerImpl.beforePass2(HprofParserHandlerImpl.java:89)
    at org.eclipse.mat.hprof.HprofIndexBuilder.fill(HprofIndexBuilder.java:76)
    at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.parse(SnapshotFactoryImpl.java:183)
    at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.openSnapshot(SnapshotFactoryImpl.java:101)
    at org.eclipse.mat.snapshot.SnapshotFactory.openSnapshot(SnapshotFactory.java:77)
    at org.eclipse.mat.ui.internal.ParseHeapDumpJob.run(ParseHeapDumpJob.java:52)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
    Since the suggested problem (usage of JDK 1.4.2) is not the case: What else can I do to find out what is going on? Do I need any special switches for jmap? The dumps all were taken with the same command:
    jmap -heap:format=b <pid>
    Still, some work, some do not. Any suggestions?
    bye, Michael

    Hi Michael,
    this smells like a bug. The easiest way again is to have a look at the dump. If you zip it, it should become smaller. I could also provide upload space. Right now, I am at the J1 in San Francisco so it might not be as easy for me to fix this.
    Andreas.

  • Using List Class in java.awt / java.util ?

    have a program that:
    import java.util.*;
    List list = new LinkedList();
    list = new ArrayList();
    ... read a file and add elements to array
    use a static setter
    StaticGettersSetters.setArray(list);
    next program:
    import java.awt.*;
    public static java.util.List queryArray =
    StaticGettersSetters.getArray();
    If I don't define queryArray with the package and class, the compiler
    gives an error that the List class in java.awt is invalid for queryArray.
    If I import the util package, import java.util.*; , the compiler
    gives an error that the list class is ambiguous.
    Question:
    If you using a class that exists in multiple packages, is the above declaration of queryArray the only way to declare it ?
    Just curious...
    Thanks for your help,
    YAM-SSM

    So what you have to do is explicitly tell the compiler which one you really want by spelling out the fully-resolved class name:
    import java.awt.*;
    import java.sql.*;
    import java.util.*;
    public class ClashTest
        public static void main(String [] args)
            java.util.Date today    = new java.util.Date();
            java.util.List argsList = Arrays.asList(args);
            System.out.println(today);
            System.out.println(argsList);
    }No problems here. - MOD

  • Creating a triangle using polygon class problem, URGENT??

    Hi i am creating a triangle using polygon class which will eventually be used in a game where by a user clicks on the screen and triangles appear.
    class MainWindow extends Frame
         private Polygon[] m_polyTriangleArr;
                       MainWindow()
                              m_nTrianglesToDraw = 0;
             m_nTrianglesDrawn = 0;
                             m_polyTriangleArr = new Polygon[15];
                             addMouseListener(new MouseCatcher() );
            setVisible(true);
                         class MouseCatcher extends MouseAdapter
                             public void mousePressed(MouseEvent evt)
                  Point ptMouse = new Point();
                  ptMouse = evt.getPoint();
                if(m_nTrianglesDrawn < m_nTrianglesToDraw)
                                int npoints = 3;
                        m_polyTriangleArr[m_nTrianglesDrawn]
                      = new Polygon( ptMouse[].x, ptMouse[].y, npoints);
    }When i compile my code i get the following error message:
    Class Expected
    ')' expectedThe two error messages are refering to the section new Polygon(....)
    line. Please help

    Cannot find symbol constructor Polygon(int, int, int)
    Can some one tell me where this needs to go and what i should generally
    look like pleaseI don't think it is a good idea to try and add the constructor that the compiler
    can't find. Instead you should use the constructor that already exists
    in the Polygon class: ie the one that looks like Polygon(int[], int[], int).
    But this requires you to pass two int arrays and not two ints as you
    are doing at the moment. As you have seen, evt.getPoint() only supplies
    you with a single pair of ints: the x- and y-coordinates of where the mouse
    button was pressed.
    And this is the root of the problem. To draw a triangle you need three
    points. From these three points you can build up two arrays: one containing
    the x-coordinates and one containing the y-coordinates. It is these two
    arrays that will be used as the first two arguments to the Polygon constructor.
    So your task is to figure out how you can respond to mouse presses
    correctly, and only try and add a new triangle when you have all three of its
    vertices.
    [Edit] This assumes that you expect the user to specify all three vertices of the
    triangle. If this isn't the case, say what you do expect.

Maybe you are looking for

  • One Time customer's outstanding

    Hi All, I have this scenario precisely..the customers at store sales are created as one time customers so I have just one dummy customer account and while making sales order everytime, system asks for the  new master data. this does not allow me to s

  • Imac &  connecting to PC's

    my imac cant seem to connect to my PC despite using the correct log on commands.My PC can log on to the imac however. Can anyone help? I use airport and a netgear 614 wireless router. The imac and the PC can accsess the internet with no problem.

  • RFUMSV25 (for Italy)

    hi gurus, I have a problem with the report RFUMSV25 (for Italy) deferred tax. the output tax does not work. It shows no data in the output report. The system is ECC 6.0., Release installed on the component SAP_APPL 600, Level 06 and support package S

  • There is no iView available for system "SAP_SRM": object "Permission".

    Hi All, We have portal ( SAP 7.01 SP3 patch level 3) as the front end for SRM 7.0 ,We have integrated SRM with portal through the system alias SAP_SRM. When RFx Approver click on u201Cpermissionu201D button in u201CPurchasingu201D -> u201CSourcingu20

  • Passwd -r ldap fails

    Solaris 9 client and Solaris 10 x86 clients works fine. But Solaris 10 (3/05) sparc version fails. Config files are all the same. One client is full patched and one has no patches, but the problem is steady. #passwd -r ldap passwd: Changing password