How do you have two classes drawing to the same JPanel? Graphics g problem

Hi all,
This is probably a five second answer but im really stuck on it!
How do i have two classes both writing to the same JPanel?
I have one class that extends JPanel and using Graphics g, draws to the panel ie g.drawString(..);
But i would like another class to draw to the same panel, so that the two different classes can both draw what they like to the JPanel.
How do i do this?
I have tried sending the Graphics g object from the one class to the other but only the original class draws still. I was thinking perhaps if it carn't be done could i have a JPanel on top of the other one that is transparent so there would be a tracing paper effect?
Many thanks

I have tried sending the Graphics g object from the
one class to the other but only the original class
draws still. I was thinking perhaps if it carn't beThis is the right idea. One problem you may be running into is that JPanel fills in its background with the background color by default. If you switch and use JComponent instead of JPanel you may get better results. Another idea is to use a "painter": a class that has a paint(Graphics g) but is not a component and just paints on a component. I've done this before in implementing Tetris where the dropping piece is a class which can paint itself but is not a component.

Similar Messages

  • Can you have two itunes accounts on the same computer?

    Can you have two itunes accounts on the same computer and if so how do you access them without syncing each others music?

    Yes. Use separate iTunes libraries(launch iTunes with the Shift(Windows) or Option(Mac OS X) key held down as needed), or different user accounts on the computer.
    (100648)

  • How can I have two PDFs open at the same time next to each other?

    How can I have two PDFs open at the same time next to each other?

    Moved to Adobe Reader for iOS.
    The only way I know how to do that is with two iPads.

  • How do you sync two iTunes accounts on the same MacBook Pro

    How do you sync two itunes accounts on the same Macbookpro?

    Not sure what you mean by "sync two itunes accounts".

  • If you have two iphone 4s on the same Itunes account how can you keep seperate info on each phone i.e contacts and apps etx

    My wife and I have Iphone 4s phones, and the same itunes account on two laptops, when she started her phone for the first time all my contacts were deleted how can we have seperate details on each phone, or do we need seperate accounts

    Thanks for the help. Took a bit of time and I'll need her phone (when she's back) to get it all straight...I think! :-)

  • Can you have two Enterprise CA on the same AD Domain at the same time

    Hello
    Can someone please help me with the following question
    If I have a Windows 2003 R2 Enterprise Root CA on the AD Domain can I also Add a separate Windows 2012 R2 Enterprise Root CA to the same domain.
    We do not use Autoenrollment on the existing 2003 R2 CA.
    Network guys want to introduce a Cisco BYOD (Bring Your Own Devise) solution using Cisco ISE (Identity Services Engine) which uses SCEP/NDES and therefore need certificates from CA. The thing is the ISE recommend 2008 AD CS as a minimum
    Therefore I wonder if Installing a 2012 R2 Root CA that only provides certificates via the NDES/ISE solution would be a possibility. 
    I understand the Root CA Cert is held in a container under the 'Configuration' partition in Active Directory. Therefore can you have Two Root CA certs in the AD container at the same time for the same AD Domain/Forest?
    The idea would then be to migrate other services to the new CA and phase out the old 2003 R2 CA over time.
    Thanks All
    AAnotherUser__
    AAnotherUser__

    On Thu, 18 Sep 2014 09:18:43 +0000, AAnotherUser wrote:
    Therefore can you have Two Root CA certs in the AD container at the same time for the same AD Domain/Forest?
    Yes.
    Paul Adare - FIM CM MVP
    You are trapped in a maze of screens and ssh sessions all alike.
    It is dark, and you are likely to log off the wrong account. -- Nep

  • HT1451 Can you have two seperate libraries on the same computer? How can you do that?

    My family uses the same computer but I like different music. How can I create a seperate library for me to sync to?

    Launch iTunes with the Shift key(Windows) or Option key(Mac OS X) held down, or use a different user account.
    (66145)

  • How can you have all pages open at the same display size, instead of having to hit Ctrl+ to get the size you want?

    In IE the page can either be set to 100% or whatever you wish, and once set future pages open up displayed the same way. With FF every time I open a page I have to hit ctrl+ about 3 or 4 times to get it to fill the screen
    I have tried changing the default font to 16 with a min of 16 and not letting the page decide etc. I am sure that this has been asked before, but I have not used FF in several years.
    Thanks

    There are some add-ons that can be used to change the zoom level on all sites, for example:
    * NoSquint - https://addons.mozilla.org/firefox/addon/nosquint/
    * Default FullZoom Level - https://addons.mozilla.org/firefox/addon/default-fullzoom-level/

  • How do you sync two ipod touches to the same computer?

    Whenever I plug in my ipod touch to my computer, it still shows my husbands library and I can't sync. Even if I log into the iTunes store, it still shows all his library. What do i have to do to use two iPods on the same pc?
    Message was edited by: MackMama

    Create a new library, either by launching iTunes with the Shift key held down or by creating a new Windows user account.
    (55045)

  • Can you have two iTunes accounts on the same desktop PC?

    I have an iPad 3 and my wife has an iPad 2 from her work. We have a desktop PC which we wish to use to sync the iPads to. We have separate user accounts on the PC. Can we have separate iTunes accounts on the PC?  We will we be able to share music, pictures, etc.?

    Yes. Use separate iTunes libraries(launch iTunes with the Shift(Windows) or Option(Mac OS X) key held down as needed), or different user accounts on the computer.
    (100648)

  • How do I have two apps open at the same time on full screen?

    As above - I want to work on word and the internet at the same time. I have resized the screens to half but would like them both to be on full screen. I did manage to do this by accident once (I think) so I'm sure it can be done!!

    Lion I think - it's the new mac air?

  • But can you have two libraries open at the same time?

    I have a few libraries stored externally, that I don't acceess much as they have older images, and my main current library. I was wondering whether, with the new management scheme, it would recognize the external libraries as source images, linked to my main library, so that when I'm connected to the external drive, they appear in my main library, fully editable, but when the external is offline, they appear as linked offline previews.
    In other words, will the other libraries be suitable as "other" source folders?
    Mark

    I have a few libraries stored externally, that I
    don't acceess much as they have older images, and my
    main current library. I was wondering whether, with
    the new management scheme, it would recognize the
    external libraries as source images, linked to my
    main library, so that when I'm connected to the
    external drive, they appear in my main library, fully
    editable, but when the external is offline, they
    appear as linked offline previews.
    In other words, will the other libraries be suitable
    as "other" source folders?
    I don't know if it would quite work like that, but you could import all the projects from those other libraries, then use the new tools to move the master files back to those external drives. Then you would essentially have what you were looking for, which is one central library with some master images held offline in case you needed them later.

  • Can you have two slides shows on the one interactive page?

    I'm just new at learning interactive pdfs in indesign so sorry if this is common knowledge. I know how to create a slide show on a page, but can you have two slide shows on the one page or more for that matter? (Ideally I need 3.) Each slide show has its own set of images and buttons.

    Just :http://www.youtube.com/watch?v=Dm0aeMUPZ4U
    But I'm happy to create them a different way if needed be.

  • Can you have two detail lists from the basic list at the same time?

    Hi
    Can you have two detail lists from the basic list at the same time?
    If yes how and if no why?
    Thanks
    Venkat

    No   ... it is not   possible   of   2 detail  list at   one time   from the basic  list ...
    you can  increament   the SY-LSIND  .... But you can not   display  both the windows   at single time  ...
    it is  possible  to  display  2 Detail list  in ALV   ......  from one  basic  list   using  the  Blocked  list  concept    .
    Sample Program on BLOCK LISTS
    Report   zblock_list
    * Declarations for BLOCK ALV DISPLAY
    *--type pools
    TYPE-POOLS:slis.
    DATA:x_layout TYPE slis_layout_alv,
    t_field TYPE slis_t_fieldcat_alv,
    *--field catalog
    x_fldcat LIKE LINE OF t_field,
    *--to hold all the events
    t_events TYPE slis_t_event,
    x_events TYPE slis_alv_event,
    t_sort TYPE slis_t_sortinfo_alv,
    x_sort LIKE LINE OF t_sort ,
    *--Print Layout
    x_print_layout TYPE slis_print_alv.
    *----Macro to add field catalog.
    *field "text "length "tech "COL_POS "DATATYPE "DDIC_OUTPUTLEN
    DEFINE add_catalog.
    clear x_fldcat.
    x_fldcat-fieldname = &1.
    x_fldcat-seltext_m = &2.
    x_fldcat-outputlen = &3.
    x_fldcat-tech = &4.
    x_fldcat-col_pos = &5.
    x_fldcat-no_zero = 'X'.
    x_fldcat-ddictxt = 'M'.
    x_fldcat-datatype = &6.
    x_fldcat-ddic_outputlen = &7.
    if &6 = 'N'.
    x_fldcat-lzero = 'X'.
    endif.
    *--build field catalog
    append x_fldcat to t_field.
    END-OF-DEFINITION.
    *----- data declerations.
    data: v_repid like sy-repid.
    data: begin of itab occurs 0,
    matnr like mara-matnr,
    ernam like mara-ernam,
    meins like mara-meins,
    end of itab.
    data: begin of jtab occurs 0,
    matnr like makt-matnr,
    maktx like makt-maktx,
    end of jtab.
    select matnr ernam meins
    up to 20 rows
    from mara
    into table itab.
    select matnr maktx
    up to 20 rows
    from makt
    into table jtab.
    v_repid = sy-repid.
    *DISPLAY alv
    * Initialize Block
    call function 'REUSE_ALV_BLOCK_LIST_INIT'
    exporting
    i_callback_program = v_repid.
    *Block 1:
    *INITIALIZE
    refresh t_field. clear t_field.
    refresh t_events.
    *field "text "length "tech "COL_POS "DATATYPE "DDIC_OUTPUTLEN
    add_catalog:
    'MATNR' 'Material' '18' '' '1' 'C' '18',
    'ERNAM' 'Created By' '12' '' '2' 'C' '12',
    'MEINS' 'Unit' '5' '' '3' 'C' '3'.
    *--build table for events.
    x_events-form = 'TOP_OF_LIST1'.
    x_events-name = slis_ev_top_of_list.
    append x_events to t_events.
    call function 'REUSE_ALV_BLOCK_LIST_APPEND'
    exporting
    is_layout = x_layout
    it_fieldcat = t_field
    i_tabname = 'ITAB'
    it_events = t_events
    it_sort = t_sort
    tables
    t_outtab = itab
    exceptions
    program_error = 1
    maximum_of_appends_reached = 2
    others = 3.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    *--BLOCK 2(SUMMARY REPORT)
    *INITIALIZE
    refresh t_field. clear t_field.
    refresh t_events.
    *field "text "length "tech "COL_POS "DATATYPE "DDIC_OUTPUTLEN
    add_catalog:
    'MATNR' 'Material' '20' '' '1' 'C' '18',
    'MAKTX' 'Description' '40' '' '2' 'C' '40'.
    *--build table for events.
    x_events-form = 'TOP_OF_LIST2'.
    x_events-name = slis_ev_top_of_list.
    append x_events to t_events.
    * Append table block.
    call function 'REUSE_ALV_BLOCK_LIST_APPEND'
    exporting
    is_layout = x_layout
    it_fieldcat = t_field
    i_tabname = 'JTAB'
    it_events = t_events
    tables
    t_outtab = jtab
    exceptions
    program_error = 1
    maximum_of_appends_reached = 2
    others = 3.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    *--CALL FM TO DISPLAY THE BLOCK REPORT.
    call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    * exporting
    * is_print = x_print_layout
    exceptions
    program_error = 1
    others = 2.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    form top_of_list1.
    skip 1.
    write: 10 'List 1',
    /5 '--------------------'.
    skip 1.
    format reset.
    endform.
    form top_of_list2.
    skip 1.
    write: 10 'List 2',
    /5 '--------------------'.
    skip 1.
    format reset.
    endform.
    reward  points if it is  usefull ....
    Girish

  • Can you have two different iTunes accounts on same computer?

    Can you have two different iTunes accounts on same computer?

    J2217 wrote:
    I'm going to give my old iPad to my granddaughter, I want to create an account for her, but I want to do it on my computer so there are no worries about who is spending credits for that account. Don't know how this will work, or if its possible to two iTunes libraries.
    Okay.
    She's going to use your computer to sync with iTunes.
    Create an new computer login on your computer for her. This will keep her stuff separate and she won't be able to mess with any of your info.
    Log into her computer account.
    Launch iTunes.
    Create a new iTunes account for her. See this -> http://support.apple.com/kb/HT2731
    You can enter a credit card to create the account then delete the CC info. Or you can use an iTunes gift card and she can fund the account with gift cards instead of using a CC to make purchases. This is an easy way to control spending.
    on the iPad, go to Settings > iMessage > Off.
    Then Settings > General > Reset > Erase all content & settings.
    Once it finishes, plug in the iPad, select it in iTunes and this will set it up as a new device. Enter all your granddaughter's info.
    When she wants to sync her iPad or use iTunes, she needs to log into your computer with her account.
    Then the iTunes library she uses will be only hers.

Maybe you are looking for

  • Searching in sxmb_moni for business data

    Hello, it is possible searching for business data in sxmb_moni for example a order-No. The reason is that a customer want know the time the order is executing or this happened without an error or trying to send the order again. Normally only with the

  • How do I find out how many times a date is in and array collection?

    Hi there, I have an arrayCollection that has a bunch of articles in it. I am trying to figure out how many articles there are each day to power a line graph. Any thoughts on how I could easily do this? basically I need a method that will return how m

  • Text in the title bar of an Accordion component

    Hi - I have an accordion component on my swf. Its working right but the text in the title bars (where I click to flip the accordion pages) is coming up bold when I want it normal. How do I change this? Thanks. D2

  • Problems starting project after migrating to JDeveloper 11

    Hello, when starting a my project via Webstart a Exception appears. I have an application created in JDeveloper 10 using Java 1.5. Now we have to change to java version 1.6, so i tried the following steps: 1.     install JDeveloper 11 120 2.     inst

  • Adding custom field va31

    Hi, I need  to  add two  custom fields  as  header in Tran va31 , Please  explain  procedure 2) In ale added custom  segment  to   custom idoc  and  assign to message  type MATMAS in Tran we82, Now i want to populate  custom  field . Could you  give