Whats the easiest/simplest way to draw a board with images on it?

Im doing a project for school and im familiar with gui�s but I never done any work on drawing a board (10 x 10) and being able to place a jpg in each box. I have an overall idea of what im thinking about doing. Which is of course using a multidimensional array, and drawing the board on a Jpanel. From my understanding, the gui is just for looks the real action is going on whenever the user clicks on a square and getting the x,y coordinates, and placing or getting that image�s name/number from the array based on the coordinates right? The only part im not so sure about is the drawing of the board and placing jpgs on it based on the users clicks. Any sugguestions to help me get started?

hey db,
thanks for your reply, out of curiousity will this
slow down the process of displaying the pictures
since i will be using MediaTracker(or is there a
better way of displaying gif/jpg?)? My favorite way is to add a JLabel to the panel, create an ImageIcon from the jpg and then call setIcon on the Jlabel passing it the ImageIcon. ImageIcon uses its own MediaTracker so you don't need to mess with one.
i was also hinted
to do this from a friend which was to create 1 X by X
pixel panel first then have a parent panel that
contains 100 of them (10x10) but wasnt sure since i
only knew 1 way of doing it which was getting the xy
coordinates. since this project will allow the user
to move pieces sorta like chess where each piece has
the ability to move a certain # of spaces and based
on their characteristics they can either win or get
"kill", i wasnt sure as to which was the best way of
doing this.
btw you said when creating an ImagePanel i wouldnt
have to calculate where the user clicked on, for
example if the user clicks on the 2nd row 1st box
(which is 0,1 in my array) will be the actual
ImagePanel be returned so i can either remove the
image and place it elsewhere without having to get
the xy coordinates or do i have the concept wrong?My thought was that clicking on a particular panel would cause it to become the "active panel" which you could then manipulate as you wish.
>
thanks again db!The link camickr provided is also a good solution
Cheers
DB

