Capturing the raster of Swing components without actually displaying them?

My goal is to be able to create an Image/BufferedImage that represents the image of Swing components. Now one solution would be to display the component, take a printscrn of it, and cut the resulting image down so that it only contains the area that the component takes up. However, this requires the component to be displayed to the screen.
Looking for a solution, I found createImage() in java.awt.Component. I tried that, and got a null image. Going back to the javadocs, I found that the component had to be displayable, which was defined as being visible or packed. I tried inserting the component into a JFrame, packed the frame, and then called createImage, only to get a blank Image. I've also tried displaying the JFrame, calling createImage, and displaying the image, but I've had no luck.
To display the Images, I've been encapsulating them in ImageIcons and displaying those.
Any ideas pertaining to a good solution?

How would I go about doing that? I'm looking through
the API, but I can't find anything relevant.If you direcytly want to create Image object .. then check.. this... and see my last posting of Brio.java
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=711032
Note: use setVisible(true);
before creating buffer = createImage(...) else U will get null Image..
U can also make a BufferedImage like..
BufferedImage buffer = new BufferedImage(200, 200, BufferedImage.TYPE_3BYTE_BGR);
Graphics g = buffer.getGraphics();
g.setColor(new Color(255, 0, 255));
g.drawImage(img, x, y, null);
g.fillRect(200,200);
g.dispose();

