What is the best way to use images?

I need to be able to load an image and set it's size. I am going to let the user pick what picture they want and I need to be able to use any size picture and make it smaller so that it will only be as big as I set it to be.

Here a brief piece of code to help to resize your Images:
public void showAnyImage(URL url)
Image anImg = new anImage(url);
img = anImg.getImage();
MediaTracker mt = new MediaTracker(this);
mt.addImage(img, 0);
try {
//waiting for fully upload
mt.waitForAll();
} catch (InterruptedException e) {
//do something with your error
repaint();
// now you could scale the size like this
img = img.getScaledInstance(img.getWidth(this), img.getHeight(this), 0);
// or to make it 200 pxls smaller (vertic. and horizont.)
img = img.getScaledInstance(getWidth()-200, getHeight()-200, 0);
repaint();
public void paint(Graphics g)
if (img != null) {
g.drawImage(img,100,100,this);
Hope it helps

Similar Messages

  • What is the best way to use a cellular enabled iPad in France?

    What is the best way to use a cellular enabled iPad in France?

    Frankly, I expect a bit more courtesy and details from someone wanting help from fellow users.
    Don't use your AT&T SIM/plan out of the country for the iPad.
    Just purchase a SIM in France for about 15 euros and use that.
    -> http://www.tripadvisor.com/ShowTopic-g187070-i12-k4781004-o30-Prepaid_French_3G_ micro_SIM_for_iPad_it_s_not_a_problem-France.html

  • What's the best way to use your iPad instead of textbooks?

    What's the best way to use your iPad instead of textbooks? I'm about to start a BSN program and have heard of using your iPad for textbooks instead of buying and carrying around 8 different books. Is there an app for that? Or do you buy or rent the books? What's the best solution?

    Or, if you're like me and you want to do a lot of heavy reading, use the iPad because the low contrast on a Kindle is extremely fatiguing.  
    Seriously, though "screen glare will cause eye strain" is often taken as an article of faith, there's not a lot of good scientific evidence for it. "Eye strain" can be caused by concentrating on any close work for long periods of time. Looking up and focusing on something distant periodically is very helpful. Older CRT screens that flicker also can be aggravting. I'm not denying that some people find reading backlit screens uncomfortable. However, it's not dangerous. And, then, there are other people who find the higher contrast a backlit screen affords to be much less wearying over long periods of time.

  • What is the best  way for using a  C++ in the EJB?

    What is the best way for using C++ in the EJB ie
    either 1. Socket programming
    2. JNI

    To what purpose?
    To use C++ in the client you could generate IDL from your remote interfaces and run that through your vendor's IDL-to-C++ processor.

  • What is the best way to place image (with caption) in a Book?

    I am preparing a template for an Encyclopedia project, The Encyclopedia will be in more than 10000 pages, so what is the best way to place images (Photos, Graphs, illustration ...etc) with a caption?
    The problem that when I modify text; the image don’t move with it, and when I place it within the text, it's difficult to control text flow.
    Please Help

    Thank you Peter,
    it's a bit dificult to control anchored object -speacially in two colum text box- when placing image in one and half colum size, it wont move to first column.

  • What is the best way to use Berkeley DB, C or C++ interface ?

    Hello,
    I'm using C++ interface but much samples, solutions and utils are in C.
    What is the best way to use Berkeley DB, C or C++ interface ?
    Lets talk a little about this...which is the interface you prefer and why ?
    Thanks
    DelNeto

    Hi DelNeto,
    There is a complete documentation set for C, C++ and Java. There are also examples in all 3 languages in the examples directories in your kit.
    http://www.oracle.com/technology/documentation/berkeley-db/db/index.html
    Ron

  • What is the best way to use recovery files

    I am working in FM 11 and have crashed FM a few times. What is the best way to use the recovery files and save them as the normal file? Then should I filter an explorer window for "recovery" so FM won't keep asking me if I want to use older recovery files? Thanks for your help.

    > What is the best way to use the recovery files ...
    Use a .recover file to extract only the new/changed content that would otherwise be lost if you were instead to open the .auto (if any), or .backup files.
    > ... and save them as the normal file?
    Don't. If the document crashed because of an internal data structure problem, the .recover file (although actually a MIF) is apt to contain that problem.
    Before doing anything, preserve the debris. Copy the .backup and .auto files in particular, because as soon as you open the main .fm file, it's going to overwrite that .backup, and then the .auto at the next auto-save interval. You can dispose of any zero-length files or files with temporary names (which result from the crash itself crashing).
    I typically:
    preserve a snapshot of the debris
    open the original file, and if it won't, the .backup
    open the .recover, .auto or .backup (whichever seems the most useful candidate as a sourcing file)
    copy in the changes from the .recover, .auto or .backup to the working copy
    save the working copy as the original.fm, close the sourcing file
    do a MIF wash on the new original.fm
    clean up the debris in preparation for the next crash

  • What is the best way to use Airport Express?

    What is the best way to use Airport Express?

    It would really depend on your networking goals.
    The AirPort Express can be used for a number of things:
    Internet router
    Wireless Access Point
    Ethernet switch
    Wireless Ethernet bridge
    Network print server
    AirPlay speaker
    Portable travel router
    ... or some combination of the above.

  • What is the best way to use wi-fi to transfer pdf files from an ipad to a mac mini, not using an internet, just wi-fi.

    What is the best way to use wi-fi to transfer pdf files from an ipad to a mac mini, not using an internet, just wi-fi?

    If the Mac use Lion (10.7) you can use Airdrop for that.
    With Mac's not using Lion you may set up a computer to computer (ad hoc) connection.
    How to --> http://docs.info.apple.com/article.html?path=Mac/10.6/en/8339.html
    Lupunus

  • What is the best way to use a SSD for Photoshop/photo editing?

    Computer hardware newbie here: I do a significant amount of photo editing work and for a very long time I've experienced Photoshop, Bridge and Photomatix crashing constantly (usually due to insufficient RAM) or just generally taking forever (Bridge took forever to load the thumbnail/preview extractions in a folder full of images, Photoshop took forever to save images and Photomatix took ages to load/merge a set of bracketed photos).  Here are the typical error messages I'd get: http://pastebin.com/J9byczse
    As a professional photographer, constantly running into that sort of thing is quite aggravating, so to hopefully avoid ever having to deal with that again I invested in a new custom built computer.  It's Windows 7 Professional 64 bit with 32GB of RAM and a 240GB SSD; I'm using the 240GB SSD as my boot drive/OS, all of my programs are installed there, and the page file.  My photos and data are stored on several HDDs.  I have yet to install any of my photo editing software (Photoshop CS6 Extended, Lightroom, Photomatix etc) to the new computer yet since I'd like some advice first.
    My basic question is this: what is the best way to take advantage of the SSD (and the computer in general) when it comes to my photo editing software?
    Specifically...
    1. If I have a folder of photos I'm working on, should I move it to the SSD and then work on them from there in order to take advantage of the speed of the SSD?  Would this make any difference in terms of speed if the photos are located on the SSD vs. an internal/external HDD?
    2. Most of what I've read online seems to recommend two separate SSDs, one for installing/booting the apps and one for cache/scratch.  Does it matter if I use my 240GB SSD for both?
    3. This is a fairly new computer and the SSD is already almost half full (102GB used, 120GB free) *WITHOUT* any of my photo editing software installed yet.  I'm concerned about how fast that remaining 120 GB may fill up.  As it fills up will I lose the speed advantage of the SSD vs. a regular HDD?
    4. Sort of similar to #3, but should I bother moving any of my other non-photo editing programs/caches off of the SSD to a HDD and would there be any major difference in the speed/lifespan of the SSD if I did so?  It's mostly Firefox and Chrome and their caches that I'm concerned may be a problem if they remain on the SSD.
    Thanks for any help!

    If you have an SSD you can run the cache and programs on the same drive.  However, many recommend a scratch disk size of 100-200 gigs so that will not work here unless you opt for a larger SSD.  Otherwise an internal spinner is recommended that does not contain the program files, or idealy any other files that may want to get acessed at same time (only one read/write head per drive).
    With 32 gig of RAM you may not need the constant use of the scratch drive unless working on large images with lots of layers.  So see no advantage to moving folder to SSD for temp work environment.
    From what I read the new crop of SSD do not have the wear problems of the older versions.

  • What is the best way to use single shot drum sounds?

    I have a huge collection of wav. format single sound drum sounds that I use in FL Studio. What is the best way to program drums in GB using them besides buying iDrum? I like the flexibility of using drums from different kits when I make my music so I kind of get board using a preset drum kit from GB even layering 3-4 kits isn't as nice as choosing each individual drum sound.

    Would be great to have more info but on a 24fps timeline with 24fps footage, you can simply right click and change the speed/duration to whatever. It'll be more jittery than smooth 60fps slow-mo. If your footage is shot at 60fps and you are editing on a 24fps timeline, just select the clip and right-click and choose MODIFY>Interpret footage and change the fps to 23.976 and you're done. Now when you drop that clip on the timeline it's in smooth slow-mo. Or, you can just toss the original clip on the timeline and change the speed/duration setting to 40%. Pretty much the same thing although the former is better if you need to add any warp stabilization to the clip. Anything you want to speed back up you can either duplicate the clip in the project panel and change it back to the original frame rate OR you can simply adjust it on the timeline to 250% speed which is back to normal. Good luck!

  • What is the best way to use EJB modules with JAX-WS?

    Hi.
    I am doing a project that returns EAN13 encoded data to external java clients.
    I think I need to use a webservice that send response, a webservice client that send the request, and other project that transforms a data to an EAN encoded data, returns it and store it in MySql database.
    It is possible that I need to authenticate users for every request made.
    -I have created a EJB module contained into Glassfish for the webservice
    -I have created a Common Java project with 3 layers: Entities, bussines and data access layer for mysql database
    -I have a project for the webservice client with JAX-WS ( is the best choice? or Would be better JAX-RPC? )
    **How would you suggest me create the structure of the project with all the java power?*
    **Could you help me with goods tutorial of design patterns about webservices using EJB and the best way for use databases for this kind of projects ( I have heard about JNDI, Hibernate, Session EJB, ... )?*
    **Would be better use other EJB module instead of a Common java project that has classes?*
    h3. {color:#333399}I shall be pleased with your help{color}

    Kappy is dead on correct about Bridge Mode as a requirement for the Time Capsule.
    Do you know how to check to see if the Time Capsule is configured this way?
    Next question.....you really should not try to have two wireless networks....one Arris and another Time Capsule.....unless it is absolutely necessary. Two wireless routers in close proximity can create wireless interference effects that can cause problems with either...or both...networks.
    Best to turn off the wireless on one router to keep the chances of wireless interference between routers minimized.
    Are both the Arris and Time Capsule providing wireless signals?

  • 1163R... What is the best way to use the 1163R.

    I need to record voltage on the SCXI 1121 as soon as the 1163R is switched. What is the best way to do this.

    Hi,
    You may want to take a look at following:
    Link 1
    Link 2
    I know my answer is very general. You may want to elaborate on your question and I will try my best.
    Sincerely,
    Sastry

  • What is the best way to display image ??

    hi my questions is unusual, there are so many ways to display images.
    I m developing image processing s/w can any one suggest me which would be the best way to display image on which i can perform image operations.
    like in JPanel, icon, trhough paint() or anything else...
    thank you..In advance

    hi man... i think so imaging is better with JAI(Java Advanced Imaging) .... is perfect for display in jcomponent like JPanel or JLabel, you have to replace the paintComponent().
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Rectangle;
    import java.awt.geom.AffineTransform;
    import javax.media.jai.PlanarImage;
    import javax.swing.JComponent;
    class ImagePanel extends JComponent {
         protected PlanarImage image1;
         protected AffineTransform atx= new AffineTransform();
         protected int width, heigth;
         public ImagePanel() {
         public ImagePanel(PlanarImage i) {
              image1= i;
              width= i.getWidth();
              heigth= i.getHeight();
         public void paintComponent(Graphics gc) {
              Graphics2D g= (Graphics2D)gc;
              Rectangle rect= this.getBounds();
              if ((width != rect.width) || (heigth != rect.height)) {
                   double magx= rect.width / (double)width;
                   double magy= rect.height / (double)heigth;
                   atx.setToScale(magx, magy);
              if (image1 != null)
                   g.drawRenderedImage(image1, atx);
    if you need more info, ask about JAI api and docs

  • What is the best way to preview Images

    I'm trying to figure out if Lightroom is the best software for the first part of my workflow and if so, how to do it.
    When I import images, I copy them to my hard drive and at the same time to my backup drive. Before doing that, I want a good preview of the images and get rid of garbage that I don't even want to back up.
    To do anything with images in LR, you have to import them first. Since I shoot in Raw, I'm limited in my choice for viewing the images first. Sometimes, I will start Bridge and use my normal rating system on the cards and delete garbage before importing into LR. My problem with this is that Bridge is slow and the reason I moved to LR in the beginning, Also, I'd rather keep my workflow within as few pieces of software as possible. (My opinion is that LR should come with CS and demote Briidge to Elements, but that's a different thread.
    I'm looking at another software for sorting and rating, but again, this is more expense and overhead on something LR should be able to do.
    Anyway, I am looking for the best way to get this done in LR, or alternatives that others are using.
    Thanks

    The much maligned import module in the LR3 beta will do what you want.  You can view the images on your card in loupe view and decide which ones to import.  It is not grease lightning, but not bad on my PC.
    Rory

Maybe you are looking for

  • Tiger (10.4.11) upgrading to Snow Leopard (10.6) without iLife/iWork

    Hi Guys! I have just recently ordered Snow Leopard from apple to upgrade my iMac to 10.6 due to my new ipod and Iphone being unable to sync with iTunes. Now after ordering i have run into a few worries, -the first being that i am currently running Ti

  • Difference between AP Operational Status and Registered Controller

    When reviewing the AP Details page in Prime there are two fields I'm not sure what they mean specifically: 1) Operational Status - Registered 2) Registered Controller - Not Associated Any clarity or document references would be greatly appreciated.  

  • JSF Problem invoking backing bean method

    I want a backing bean method to be invoked when the submit button is clicked but for some strange reason the method is not getting invoked any Help in this regards would be great. I am able to properly get the values from database and display on the

  • Where did my Photo Booth go??

    I was using photo booth in combination with iMovie and tried to open photo booth from the dock and when I clicked on the application icon it did not bounce up and down like they normally do - a question mark appeared within the icon and it would not

  • Periodic lot Size

    Dear Expert, I working with Period lot size "W" with No. Of period 1 and the Period factor 1 I maintain this setting in Both location production Plant & Distribution Center I have Demand from Distribution Center 2014, when i  run SNP Heuristic and af