Similar Messages

  • Does anyone know whats the easiest way to tranfer files from pc to mac

    Does anyone know whats the easiest way to tranfer files from pc to mac

    What kind of files, how many files, total amount of file space? There are many ways to move files from platform to platform, but until you tell us what the nature of the task is we can't give you a proper solution.

  • What is the easiest/quickest way to upload a just-taken picture to Facebook?

    What is the easiest/quickest way to upload a just-taken picture to Facebook?

    Open the Facebook app on your iPhone and select Photo, select Choose from Library, etc.

  • What is the easiest & quickiest way to delete apps from an iPad?

    What is the easiest & quickiest way to delete apps from an iPad?

    You can delete apps directly on the iPad by pressing and holding any of the apps and after a couple of seconds or so they should start to shake. Then press the 'x' in the left corner to delete the ones that you don't want, and when you've finished deleting press the home button so as to stop the shaking (you can't delete any of the Apple built-in apps). If you don't get the 'x' on any of the apps that you've downloaded then check that Settings > General > Restrictions > Deleting Apps isn't set 'off'
    Or you can connect the iPad to your computer and select it on the left-hand side of your computer's iTunes, and then use the Apps tab on the right-hand side of iTunes to remove the apps that you no longer want on the iPad

  • I want to know what the legal / correct way to open a band Iphone 4 AT

    I want to know what the legal / correct way to open a band Iphone 4 AT & T I want to use in Colombia!???

    Contact ATT to determine if you qualify for their unlocking policy.

  • Hi, I need to activate my Adobe CS3 on a new computer because my old one died and I'm having difficulty. Tried the normal registration way and then logged in with my Adobe ID and can see the software and activation code already registered. How to get it o

    Hi, I need to activate my Adobe CS3 on a new computer because my old one died and I'm having difficulty. Tried the normal registration way and then logged in with my Adobe ID and can see the software and activation code already registered. How to get it on my computer registered?

    If your two activation are in use you need to call Adobe. Install CS3 to to point of activation and call Adobe at that point.  They have help me in cases like your My Disk crashed and I replaced it. Could not deactivate the crash activation.  I done that twice over the years I've been using  PS for around 20 years
    To see your key you need to click on the product in your Adobe products and services page.

  • Whats the easiest way to get data from R/3 from XI

    Hi there
    I would like to know if there is a way to to access a database table in the R/3 system in a user defined function in Message Mapping? I have to map some fields where I have to get data from a table. What would be the easiest way?
    Thanks,
    Jan

    This article provides details on the usage of Generic Lookup API used for calling RFC from user defined functions.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439
    RFC Lookup.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439

  • What is the ABSOLUTE FASTEST way to draw a point on a JFrame in Java?

    I am currently using:
    g.drawLine(x,y,x,y);with g being a Graphics object. Is there any faster way to draw a point in Java?

    Uh, I was asking if there was another way...
    fillrect/drawrect are the only other ways to do it
    lol... and I've tried Graphics2D.How about drawOval or drawPolygon (doubt that)?
    >
    I was wondering if there was maybe another class/set
    of functions... etc?You could drop down to some native library like DirectX or OpenGL or some such, but I don't know of any other way to paint the screen with Java. (but then, I'm certainly not a "screen painting" sorta guy, so take that for what it's worth)

  • Whats the easiest way to transport large files from my old laptop to my new ipad?

    can anyone tell me the easiest way or what app i need to transport file from my old lad top to my new ipad? im really not technical so the easiest way would be appreciated :)

    1. Install Dropbox on computer
    2. Copy all files to Dropbox in computer
    3. Install Dropbox on iPad; all files will be waiting for you there
    Note: you need a fast internet connection

  • Whats the easiest way to transfer pics from my SD car to my mac

    I am upgrading from an LG Revolution droid to an iPhone shortly and would like to know if anybody knows what the quickest easiest way would be to transfer all the pictures on my SD card onto my apple computer. I would love it if they could go directly into iphoto but am not sure if thats an option. Any help would be greatly appreciated

    Just plug it in using the USB cord, find the phone storage on your computer (it will show up as a removable drive), then drag and drop.

  • Whats the easiest way to put a thin line around an image?

    Can anyone tell me the easiest way to put a thin line around
    an image? I'm also interested in the use of thin lines as part of
    the graphic design on a page, how are they generated?
    Thanks

    .oO(cdeatherage)
    >In Dreamweaver, you can set a border for each image but
    be aware that some
    >versions of some browsers may not display it.
    This shouldn't be an issue in any used browser today.
    >If it is a consistent look you're
    >after, I'd say the most permanent thing to do would be to
    edit the image in
    >Photoshop or Fireworks. In Photoshop, e.g, I'd create a
    background fill with
    >the color I wanted the border, then add the image,
    centered, in a new layer on
    >top of that. Merge the layers, then save optimized for
    the web.
    Way too complicated. If you want to change the color or style
    of the
    border, you have to modify the image. With CSS you can
    directly change
    the line style in a much easier and faster way.
    Micha

  • Whats the easiest way to wipe my g4 powerbook before selling?

    im wishing to sell my g4 powerbook after upgrading very quickly and wish to erase all data properly. i have no install disc so cannot do it this way nor do i have a firewall connection cable as ive read on a few discussions already, is there an easier alternative? i thought about deleting everything manually but i'm afraid i may miss things and this would take up alot of time also.
    thanks in advance and much appreciated!

    Follow these instructions step by step to prepare a Mac for sale:
    Step One - Back up your data:
           A. If you have any Virtual PCs shut them down. They cannot be in their "fast saved" state. They must be shut down from inside Windows.
           B. Clone to an external drive using using Carbon Copy Cloner.
              1. Open Carbon Copy Cloner.
              2. Select the Source volume from the Select a source drop down menu on the left side.
              3. Select the Destination volume from the Select a destination drop down menu on the right
                  side.
              4. Click on the Clone button. If you are prompted about creating a clone of the Recovery HD be
                  sure to opt for that.
                   Destination means a freshly erased external backup drive. Source means the internal
                   startup drive.
    Step Two - Prepare the machine for the new buyer:
              1. De-authorize the computer in iTunes! De-authorize both iTunes and Audible accounts.
              2, Remove any Open Firmware passwords or Firmware passwords.
              3. Turn the brightness full up and volume nearly so.
              4. Turn off File Vault, if enabled.
              5. Disable iCloud, if enabled: See.What to do with iCloud before selling your computer
    Step Three - Install a fresh OS:
         A. Snow Leopard and earlier versions of OS X
              1. Insert the original OS X install CD/DVD that came with your computer.
              2. Restart the computer while holding down the C key to boot from the CD/DVD.
              3. Select Disk Utility from the Utilities menu; repartition and reformat the internal hard drive.
                  Optionally, click on the Security button and set the Zero Data option to one-pass.
              4. Install OS X.
              5. Upon completion DO NOT restart the computer.
              6. Shutdown the computer.
         B. Lion and Mountain Lion (if pre-installed on the computer at purchase*)
             Note: You will need an active Internet connection. I suggest using Ethernet if possible because
                       it is three times faster than wireless.
              1. Restart the computer while holding down the COMMAND and R keys until the Mac OS X
                  Utilities window appears.
              2. Select Disk Utility from the Mac OS X Utilities window and click on the Continue button.
              3. After DU loads select your startup volume (usually Macintosh HD) from the left side list. Click
                  on the Erase tab in the DU main window.
              4. Set the format type to Mac OS Extended (Journaled.) Optionally, click on the Security button
                  and set the Zero Data option to one-pass.
              5. Click on the Erase button and wait until the process has completed.
              6. Quit DU and return to the Mac OS X Utilities window.
              7. Select Reinstall Lion/Mountain Lion and click on the Install button.
              8. Upon completion shutdown the computer.
    *If your computer came with Lion or Mountain Lion pre-installed then you are entitled to transfer your license once. If you If your computer came with Lion or Mountain Lion pre-installed then you are entitled to transfer your license once. If you purchased Lion or Mountain Lion from the App Store then you cannot transfer your license to another party. In the case of the latter you should install the original version of OS X that came with your computer. If this is not possible then simply erase the drive. You need to repartition the hard drive as well as reformat it; this will assure that the Recovery HD partition is removed. See Step Three above. You may verify these requirements by reviewing your OS X Software License.

  • Simplest way to support dual monitor with HP 2570P

    Hi,
    I would like to be able to use my dual monitors with my HP 2570P. I do not yet have a docking station. 
    What is the simplest way to support dual monitor display with my  HP 2570P ? 
    I'm not looking for mirror i am looking for an extended desktop. I can live with out the laptop display if required.
    I know there was a previous post about the 2540 but I'm not sure if the outcome applied to 2570p too.
    thanks
    Richard. 

    There is no truly simple way except use of a docking station. 
    You can use the VGA port or the display port. None of the manuals I have seen assert that you can use them both simultaneously. 
    There is no a previous post about the 2540 in regards to using a dual external display setup in the forum that I have seen. 
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • Whats the BEST Deployment Practice for appsTier (2 Node) with RAC Database

    Hi All,
    Whats the BEST Deployment Practice for appsTier on Shared APPL_TOP between two application tier Nodes and a RAC Database.
    Regards
    Satish

    Satish,
    Could you elaborate; are you looking for how to distribute the tiers(forms, web, conc., etc.); are you asking about PCP (parallelt concurrent processing)..
    Regards,

  • Whats the easiest way to share iTunes library between two accounts

    Hi all
    I have my account in leopard that has my entire music collection. I have just created a new account for my wife and would like her to have access to my library, having said that, I like my play lists and it would be ideal for her to have her own.
    Any idea's on how to archive this

    Move it from the Music folder of your home folder on the iMac to the same location on the MacBook Air; this can be done through target disk mode, or an external drive, or file sharing over a network. iTunes Store authorization won't automatically transfer, and any rented movies moved in this way won't play on the MacBook Air.
    (81739)