Similar Messages

  • Is there any way I can view / remove pictures from Camera Roll on the iPhone, on a Mac, without actually importing the files?

    Is there any way I can view / remove pictures from Camera Roll on the iPhone, on a Mac, without actually importing the files? I just want to view / delete files without importing them.
    For instance I have 1200 photos on my iPhone Camera Roll. Some of these are shots, that I've taken multiple times, some good, some bad. I just want to clean up my Camera Roll, but going through the pictures on the iPhone's small screen is tedious. I'd much rather look at the camera roll's photo's on my Mac, and then decide which files I'd like to keep, and which to delete.
    I don't want to import the files, as when I import the files, and delete them from Camera Roll, now the Photo's are not on my phone, and the only way to get them back on my Phone is to Import them back in using iTunes, and then they go into the Picture Library and not the Camera Roll.
    In the same way as I can view Pics from my digital camera's SD card on a Mac without having to actually copy them to my computer, is there any app out there that will let me view my iPhone pics without importing them.

    gsharp01 wrote:
    Is there any way I can view / remove pictures from Camera Roll on the iPhone, on a Mac, without actually importing the files? I just want to view / delete files without importing them.
    The short answer is yes.
    Connect your iPhone to your computer.
    Open Image Capture application.
    Click on the 4 little squares at bottom to view them as photos, not a list.
    Select the photos them click the No Entry icon at bottom to delete.

  • Swing components without using applets

    hi there
    can i display swing components on the browser without using applets through jsp.
    if the answer is yes.please help me by sending a sample code.thanking u.
    -radhakrishna

    A JSP is compiled into a (server-side, obviously) servlet, which responds to Http requests by constructing a String of HTML/JavaScript etc to send back to the browser which then displays it.
    A Swing component is a piece of Java. The only way for such a component to run on the client side is to use either Applets or the new Java WebStart technology (see the JDC), which allows you to run a Java App locally from a Web Browser.
    You cannot possible use JSP to view Swing Components, without also using either of the above.

  • How to improve the Performance of Swing Components

    Hi
    I have developed a GUI Framework with Swing components. I observed that when number of components are more, the GUI is slow. Could anybody suggest me the ways to improve the performance of Swing Components
    Thanks

    Hi There - I haven't found issues so far with the speed of the GUI building, it seems fast when compared with .NET applications
    Are you doing any database querying on form load? This can slow down the loading of the GUI, I use persistence in an application and before the GUI is shown the persistence unit logs in to the database and registers itself - it does take 2/3 seconds to register and complete whatever it does before the form builds and shows
    Also check if you are loading/using any network based files on form load, this can also slow down the building considerably as well. Apart from that it's hard to say where your issue may lie apart from removing controls and checking build speed until you find the one that's slowing it down (not a good approach though) I sometimes had to load csv files from a network drive and if the file server is slow or LAN speed isn't great this can also cause a delay, hope you find it.....

  • Does MB5L capture the data if goods movement without accounting document

    Dear Guru,
    Can you please advice me if the transaction MB5L capture the data for those goods movement without accounting document?
    Thanks and Regards,
    CW

    Since MB5L captures based on the material and valuation area, still you can see the postings that has been made non-valuated.

  • NuVo N200 and browsing files, without actually playing them

    I'm not sure if there was any answer to that question in any previous thread, I did a search on N200 and there's so many results, checked a few of them but couldnt find anything.
    The most frustrating thing for me at the moment with my N200, which I think overall is a very good player, is that there's no way to browse directories and files without playing them. That's a BIG handicap. I got a directory with about 00 MP3s, misc songs, and it takes forever to skip to a specific song because the player actually tries to load the tune play it every time you go to the next. What would be great and almost necessary is a browse feature that allows you to skip over directories and files, while the player is still playing the current tune, and then will play the new song when selected.
    Also, a STOP menu feature, which would be one of the first icons when loading up the menu, would also be very important. Sometimes you don't want to shutdown the player, just stop it for a few seconds.
    Is there anyone else with the same wishes? Any possbility of a firmware upgrade someday?

    Oh... on my MuVo nx I can do what you propose! The trick is to PAUSE the current track. Unfortunately, it's not possible to browse WHILE a current track is playing without interrupting it. I agree.. a firmware upgrade ought to be entirely possible! I too would like the ability to "look around" at the song collection while a tune is still being played in the background. I never really explored the functionality of any of the other flash-based portable mp3 devices before I settled on this one. I mearly jumped on getting this 256meg version when a supplier informed me that Creative had a 2 or 3-week promotional price on it. At Under $20 cdn about 2 months ago it was hard to pass up!
    I wonder if the Muvo C00 would have been a better choice (but I don't like its "round" design). The C00 seems to have a larger display (which I like).
    I guess we would have to download the User Manuals of all the devices we're interested in inorder to learn if a certain feature or function is available?

  • Here is the code, only swing components behave badly, awt components seemok

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import java.lang.*;
    public class gui extends JPanel{
    String[] infochoice = {"Postcode","Locality","State","BSP"};
    JComboBox infowanted;
    JLabel lab;
    Choice cho;
    public static JButton quit;
    public gui(){
    infowanted = new JComboBox(infochoice);
    infowanted.setEditable(false);
    infowanted.setSelectedIndex(0);
    infowanted.setEnabled(true);
    lab = new JLabel("Select one");
    lab.setText("<html><font color=blue> Please select one</font></html>");
    cho = new Choice();
    cho.add("Postcode");
    cho.add("Locality");
    cho.add("State");
    cho.add("BSP");
    quit = new JButton("QUIT");
         ActionListener actlist = new ActionListener(){
    public void actionPerformed(ActionEvent e){
    if(e.getSource() == quit) {
         System.exit(0);
    add(lab);
    //add(infowanted);
    add(cho);
    add(quit);
    public static void main (String args[]) {
    String feel = UIManager.getSystemLookAndFeelClassName();
    try{
    UIManager.setLookAndFeel(feel);
    catch (Exception e){
    System.err.println(e);
    JFrame frame = new JFrame("Kyri");
    JPanel panel = new gui();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(panel);
    frame.pack();
    frame.setVisible(true);
    frame.setSize(300,100);

    So for me... and by the way, what is your problem ?
    NOTE: Did you read about NOT mixing AWT and SWING ?...

  • Swings components are not displayed correctly Pls Help me Urgent.

    Hi
    I had created a project contains a form divided into 3 panels (horizontally) Upper most contains images and the middle one contain 6 buttons and lower most contains components like text box, labels etc.,
    When i pressing the first button (e.g. Find) the lower most panel should be displayed with contents., but when i press the second button (e.g., Display) then i can't get the windows components correctly., i.e., the second window will display the first window components + the second window component and it cannot be displayed correctly how can i avoid this problem
    Please help me it is ver urgent

    Hi
    I had developed a project contains a form divided into
    3 panels (horizontally) Upper most contains images
    and the middle one contain 6 buttons and lower most
    contains components like text box, labels etc.,
    When i pressing the first button (e.g. Find) the
    lower most panel should be displayed with contents.,
    but when i press the second button (e.g., Display)
    then i can't get the windows components correctly.,
    i.e., the second window will display the first window
    components + the second window component and it
    cannot be displayed correctly how can i avoid this
    problem
    Please help me it is ver urgentMessage was edited by:
    muthu2007

  • How do I view PDF files on a website without actually downloading them?

    Whenever I encounter a PDF document on a website, it always downloads to my computer when I view it. Consequently I am getting left with all these documents that have been downloaded to my computer that I don't want to save, only look at once. It is a real pain to have to go back and delete all these files, some of which have obsure nondescriptive names, after I am done. How do I view but NOT download??

    When you tap on the PDF link, the file should open directly on the screen while you are in Safari. You can then tap on - Open In - in the upper right corner of the PDF. Then tap on Open In and select your PDF app from the pop up.
    If you do not see the Open In button, just tap on the open PDF somewhere and that will make the button reappear for a few seconds.

  • Changes taking place in BWD Infoobjects without actually changing them.

    Dear Experts
    We have have made certain changes ( like making them Authorization Relevent or Unit conversion ) in the Standard Infoobjects like in 0Material l, 0Plant, 0Bus_area etc. and tranported them to BWQ and BWP. Few days back I noticed that all these changes has been missing from these objects on BWD and the they are available in their standard form. We have not made any changes in these Infoobjects then how come the changes made by us earlier has been overwritten by std. form. We are not been able to Understand that which activity is the reason behind these changes.
    Pl. advice.
    Dinesh Sharma

    Hi,
      Any other user might installed the objects from business content. If the user don't select the match X while business content
    (already installed objects) installation those objects will be overwrite the existing objects.
      Please check the user name in infoobjects maintenance.
    Regards
    Prasad

  • Using the Time Machine backup files without re-storing them to original HD?

    Hi,
    I have 2 internal HDs that are not my main HD backed up through Time Machine. Ideally I would like to just use the data on the backup HDs but they are all locked. Is it simply a case of changing the Privileges in the 'get info' menue to Anyone can Read and Write?
    Thanks!

    You can't copy from TM because it is a network of aliases and compressed stuff. You have to work through its interface. You can restore, or you can restore.
    If you're looking for a bootable backup that you can drag folders/files from willy-nilly then look at SuperDuper or CarbonCopy Cloner.
    -mj

  • Is there a way to reset my apple security questions without actually knowing them?

    i recently purchased a new laptop but I can't buy anything on itunes until I enter my securituy questions. I never set these questions when I originally created my apple account so I do not know the answers. Is there any way to change them???

    The Three Best Alternatives for Security Questions and Rescue Mail
         1.  Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
         2.  Call Apple Support in your country: Customer Service: Contact Apple support.
         3.  Rescue email address and how to reset Apple ID security questions.
    A substitute for using the security questions is to use 2-step verification:
    Two-step verification FAQ Get answers to frequently asked questions about two-step verification for Apple ID.

  • Cannot add icloud account to Contacts so all my icloud contacts are stuck on the cloud and I can't actually get them on my desktop imac

    So all my devices have my contacts on them from my icloud account.  However on my desktop imac when I go to the Contact application there are none in there.  When I go to the preferences for contacts and try to add the icloud account I get through the login process of user account and password but then nothing else happens, no contacts get added to the imac.  Hmmm.  Now what?

    Yes that is all correct.  Now, I think I know why it isn't working, I just don't know how to fix it.  Several years ago before icloud really was up and going I used dropbox to sync my contacts between my computers.  I suspect that is the problem.  WHen I open Contacts in Maverick on my imac it knows there are vcards somewhere and asks if I want to add them.  I click yes but then it sits there and does nothing.  There is no "Library" file that I can find in Maverick to move that old address book file back to the application support file.  That's what I have to figure out.

  • Taking off songs without actually taking them off

    I updated iTunes not too long ago and before I was able to uncheck the songs I didn't feel like listening to at the time, but I still wanted them on my computer. But with the updated iTunes, it will allow me to uncheck them, but the unchecked songs still appear on my iPod. Am I doing anything wrong?

    If I am understanding you correctly simply set up your iPod to update automatically then what is in your library will be on your iPod. And if you delete a song from your library/iPod it will be deleted from both locations.
    You could set up your iPod to update manually under iTunes, File, Preferences, iPod (have it connected).
    You can check or uncheck all songs by putting your cursor over one of the check boxes, hold the CTRL key (windows) and left click to select or deselect all boxes.
    You can also highlight all songs or just the checked ones and right click and choose Check or Uncheck Selections.
    Let us know if this helps.

  • Text with the letters of NO and TM sometimes display them as superscript.

    On some web pages, words that start with the letters NO or include TM have part of the word displayed as superscripted. For example, if the sentance starts with the word None, then the No part of the word has the o raised and underlined like it is an abbreviation for the word number. A part number like STM32F103 will have the letters TM raised as if it were an abbreviation for the word trademark.
    I've tried setting different fonts, and found that specifically setting a font while not allowing the site to override it avoids the problem. Unfortunately some sites use characters that I just can't identify, so I normally run with the option to allow pages to choose their own fonts, instead of using fixed fonts.
    On ebay, for one example, I have the problem with the superscripted characters. I've tried using Google Chrome as a comparison, and have found that the pages display correctly with Chrome but not with Firefox. Doing a Google or Yahoo search gives me a results page that does not have the superscripted characters.
    Is there something I am missing in the configuration of Firefox that is causing this? I kind of need the sites to select their own fonts, because otherwise I end up with some very odd looking pages (even stranger than having NO or TM displayed wrong).

    Using the inspector helped. What it showed me was that the Nimbus Sans L font was being used. While I had that font in the default/Type1 directory of /usr/share/fonts, it turns out that I also had a copy of that font (from somewhere) in my local ~/.fonts directory. Deleting the extra copy of the font corrected that problem.
    To help me with that I used the fc-list utility and grepped it to the Nimbus font. It pointed me to the local .fonts directory for that specific font. All other fonts appeared in the /usr/share/fonts directory. I didn't even realize I had setup a local font back in 2012...
    Thank you for pointing out to use the inspector. It gave me the information to duplicate the font problem with both Thunderbird and Libre Writer.

Maybe you are looking for

  • Web Service  - ESR

    Bom dia. Necessito fazer duas integração (no Xi e no PI) com as seguintes configurações: <-----(RFC) - <---(WS)--->  integração no cliente A. <-----(RFC) - <---(WS)--->  integração no cliente B. Sendo que a RFC é a mesma nos dois clientes e o também.

  • IMP-00008: unrecognized statement in the export file, oracle 11gr2 on redhat 5

    I am using Oracle 11g R2 on Radhat 5 linux to import(imp) a dmp file with a table with blob data type. I got the following errors with binary non-ascii on the screen and failed imp at that table: IMP-00008: unrecognized statement in the export file:

  • Sparks when plugging in a USB plug

    I removed a USB plug from the back of my iMac to allow me to plug in my Camera USB card reader, and as the metal part of each plug touched the metal case of the iMac, there were several small sparks. My machine is connected to Earth via the mains plu

  • How to Flag Customers in Customer Master (in SD)

    Hi, I've read a few earlier posts regarding customer master and since I could not find an answer for my query I am posting it here. I have a question regarding the customer master in SD: Is there a way to Flag Customers for reporting purposes in Cust

  • Launchpad doesn't show OS Apps (Mail, iCal, iDVD, etc) in first window. Reloaded from OS App CD - no change. 27"iMac i7 mid 2010

    I downloaded Lion, but the OS Apps don't show in the first window of Launchpad. I reloaded the apps from the App CD, but no change. Reset parameter RAM and repaired disk permissions - no luck. The other apps I've added do show Word, Excel, Filemaker