XMLStreamReaderBase tries to create a QName with a null namespace prefix

Given the following xml:
<foo>
<bar type="value"/>
</foo>
Calling getAttributeName(index) while on the 'bar' element will cause an IllegalArgumentException as XMLStreamReaderBase tries to create a javax.xml.namespace.QName with a null prefix instead of using XMLConstants.DEFAULT_NS_PREFIX
java.lang.IllegalArgumentException: prefix cannot be "null" when creating a QName
at javax.xml.namespace.QName.<init>(QName.java:170)
at weblogic.xml.stax.XMLStreamReaderBase.getAttributeName(XMLStreamReaderBase.java:339)

Hi, were you able to solve this issue? I am also facing the same!
Deepak

Similar Messages

  • Error while trying to create new assignment with supervisor through API

    Hi Experts,
    I'am trying to create new assignment with supervisor for employee, but i'am facing this error:
    =============================================================
    ORA-20008: Error While Create new assignment..-20001
    ORA-20001: The supervisor assignment that you have entered is invalid.
    Please check that you have entered the supervisor,
    that the supervisor assignment belongs to this supervisor and that the assignment is effective.
    ORA-06512: at line 198
    =============================================================
    This is my script, (Oracle EBS 12.1.1)(DB 11):
    DECLARE
    v_user_id NUMBER;
    v_res_id NUMBER;
    v_res_appl_id NUMBER;
    v_org_now_no_manager_warning BOOLEAN;
    v_spp_delete_warning BOOLEAN;
    v_other_manager_warning BOOLEAN;
    v_tax_district_changed_warning BOOLEAN;
    v_entries_changed_warning VARCHAR(4000);
    v_person_id per_all_assignments_f.person_id %TYPE;
    v_business_group_id hr_all_organization_units_tl.organization_id %TYPE;
    v_people_group_id per_all_assignments_f.people_group_id %TYPE;
    v_object_version_number per_all_assignments_f.object_version_number %TYPE;
    v_special_ceiling_step_id per_all_assignments_f.special_ceiling_step_id %TYPE;
    v_group_name pay_people_groups.group_name %TYPE;
    v_ass_effective_start_date per_all_assignments_f.effective_start_date %TYPE;
    v_effective_start_date per_all_assignments_f.effective_start_date %TYPE;
    v_effective_end_date per_all_assignments_f.effective_end_date %TYPE;
    v_assignment_id per_all_assignments_f.assignment_id %TYPE;
    v_sup_assignment_id per_all_assignments_f.assignment_id %TYPE;
    v_supervisor_assignment_id per_all_assignments_f.assignment_id %TYPE;
    v_job_id per_jobs.job_id %TYPE;
    v_grade_id per_grades.grade_id %TYPE;
    v_location_id hr_locations_all.location_id %TYPE;
    v_payroll_id pay_all_payrolls_f.payroll_id %TYPE;
    v_pay_basis_id per_pay_bases.pay_basis_id %TYPE;
    BEGIN
    v_user_id := FND_GLOBAL.user_id ;
    v_res_id := FND_GLOBAL.resp_id ;
    v_res_appl_id:= FND_GLOBAL.resp_appl_id;
    FND_GLOBAL.apps_initialize(v_user_id, v_res_id, v_res_appl_id);
    BEGIN
    SELECT organization_id
    INTO v_business_group_id
    FROM hr_all_organization_units_tl
    WHERE name = 'Vision University'
    AND language = 'US';
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20000,'Error While Retrieving (Business Group ID) Info...'||SQLCODE||' '||SQLERRM);
    END;
    FOR R IN (SELECT * FROM xx_assignment) LOOP
    BEGIN
    SELECT assignment_id , ass_f.object_version_number
    INTO v_assignment_id , v_object_version_number
    FROM per_all_assignments_f ass_f, per_all_people_f p_f
    WHERE ass_f.person_id = p_f.person_id
    AND ass_f.business_group_id = p_f.business_group_id
    AND ass_f.business_group_id = v_business_group_id
    AND p_f.employee_number = R.employee_number
    AND TRUNC(p_f.effective_start_date)= TRUNC(ass_f.effective_start_date)
    AND TRUNC(p_f.effective_end_date) = TRUNC(ass_f.effective_end_date);
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20001,'Error While Retrieving (Assignmet_ID) for employee..'||SQLCODE||' '||SQLERRM);
    END;
    BEGIN
    SELECT job_id
    INTO v_job_id
    FROM per_jobs
    WHERE trim(lower(name)) = trim(lower(r.employee_job))
    AND business_group_id = v_business_group_id;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20002,'Error While Retrieving (Job_ID) Info...'||SQLCODE||' '||SQLERRM);
    END;
    BEGIN
    SELECT grade_id
    INTO v_grade_id
    FROM per_grades
    WHERE trim(lower(name)) = trim(lower(r.employee_grade))
    AND business_group_id = v_business_group_id;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20003,'Error While Retrieving (Grade_ID) Info...'||SQLCODE||' '||SQLERRM);
    END;
    BEGIN
    SELECT location_id
    INTO v_location_id
    FROM hr_locations_all
    WHERE trim(lower(description))= trim(lower(r.employee_location))
    AND business_group_id = v_business_group_id;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20004,'Error While Retrieving (Location_ID) Info...'||SQLCODE||' '||SQLERRM);
    END;
    BEGIN
    SELECT payroll_id
    INTO v_payroll_id
    FROM pay_all_payrolls_f
    WHERE trim(lower(payroll_name)) = trim(lower(r.payroll_name))
    AND business_group_id = v_business_group_id;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20005,'Error While Retrieving (Payroll_ID) Info...'||SQLCODE||' '||SQLERRM);
    END;
    BEGIN
    SELECT pay_basis_id
    INTO v_pay_basis_id
    FROM per_pay_bases
    WHERE trim(lower(pay_basis)) = trim(lower(r.pay_basis))
    AND business_group_id = v_business_group_id;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20006,'Error While Retrieving (Pay_Basis_ID) Info...'||SQLCODE||' '||SQLERRM);
    END;
    BEGIN
    SELECT person_id
    INTO v_person_id
    FROM per_all_people_f
    WHERE employee_number = r.supervisor_number
    AND business_group_id= v_business_group_id;
    SELECT assignment_id
    INTO v_sup_assignment_id
    FROM per_all_assignments_f
    WHERE person_id = v_person_id
    AND business_group_id = v_business_group_id;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20007,'Error While Retrieving (Assignmet_ID) for supervisor..'||SQLCODE||' '||SQLERRM);
    end;
    BEGIN
    hr_assignment_api.update_emp_asg_criteria(p_effective_date => TRUNC(SYSDATE),
    p_datetrack_update_mode => 'CORRECTION',
    p_assignment_id => v_assignment_id,
    p_validate => FALSE,
    p_called_from_mass_update => NULL,
    p_grade_id => v_grade_id,
    p_position_id => NULL,
    p_job_id => v_job_id,
    p_payroll_id => null,--v_payroll_id,
    p_location_id => v_location_id,
    p_organization_id => v_business_group_id,
    p_pay_basis_id => v_pay_basis_id,
    p_segment1 => NULL,
    p_segment2 => NULL,
    p_segment3 => NULL,
    p_segment4 => NULL,
    p_segment5 => NULL,
    p_segment6 => NULL,
    p_segment7 => NULL,
    p_segment8 => NULL,
    p_segment9 => NULL,
    p_segment10 => NULL,
    p_segment11 => NULL,
    p_segment12 => NULL,
    p_segment13 => NULL,
    p_segment14 => NULL,
    p_segment15 => NULL,
    p_segment16 => NULL,
    p_segment17 => NULL,
    p_segment18 => NULL,
    p_segment19 => NULL,
    p_segment20 => NULL,
    p_segment21 => NULL,
    p_segment22 => NULL,
    p_segment23 => NULL,
    p_segment24 => NULL,
    p_segment25 => NULL,
    p_segment26 => NULL,
    p_segment27 => NULL,
    p_segment28 => NULL,
    p_segment29 => NULL,
    p_segment30 => NULL,
    p_employment_category => NULL,
    p_concat_segments => NULL,
    p_grade_ladder_pgm_id => NULL,
    p_supervisor_assignment_id => v_sup_assignment_id,
    p_people_group_id => v_people_group_id,
    p_object_version_number => v_object_version_number,
    p_special_ceiling_step_id => v_special_ceiling_step_id,
    p_group_name => v_group_name,
    p_effective_start_date => v_ass_effective_start_date,
    p_effective_end_date => v_effective_end_date,
    p_org_now_no_manager_warning => v_org_now_no_manager_warning ,
    p_spp_delete_warning => v_spp_delete_warning,
    p_entries_changed_warning => v_entries_changed_warning,
    p_tax_district_changed_warning => v_tax_district_changed_warning,
    p_other_manager_warning => v_other_manager_warning);
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20008,'Error While Create new assignment..'||SQLCODE||' '||SQLERRM);
    END;
    END LOOP;
    COMMIT;
    END;
    Thank you & Best Regards

    I think this is essentially saying that the Supervisor Assignment is wrong or no longer effective. Looking at your SQL to fetch the Supervisor Assignment there are a number of potential issues. This is what you've currently got:
    SELECT person_id
    INTO v_person_id
    FROM per_all_people_f
    WHERE employee_number = r.supervisor_number
    AND business_group_id= v_business_group_id;
    SELECT assignment_id
    INTO v_sup_assignment_id
    FROM per_all_assignments_f
    WHERE person_id = v_person_id
    AND business_group_id = v_business_group_id;
    Potential Problems/Clarifications
    1. What is r.supervisor_number, what does it contain and how is it derived? I can't see that anywhere else in the block...
    2. Is there a chance that r.supervisor_number is referencing an employee who has left, ie, now an ex-employee?
    3. The SELECT statement that fetches the assignment_id does not perform any date-effective restrictions, which means you might be lucky enough to fetch the person's current assignment. But you might also fetch an old or future-dated assignment.
    4. The SELECT statement that fetches the assignment_id does not restrict the type of assignment, so if this manager has applied for a job (ie, they have an applicant assignment) or some other type of non-employee assignment you might be picking that up.
    This would work better for you:
    SELECT paaf.assignment_id
    INTO v_sup_assignment_id
    FROM per_all_people_f papf
    ,per_all_assignments_f paaf
    WHERE papf.employee_number = r.supervisor_number
    AND papf.business_group_id = v_business_group_id
    AND nvl(papf.current_employee_flag, 'N') = 'Y'
    AND trunc(sysdate) BETWEEN
    papf.effective_start_date AND papf.effective_end_date
    AND papf.person_id = paaf.person_id
    AND paaf.assignment_type = 'E'
    AND paaf.primary_flag = 'Y'
    AND trunc(sysdate) BETWEEN
    paaf.effective_start_date AND paaf.effective_end_date;
    If it doesn't return a row it means that the supervisor (or whatever employee is returned by r.supervisor_number) is not active as at sysdate and cannot be used. Note that this SQL only applies for employees. If you can have Contingent Workers as supervisors in your implementation then this needs tweaking.
    Does that help?

  • I bought my daughter an ipad mini and used my Apple ID to transfer over her favorites. Now I can't use netflix and hulu. So I want create her an id but it won't let saying too young. I tried to create another one with my age and it still says too young.

    I bought my daughter an ipad mini and used my Apple ID to transfer over her favorites. Now I can't use netflix and hulu. So I want create her an id but it won't let saying too young. I tried to create another one with my age and it still says too young.help!!!

    iTUNES STORE - TERMS AND CONDITIONS
    "This iTunes Service is only available for individuals aged 13 years or older, unless you are under 13 years old and your Apple ID was provided to you as a result of a request by an approved educational institution. If you are 13 or older but under the age of 18, you should review this Agreement with your parent or guardian to make sure that you and your parent or guardian understand it."
    Restart the iPad. Tap Settings > iTunes & App Store then sign in your Apple ID.

  • I I am trying to create a collage with 4-6 photo so I can print them on one sheet.   Can this be done in IPHOTO?

    I am trying to create a collage with 4-6 photo so I can print them on one sheet.   Can this be done in IPHOTO?

    Here are 3 options for future reference:
    1. With the setup you've described, apply a Match Move behavior to  the text and make the rectangle the source. Change the Transform parameter to Mimic source.  This way you can still adjust the text postion as needed, but the rectangle will drive the animation.
    2. Use a group to do the animation.  Put both your rectangle and text in the same group and animate the group's postion.
    3. Use the Link behavior.
    Each of these has it's advantages depending on what you need.

  • I am not having any luck trying to create a brochure with ID in CC

    I am not having any luck trying to create a brochure with ID in CC. i thought i remembered it to be something you can use  in Bridge also. Can't seem to find that either.
    anyone have any help they can offer?

    If you're starting from scratch learning InDesign, know that it's difficult to learn just by asking a few questions. You'll do much better either by buying an excellent, inexpensive book by Sandee Cohen:
    InDesign CC: Visual QuickStart Guide
    Or by watching some videos on www.Lynda.com. Here's the best introduction:
    InDesign CC Essential Training

  • How does one create a user with a null password in iManager?

    I'm setting up LDAP authentication and need to create a user with a null password.
    If you do not put a password in the password field when creating the user in iManager, a message pops up stating, No password has been defined for this user.
    You are given a choice of:
    Allow user to log in without a password
    - or -
    Do not allow user to log in without a password
    If you choose Do not allow user to log in without a password, there are no complaints.
    When I look at the properties of the newly-created user, however, I note that the "Require a password" checkbox is not filled in.
    That would imply that the answer to the question posed during the user's creation is moot; either answer produces a user that can log in without a password.
    I can then assign the Common Proxy password policy to the user, which does not dictate a minimum length for a password.
    From that point forward, any attempts to leave the password field blank in iManager results in another pop-up message stating:
    "Failure to enter a password will allow the user to login without a password."
    That implies that no password exists for the user, as opposed to a null password.
    Is that correct or are the public and private key for the user object still generated?

    If you do not specify a password, which is what happens when you select
    the 'Do not allow user to log in without a password' option initially, the
    user cannot login. A user with no password (meaning no password exists at
    all, similar to a 'null' in programming) cannot login with a password
    because, of course, they do not have a password.
    If you specify a zero-length string as the password you are effectively
    (and usually) creating a proxy user, for example to be used for the LDAP
    service in eDirectory, and this user can login typing in a password (since
    typing would imply one or more characters) but nevertheless there IS a
    password, but it happens that it is zero-length, so typing nothing for the
    password IS submitting the correct password. This is the option carried
    out by eDirectory when you choose, 'Allow user to log in without a
    password' (the prompt is a little misleading with its "without a password"
    phrase).
    Once you assign a UP policy you are telling the system that there SHOULD
    be a password on the user (and with common proxy there definitely should
    be, probably a strong one at that) so the only option now is whether or
    not the password is zero-length or longer. Obviously longer is the
    correct option for security reasons.
    Good luck.
    If you find this post helpful and are logged into the web interface,
    show your appreciation and click on the star below...

  • HT2731 My daughters iPad has just been factory restored from the apple shop, she was on my iTunes account with her email address but now she is the correct age for her own account. We have started up the iPad and with trying to create her own with her own

    My daughters iPad has just been factory restored from the apple shop, she was using my iTunes account with her email. When trying to create her own iTunes as she is the correct age it has come up that her email is already being used. How do we  do this with he same email address

    Hello spooner68,
    Thank you for the details of the issue you are experiencing when trying to create an Apple ID for your daughter.  Because her email address is associated with your Apple ID, you are receiving the message that the email address is in use. 
    To remedy this, you will have to first remove her email address from your account using steps 1-3 of the section titled "How to add an additional email address that is already associated with another Apple ID" in the article below and then attempt to create her Apple ID with her email address:
    How to add an additional email address that is already associated with another Apple ID
    If you have an email address that is already associated with another Apple ID, you may need to remove it from your other Apple ID before you can add it to your preferred Apple ID.
    Sign in to My Apple ID with the Apple ID that has the email address already associated with it.
    Find the email address that you want to move to your preferred Apple ID, then click Delete.
    Click Save Changes, then click Sign Out at the top of the page.
    You can find the full article here:
    Apple ID: Associating and verifying email addresses with your Apple ID
    http://support.apple.com/kb/HE68
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Error when trying to create a worksheet with 4 columns

    Dear All,
    I was trying to create a worksheet in tabluar formate base on a table (folder) that has 3 columns (items) .. the worksheet was created successfully .. but when saved it , then closed and tried to reopen it i got the following error
    ORA-03120: two-task conversion routine: integer overflow
    when i tried to add the columns one by one to the sheet .. it worked till 3 columns .. when i tried to add the fourth one i got that error agian ...
    I changed the combinations of the columns ... to make sure that there's no problem in the formate of one of them ..
    it worked with any combination of 3 columns
    can you help me to solve this problem
    best of regards,
    Shaimaa

    Cryptic message!
    I saw a definition online for this that said:
    Cause:     An integer value in an internal Oracle structure overflowed when being sent or received over a heterogeneous connection. This can happen when an invalid buffer length or too great a row count is specified. It usually indicates a bug in the user application.
    Action:     Check parameters to Oracle calls. If the problem recurs, reduce all integer parameters, column values not included, to less than 32767.
    Which seems even more cryptic.
    Then checking on another forum with this error, I saw:
    Q. I am getting the above error trying to run a free hand SQL report on two tables that are materialised views (database links) on our reporting database from our production database. Now the bizarre thing with this is that the report does not work on my computer or our production server, however one of my team mates can run the report.
    Can anybody explain why this error might occur? I am able to run free hand SQL on any other table. The Oracle error talks about a CLOB, but if that were the case, why would it work on a different machine?
    A1. Check if you have the same version Oracle client on the three machines. What happens if you run the query through a different tool like TOAD or SQL*Plus ?
    Final A. The problem was due to the different versions of Oracle Client. I was running 9.2 on my PC, I had 9.2 on the server and it wouldn't work. My collegues were running 9.0.1 and had no issues, once I changed back to this version on both my PC and the Server, the problem was gone.
    I think the problem was something to do with BO 6.5.1 as the report was developed in 6.1.a and worked fine, as soon as we upgraded the porblem occured.
    If you are not using CLOB's, I would suggest going down the track of checking your Oracle ver.
    So, with all that info, I'd check:
    1. are you using Disco Desktop and getting this?
    2. Materialized views?
    3. Links to another database in your folder?
    4. Do you have a different Oracle client that others? Can others run the same report and all okay?
    5. Can you run the same query in TOAD, SQL*Nav, SQL*Dev, etc?
    Russ

  • Trying to create a pdf with jasper - Content is not allowed in prolog

    hi all,
    Im trying to create a pdf file with jasper reports but i get this error message:
    29/11/2007 16:52:03 org.apache.commons.digester.Digester fatalError
    SEVERE: Parse Fatal Error at line 1 column 1: Content is not allowed in prolog.
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
         at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(XMLDocumentScannerImpl.java:899)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
         at org.apache.commons.digester.Digester.parse(Digester.java:1666)
         at net.sf.jasperreports.engine.xml.JRPrintXmlLoader.loadXML(JRPrintXmlLoader.java:151)
         at net.sf.jasperreports.engine.xml.JRPrintXmlLoader.load(JRPrintXmlLoader.java:103)
         at net.sf.jasperreports.view.JRViewer.loadReport(JRViewer.java:1376)
         at net.sf.jasperreports.view.JRViewer.<init>(JRViewer.java:243)
         at net.sf.jasperreports.view.JRViewer.<init>(JRViewer.java:214)
         at net.sf.jasperreports.view.JasperViewer.<init>(JasperViewer.java:140)
         at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:397)
         at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:328)
         at br.com.abril.contratos.Gerar.geraRelatorio(Gerar.java:38)
         at br.com.abril.contratos.Gerar.main(Gerar.java:47)

    cause of the error:
    After some extensive research on the web, it is found that that you are using an UTF-8 encoded file with byte-order mark (BOM). Java doesn't handle BOMs on UTF-8 files properly, making the three header bytes appear as being part of the document. UTF-8 files with BOMs are commonly generated by tools such as Window's Notepad. This is a known bug in Java, but it still needs fixing after almost 8 years...
    There are some hexadecimal character at the begining of the file, which is giving error"content not allowed in prolog". No solution is provided for this till now.
    Example: suppose your file start with <?xml version="1.0" encoding="utf-8"?>. you will see this in a editor. But if you open this file with any hexadecimal editor you will find some junk character in the start of the file.that is causing the problem
    solution:
    1) convert your file into a string and then read the file from the forst character that in my case the first character will be "<".so the junk character will not be there in the string and then again convert it into a file.
    2) some people are able to solve this problem by changing the "utf-8" to "utf-16". remember only in some case. some times this problem also exits in "utf-16" file.
    3) some are able to solve this problem by changing the LANG to US.en.
    4) If the first three bytes of the file have hexadecimal values EF BB BF then the file contains a BOM.so you can also handle by your own.
    5)Download a hexadecimal editor and remove the BOM.
    6) In case you are not able to think furthe then please to more research in internet may be you find some other solution to this problem. But These solution are some type of hack not exactly a solution.

  • Trying to create an O with a twirl effect

    Hello,
    I am pretty new to photoshop. I am trying to create an "O" like the one in the attachment and i can't for the life of me figure out how to create that. I tried everything, the twirl filter and everything but i can't even come close to getting that. Does anyone know or can show me please how to make that?

    It's not as straight forward as you might think.  Crevitz is right about the Distort > Twirl filter, but you need to start with something like this
    The apply Filter > Distort > Twirl two or three times, and finally grab the center portion with the Elliptical Marquee tool
    Resize to fit with Free Transform.

  • Trying to Create Tabular Form with apex_item... and apex_item.select_list

    I am trying to create a tabular form that uses multiple altec_item functions (select_list, select_list_from_LOV,...). Whenever I attempt to create a new page and select Tabular Form, I am forced to select a table and columns. So I have just selected any table and once the sql is created, I overwrite it with my own sql. When I try to apply the changes, I get an error anytime I use apex_item... for a particular column. I have tried the same creating a standard report with the same results. I have read at least 20 examples but none say where to start from when creating the tabular form and just jump right in to the code. Can anyone please point me in the right direction?
    Thanks,
    Jerryu

    You can start with creating a simple classic report. You can use apex_item functions in your query and later set your column attributes to "Standard Report Column". Basically, you are creating a updateable report.

  • Trying to create a surface  with multiple images with mouse events

    novice programmer (for a applet program)
    hi trying to create a surface i.e jpanel, canvas, that allows multiple images to be created.
    Each object is to contain a image(icon) and a name associated with that particular image. Then each image+label has a mouse event that allows the item to be dragged around the screen.
    I have tried creating own class that contains a image and string but I having problems.
    I know i can create a labels with icons but having major problems adding mouse events to allow each newly created label object to moved by the users mouse?
    if any one has any tips of how to acheive this it would be much appreciated. Thanks in advance.
    fraser.

    This should set you on the right track:- import java.awt.*;
        import java.awt.event.*;
        import javax.swing.*;
        public class DragTwoSquares extends JApplet implements MouseListener, MouseMotionListener {  
           int x1, y1;   // Coords of top-left corner of the red square.
           int x2, y2;   // Coords of top-left corner of the blue square.
           /* Some variables used during dragging */
           boolean dragging;      // Set to true when a drag is in progress.
           boolean dragRedSquare; // True if red square is being dragged, false                              //    if blue square is being dragged.                            
           int offsetX, offsetY;  // Offset of mouse-click coordinates from
                                  //   top-left corner of the square that was                           //   clicked.
           JPanel drawSurface;    // This is the panel on which the actual
                                  // drawing is done.  It is used as the
                                  // content pane of the applet.  It actually                      // belongs to an anonymous class which is
                                  // defined in place in the init() method.
            public void init() {
                 // Initialize the applet by putting the squares in a
                 // starting position and creating the drawing surface
                 // and installing it as the content pane of the applet.
              x1 = 10;  // Set up initial positions of the squares.
              y1 = 10;
              x2 = 50;
              y2 = 10;
              drawSurface = new JPanel() {
                        // This anonymous inner class defines the drawing
                        // surface for the applet.
                    public void paintComponent(Graphics g) {
                           // Draw the two squares and a black frame
                           // around the panel.
                       super.paintComponent(g);  // Fill with background color.
                       g.setColor(Color.red);
                       g.fillRect(x1, y1, 30, 30);
                       g.setColor(Color.blue);
                       g.fillRect(x2, y2, 30, 30);
                       g.setColor(Color.black);
                       g.drawRect(0,0,getSize().width-1,getSize().height-1);
              drawSurface.setBackground(Color.white);
              drawSurface.addMouseListener(this);
              drawSurface.addMouseMotionListener(this);
              setContentPane(drawSurface);
           } // end init();
           public void mousePressed(MouseEvent evt) {
                  // Respond when the user presses the mouse on the panel.
                  // Check which square the user clicked, if any, and start
                  // dragging that square.
              if (dragging)  // Exit if a drag is already in progress.
                 return;           
              int x = evt.getX();  // Location where user clicked.
              int y = evt.getY();        
              if (x >= x2 && x < x2+30 && y >= y2 && y < y2+30) {
                     // It's the blue square (which should be checked first,
                     // since it's in front of the red square.)
                 dragging = true;
                 dragRedSquare = false;
                 offsetX = x - x2;  // Distance from corner of square to (x,y).
                 offsetY = y - y2;
              else if (x >= x1 && x < x1+30 && y >= y1 && y < y1+30) {
                     // It's the red square.
                 dragging = true;
                 dragRedSquare = true;
                 offsetX = x - x1;  // Distance from corner of square to (x,y).
                 offsetY = y - y1;
           public void mouseReleased(MouseEvent evt) {
                  // Dragging stops when user releases the mouse button.
               dragging = false;
           public void mouseDragged(MouseEvent evt) {
                   // Respond when the user drags the mouse.  If a square is
                   // not being dragged, then exit. Otherwise, change the position
                   // of the square that is being dragged to match the position
                   // of the mouse.  Note that the corner of the square is placed
                   // in the same position with respect to the mouse that it had
                   // when the user started dragging it.
               if (dragging == false)
                 return;
               int x = evt.getX();
               int y = evt.getY();
               if (dragRedSquare) {  // Move the red square.
                  x1 = x - offsetX;
                  y1 = y - offsetY;
               else {   // Move the blue square.
                  x2 = x - offsetX;
                  y2 = y - offsetY;
               drawSurface.repaint();
           public void mouseMoved(MouseEvent evt) { }
           public void mouseClicked(MouseEvent evt) { }
           public void mouseEntered(MouseEvent evt) { }
           public void mouseExited(MouseEvent evt) { }  
        } // end class

  • Error trying to create first database with Database Studio on MaxDB 7.7

    After installing the Database Studio 7.7 and starting up, i tried to create a first (local) database following the procedure documented in the online manual:
    Under the heading of "Servers" an entry "<Local>" was created.
    Then  i used the right mouse button to "Create Database...".
    A popup window appears with:
    Database Server <Local>
    Database Name MAXDB
    Login Information for Server (user/password) grayed out.
    Then doing "Next >" generates the following error:
    No installation available on server '<Local>'.
    Remark: installation went without problems.
    Any help is appreciated greatly.

    Hi Simon,
    a silly question just to clarify the issue: Do you have a MaxDB Installation on your PC where Database Studio was installed?
    What does the Event Log tell you about the issue?
    See Window->Show View->Event Log Viewer
    or if not listed there
    Window->Show View->Other ...->Database Studio->Event Log Viewer
    Could you please have a look and tell me what it says? If you find a message that is related to your problem double click it and press the little Copy to clipboard icon in the upper right corner then you can paste the message in your reply.
    Cheers,
    Daniel

  • Urgent help! trying to create basic report with prompt.

    Hi,
    I'm trying to create a report which allows a user to select a item_id value (using either a LOV or manually entering a text_id) and then too display output.
    for some reason apex does not like the '&' prompt, in the SQL.
    Any help or suggestions, would be great? this is quite straightforward so it must be something I'm doing wrong!
    sql statement below:
    select i.item_id, i.title, d.date_logged, d.details
    from tracking_issues i, tracking_details d
    where i.item_id=&item_id
    and i.item_id=d.item_id

    Smiley,
    Apex is building a JSP, so instead of you running the page and it poping up a input box that you might be familar with if you run your sql in TOAD or SQL Nav it is waiting on your input(text box/LOV) to populate the item_id field. You need to build your LOV on something like select item_id d, item_id r from items and then once you select that item in the LOV the page will(should - based on how your branch is set up) to the page you are on and your report is displayed.
    Also make sure in your branch you are setting the LOV item name to the value you select for it in the branch since the page needs re-submit.
    Your select statement for your report should look like:
    select item_id, title
    from tracking_issues
    where item_id=:p1_LOV
    --where p1_lov is the name of your LOV
    -David

  • I'm new to Photoshop CC and trying to create a collage with 16 pictures.  Help

    I need help in creating a collage with 16 pictures.

    So you created a document 192000 pixels wide, and 108000 tall, and  set the type to be 2 inches tall.  Yes, the type is going to take a few minutes to render in that document.
    Yes, you created a document much bigger than you probably intended (you probably wanted 1920 PIXELS by 1080 PIXELS).
    Pixels and inches are not the same, and you need to pay attention to the units.

Maybe you are looking for

  • HTTPService problems while sending a String Variable to Server

    I have an xml in string form..... I want to send it as an http request to the server, which is written in .NET... server wud make its decession on the basis of this xml and wud return me another xml as http response.. Problem ----> this request reach

  • Acrobat X Pro Only Prints First Page

    I have several multipage PDFs that I am trying to print to my HP LaserJet 5si MX. I am on OS X 10.6.5 with all the latest updates applied. When printing, only the first page prints and then the printer queue clears as though the whole document printe

  • Messages whaen I open up iphoto

    recently i have been getting 2 messages when I open up iphoto they are : 7 photos have been found in the iphoto library that were not imported. Would you like to import them? and the other is : The photos have been placed in the folder/volumes/Extern

  • ADF Faces : simultaneous partial page rendering

    hi I'm wondering what I can expect from "simultaneous partial page rendering". I would like to have some af:selectOneChoice components on a page, with next to them some related information about the selected value. This example application, created u

  • Approval Level

    Hi all..    I want to get the Approver level...in my scenerio i have 3 levels of approver ...when the 3rd approver approves the workitem i want update some values.. i write the coding in the SAVI Badi it is working ... i am not able to get the approv