Maybe you are looking for

  • How to connect my G4 to wifi using airport card

    I have power mac G4 0SX 10.3.9   just put airport card in,,, it can find my wifi network, but when I put in the password to activate the connection,,, I get  "error joining the airport  network..... ......

  • How can I make .PDF files not display inline in an Outgoing mail?

    I want Mail to NOT display PDF files in outgoing messages. It will keep the icon placeholder if it's more than two pages, but not for one page PDFs. How can I stop this? It makes formatting kind of difficult. Thanks

  • Macbook drag and drop different that magic trackpad ?

    Dear friends, I have been using a Magic Trackpad with my 27" iMac  for a long time and have it configured so that a slight single finger tap then enables the dragging of the current window or selection. On my new rMBP I can achieve this only by click

  • Mavericks and Dual Display not working as documented

    Hi all. Ok..something a little wierder here for my dual display scenario. I have two Samsung Syncmaster 2443 monitors. 15" MBP Retina purchased this year. Running in Clamshell Mode. I can get dual monitors happening (extended) but I cannot get the me

  • PUSHBUTTON  IN ALV TREE

    Hi all, When I create a ALV  TREE output with cl_gui_alv_tree, during output display I want a pushbutton to be displayed BEFORE each row.The row should not be editable.When I select the button, the whole row should be selected. What extra code should