What code can i use to add an image to a JPanel?

I tried multiple image tutorials and none of those supplied me with a way to add an image to a JPanel without using hidious code. Don't anyone know simpler code which i can use?

Don't anyone know simpler code which i can use?Simpler than what? Post what you've got at the moment. Use code
tags as described here: http://forum.java.sun.com/help.jspa?sec=formatting
About the simplest I can think of is to make a JLabel using the
constructor that takes an Icon argument, and then add it to the JPanel.
(The Swing forum is the best place for this.)

Similar Messages

  • Drag and Drop Shapes that snap back to its original position, if it is placed in the correct shape it stays there. What code can I use? PLEASE HELP!

    I need the code for this, how could I possible do this?
    I'm a begginer and I am very interested as to how I can create this.

    using the same initialization code shown in your previous post, use:
    // in your drop listener function
    if(square.hitTestObject(whatever)){
    square.x=whatever.x;
    square.y=whatever.y;
    } else {
    square.x=square.initX;
    square.y=square.initY;

  • What code can i write for this?

    unction Name : ZXXx_Update_Contact
    Hi,
    I need what parameters and tables can use for this requirement.
    What code can i write?
    Function Name : ZXXx_Update_Contact
    Use BAPI_BUPA_CENTRAL_CHANGE as a starting point for updating the business partner
    Business Partner = contact number
    Complete the following for any changed fields
    CentralDataPerson_X - This is a set of switches telling the function what to update
    CentralDataPerson - Firstname & Lastname
    Use BAPI_BUPA_ADDRESS_CHANGE for address changes
    Business Partner = contact number
    Address data - city
    Address data_X - X in city field
    BAPIADTEL first entry - Telephone(Business land line number),Con-001
    BAPIADTEL second entry - Telephone(Mobile number),Con-002
    BAPIADTEL_X first entry - X in Telephone and Con fields
    BAPIADTEL_X second entry - X in Telephone and Con fields
    BAPIADSMTP - e-mail
    BAPIADSMT_X - X in e-mail field
    Early reply is highely appriciable.
    Regards,
    chow.

    Hi Nishu,
      There is no way you can validate the fields and their lengths before you ipload them into internal tables.
    First you should upload them and then loop the intrenal table to delete such records.
    loop at itab.
    if strlen(itab-comp_code) < 4.
    delete itab index sy-tabix.
    endif.
    endloop.
    Regards,
    Ravi

  • HT3224 What cable can I use to transfer data from a 2008 MacBook Pro to a new MacBook Pro with thunderbolt?

    What cable can I use to transfer data from a 2008 MacBook Pro to a new MacBook Pro with thunderbolt?

    You should also ask this in the MacBook Pro forum. This is the forum for the 13” white and black plastic MacBooks that were discontinued in 2010. You should also post this question there to increase your chances of getting an answer.
    https://discussions.apple.com/community/notebooks/macbook_pro

  • Dead Hard Drive - What replacement can I use for iBook G4?

    I have a
    Machine Model: iBook G4
    CPU Type: PowerPC G4 (3.3)
    Number Of CPUs: 1
    CPU Speed: 933 MHz
    L2 Cache (per CPU): 256 KB
    Memory: 384 MB (Upgraded to 1Gig)
    Bus Speed: 133 MHz
    Mac OSX 10.3.9.
    The hard drive died. What type and manufacrure do I need. Is it a Serial, ATA or IDE? What sizes can I use 40G, 60G, 80G, or 100G?
    Thanks for your help.

    but if your ibook was made before 2003 the limit for hard drives is 128GB any mac made before 2003 has this limit.
    heres a take aprt manual
    http://www.sterpin.net/uk/ddibookg4uk.htm

  • I have a power mac g4 with mac os 10.4. 11 , I want to change the hard-drive ,what program  can I used  to transfer one hard-drive  to another  hard- drive  on this mac pc.

    I have a power mac g4 with mac os 10.4. 11 , I want to change the hard-drive
    ,what program  can I used  to transfer one hard-drive  data to another  hard- drive  on this mac pc.

    The Disk Utility, Carbon Copy Cloner, SuperDuper, or similar software. For best results, place the second drive inside the computer or in a FireWire enclosure and boot the computer from it before removing the internal drive.
    (66989)

  • What else can I use beside Compressor?!

    Compressor is now useless to me. Unknown time remaining will not fix. What else can I use? Anyone know?

    Look, we understand your frustration and, since we've been hanging out here a long time, we differentiate newbie issues as separate from actual or legitimate problems by seeking information newbies refuse or simply do not understand how to supply. You've added significant information that will allow us to assist you.
    Compared to the hundreds of thousands of successful and happy Compressor users, "plenty of people" is not significant.
    The next post in this thread suggests your only hope is a complete system wipe and reinstallation. Do you want to try that and report back to us?
    It is useless if it doesnt work and yes I've never gotten to use it. I have used lessons on lynda.com. It's not that I don't know what I'm doing. Try a simpler batch, I was using the simplest of batches. The setting is conventional. I spent time on the phone with 2 different Apple tech people who know compressor. I assure you I have spent the entire day trying to fix this to no avail.
    I've learned that plenty of other people have this same problem with no solution being offered here or from Apple.
    <
    bogiesna

  • What program can I use to...

    What program can I use to screen record things on my mac?

    You can use QuickTime Player. Open QuickTime Player and go to File > New Screen Recording. Also, you can purchase Screenflow in the App Store because it's more advanced

  • I received a ms publisher file what program can i use to open and edit

    i received a ms publisher file what program can i use to open and edit

    There is no program that can open Publisher files except Publisher. It doesn't matter whether you use Windows or a Mac, Publisher files must have Publisher.
    Publisher does not have a Mac version so you will need Windows (and Publisher)

  • What program can I use to open documents

    What program can I use to open documents with; if I am running OSX 10.6.8 and only have Text edit?

    What kind documents of documents do you want to open? Just to read or write too?
    Besides TextEdit, you also have Preview that can display a wide gamut of document types as well.
    As for office documents, may want to download and install LibreOffice to deal with the usual suspects: .doc, .xls, .ppt   http://www.libreoffice.org/

  • What program can i use to type papers/essays on my MacBook

    What program can i use to type papers/essays on my MacBook? (Mac OS X) Version 10.5.8

    IRIS0321 wrote:
    What program can i use to type papers/essays on my MacBook? (Mac OS X) Version 10.5.8
    You can use Textedit, it's on your Mac in the Applications folder, or you can download any of the ones suggested by shldr2thewheel, also Google for Bean, a free word processor for the Mac.

  • What function can be used to give a "count of occurrences of values" ?

    I would be very appreciative if someone in the user community could save me a few months of work....I've already been neck deep in my old statistics and calculus manuals. What function can be used to get the count of occurrences of the value of an item. Ex: Item is Status and possible values are "Published", "In Production", "Construction". In one report, I want to report all records of a table and list the Status (among other items) but at the total, I would like to see a count of each value for the item Status....something like Sum(Count(Status = "Published")) Sum(Count(Status = "In Production")) Sum(Count(Status = "Construction")). I know I could run the report 3 times counting a unique value, but I'm trying to be more efficient in my reporting. Thanks all for any help given.

    Hi
    In addition to John's answer, inside Discoverer you can do this:
    Let's assume you have a Status item and it has the values you mention. If you create the following new calculation SUM(ROWNUM) and name it Status Count you only need to include the Status and the Status Count in the worksheet. You will now see a count for each status.
    Best wishes
    Michael

  • Please advice which T-code can I use

    hi experts,
    I need a report to display the entire PO created by Company code xxxx from July to Sept 08.
    Please advice which T-code can I use.
    thanks in advance,
    mohammad

    Use ME2N Report on Purchase Orders and Input Document Date From Date and To Date Field and Select the scope of List as ALLES_ALV / as per your Requirement and Execute.
    Else Go to SE11 and Input Table EKKO and then Click on Display / F7 then Execute / CtrlShiftF10 and Input Document Date and Execute.

  • What query can we use ...for over 30 days

    select PROPERTY,RELAVANTDATE ,
    sum(NOTICES) over (
    partition by property
    order by RELAVANTDATE
    range between interval '30' day preceding and current row
    ) "SUM"
    from Test_Data
    what query can we use ...for over 30 days
    can i use following or preceding

    SCOTT@soti_9> WITH Test_Data AS (
      2    select 10100 as property, to_date('25-JAN-07') as RelavantDate, 20 as notices from dual union all
      3    select 10100 as property, to_date('25-DEC-07') as RelavantDate, 5 as notices from dual union all
      4    select 10100 as property, to_date('02-JAN-08') as RelavantDate, 10 as notices from dual union all
      5    select 10100 as property, to_date('01-DEC-08') as RelavantDate, 10 as notices from dual union all
      6    select 10100 as property, to_date('02-DEC-08') as RelavantDate, 20 as notices from dual union all
      7    select 10100 as property, to_date('31-DEC-08') as RelavantDate, 20 as notices from dual union all
      8    select 10100 as property, to_date('03-JAN-09') as RelavantDate, 30 as notices from dual union all
      9    select 10100 as property, to_date('25-JAN-09') as RelavantDate, 20 as notices from dual
    10  )
    11  select PROPERTY,RELAVANTDATE ,
    12    sum(NOTICES) over (
    13      partition by property
    14      order by RELAVANTDATE
    15      range between current row and interval '30' day following
    16    ) "SUM"
    17  from Test_Data
    18  ;
      PROPERTY RELAVANTD        SUM
         10100 25-jan-07         20
         10100 25-dec-07         15
         10100 02-jan-08         10
         10100 01-dec-08         50
         10100 02-dec-08         40
         10100 31-dec-08         70
         10100 03-jan-09         50
         10100 25-jan-09         20
    8 rows selected.Regards,
    Dima

  • What else can be used

    Hi all,
    am having problem to iterate to next record when using when validate record trigger.
    what else can be used instead of next_record to iterate through?
    thanks.

    following is the problem where i have to calculate backlog by comparing it with the value presented in the database and that of the changed by user.
    for exmaple in ven_share table share_quota defined was 100% and user changes it to 40 backlog should contain 60
    upto this my logic is working fine but when i iterate to next record i want backlog to show previous + newly changed value..
    can you suggest now how can it work in any other way??
    declare
         v_share number(3);
         bck number(4);
    --     total_bck number(3);
    cursor c1 is select share_quota from ven_share where vendor_code=:ven_share.vendor_code;
    begin
              first_record;
    --open c1;
    --fetch c1 into v_share;
    for i in c1
    loop
         v_share:=i.share_quota;
         if v_share<>:ven_share.share_quota--,:system.cursor_record
              then
              if v_share>:ven_share.share_quota
                   then
                   :ven_share.backlog:=v_share-:ven_share.share_quota;
                   bck:=:ven_share.backlog;
                   --next_record;
    --     total_bck:=bck+v_share-:ven_share.share_quota;
              end if;
         end if;
    --          if :ven_share.vendor_code is null
    --               then
    --                    null;
                        --bck:=:ven_share.backlog;
              --     else
              --     if v_share>:ven_share.share_quota then
                                       --     message(v_share);
         --     message(:ven_share.share_quota);
              --          :ven_share.backlog:=bck+v_share-:ven_share.share_quota;
         --     end if;     
    --          end if;
         --     end if;
    --     end if;
    EXIT WHEN :SYSTEM.LAST_RECORD ='TRUE';
    --NEXT_RECORD;     
    end loop;
    end;
    thanks

Maybe you are looking for