Transform JTable in Image

Hi,
How can I tranform a JTable to a Image?Is it possible?
I want to draw it in a PDF file

you could make an image out of it by using the robot class like:
import com.sun.image.codec.jpeg.*;
public class ScreenCapture
final BufferedImage screenShot;
//  Method used to snap the shot
public ScreenCapture()throws Exception{
Robot robot = new Robot();
final String tessst  = "test.jpg";
screenShot = robot.createScreenCapture(new Rectangle(frame.x, frame.y, 359, 272));     
saveImageAsJPEG(screenShot,10000000,tessst);
//  Method used to save the image as a jpg file
public static void saveImageAsJPEG(BufferedImage bi, float quality, String filename)
try {      
  ByteArrayOutputStream boutstream = new ByteArrayOutputStream();   
  JPEGImageEncoder enc = JPEGCodec.createJPEGEncoder(boutstream);  
  JPEGEncodeParam enparam = JPEGCodec.getDefaultJPEGEncodeParam(bi); 
  enparam.setQuality(quality, true);  
  enc.encode(bi, enparam);
  FileOutputStream fimage = new FileOutputStream(new File(filename));
  boutstream.writeTo(fimage); 
  fimage.close();
  catch (Exception e) {
  System.out.println(e); }
}

Similar Messages

  • Apply same Perspective transform to multiple images ?

    Hi guys ... I have a set of images, and I want to apply the same Perspective Transform to all the images. Note that all images have the exact same size, meaning that after apply the same Perspective Transform, they should all still have the exact same size.
    For example, here is the transform I want:
    From this:
    To this:
    Problem is that when I manually apply the transform to each image individually, they don't have the *exact* same size afterwards.
    Isn't there a way that I can just apply the transform to one image, and then that transform is applied on the other images ? I think I can use the Smart Object functionality here, but I don't have any experience on that.

    Hi,
    Recording an action might work if the images are the same pixel dimensions.
    more about actions:
    http://blog.epicedits.com/2008/03/07/how-to-create-photoshop-actions/
    http://morris-photographics.com/photoshop/tutorials/actions.html
    http://help.adobe.com/en_US/photoshop/cs/using/WSfd1234e1c4b69f30ea53e41001031ab64-7448a.h tml

  • 2D Fourier Transform of an image to remove grating

    I'm trying to remove a grating that has been added to my image:
    My plan is to perform a 2D Fourier transform of the image. The grating will come up as a block signal, so that's an infinite series of frequency, growing weaker as it goes to higher and higher components. So I want to block those frequences whilst at the same time preserving my image as much as possible (I know this is kinda contradictory).
    Unfortunately, I am failing at the first step: transforming it to the Fourier domain. This is my code:
    When I try to run it I get this error.
    Anyone have any ideas to fix this?
    Attachments:
    Fouriertransform.vi ‏12 KB

    Hi Choisai,
    I found a Knowledge Base that possibly will help you, check the following link: http://digital.ni.com/public.nsf/allkb/12039EFD213​AD08086257B6E0030FDC6?OpenDocument
    One more thing.. I do not see anywhere assigned path to get the image, which in future will throw an error for sure.
    Best,
    Bozhidar

  • How to print JTable to image file?

    Hi ppl.
    I have JTable that i can print via Printable to printer very well.
    Now I have a task to pass this JTable to MS Word. I can pass to MS Word any image file. So all I need is to "print" my JTable to image. Is it possible to reroute printing process to image file?
    Or any other ideas how to sovle a problem?

    John Bo wrote:
    Hi ppl.That words is 'people'. By leaving out three letters, you do not appear cool, just lazy & foolish.
    I have JTable that i can print via Printable to printer very well.
    Now I have a task to pass this JTable to MS Word. I can pass to MS Word any image file. So all I need is to "print" my JTable to image. Is it possible to reroute printing process to image file?Create a <tt>BufferedImage</tt> the same size as the <tt>JTable</tt>. Call <tt>createGraphics()</tt> on the <tt>BufferedImage</tt>. Pass the <tt>Graphics</tt> object to <tt>JTable.painComponent(Graphics)</tt>. Create an image of the <tt>BufferedImage</tt> by calling <tt>ImageIO.write()</tt>.

  • JTable to image?

    Hi all,
    I have an application that uses a JTable to display various data from our database. My problem is that I now need to display this same information via the web as an image. This is the requirement and no way around it. I didn't want to have to get into dynamically drawing everything using Java 2D, etc. So...Is there anyway that I can create the JTable from a Servlet and return the "image" in some format? I'm looking for a quick and simple approach. Any help would be greatly appreciated.
    Matt

    A component is not realized until you call either pack or setVisible on it.
    I've modified the demo to show this. Try it first with only the top and bottom buttons (ie,without the realize gui button) and next with the bottom two.
    Although the table will have a preferred size the component that will paint itself into the new BufferedImage does not yet exist so requests (in the saveComponentAsImage method) for its width and height return zero.
    If you replace the saveComponentAsImage method calls getWidth and getHeight with getPreferredSize().width and getPreferredSize().height you get a blank image, nobody home.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import java.net.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    public class TableToImage
        public static void main(String[] args)
            final JButton
                tableButton = new JButton("make table"),
                guiButton   = new JButton("realize gui"),
                saveButton  = new JButton("save");
            ActionListener l = new ActionListener()
                JTable table;
                public void actionPerformed(ActionEvent e)
                    JButton button = (JButton)e.getSource();
                    if(button == tableButton)
                        table = makeTable();
                    if(button == guiButton)
                        realizeGUI(table);
                    if(button == saveButton)
                        Dimension
                            size = table.getSize(),
                            preferredSize = table.getPreferredSize();
                        if(size.width == 0 || size.height == 0)
                            System.out.println("actual size: width = " + size.width + "\t" +
                                               "height = " + size.height + "\n" +
                                               "preferredSize: width = " +
                                                preferredSize.width + "\t" +
                                               "height = " + preferredSize.height);
                            return;             // avoid IllegalArgumentException
                        saveComponentAsImage(table);
            tableButton.addActionListener(l);
            guiButton.addActionListener(l);
            saveButton.addActionListener(l);
            JPanel northPanel = new JPanel();
            northPanel.add(tableButton);
            JPanel panel = new JPanel();
            panel.add(guiButton);
            JPanel southPanel = new JPanel();
            southPanel.add(saveButton);
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(northPanel, "North");
            f.getContentPane().add(panel);
            f.getContentPane().add(southPanel, "South");
            f.setSize(200,140);
            f.setLocation(200,200);
            f.setVisible(true);
        private static JTable makeTable()
            int rows = 24, columns = 5;
            String[] headers = new String[columns];
            for(int i = 0; i < headers.length; i++)
                headers[i] = "header " + (i + 1);
            String[][] data = new String[rows][columns];
            for(int i = 0; i < rows; i++)
                for(int j = 0; j < columns; j++)
                    data[i][j] = "item " + (i*columns + j + 1);
            JTable table = new JTable(data, headers);
            return table;
        private static void realizeGUI(JTable table)
            JFrame f = new JFrame();
            f.getContentPane().add(table);
            f.pack();
            f.dispose();
        private static void saveComponentAsImage(Component c)
            int w = c.getWidth();
            int h = c.getHeight();
            BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
            Graphics2D g2 = image.createGraphics();
            c.paint(g2);
            g2.dispose();
            try
                ImageIO.write(image, "png", new File("tableImage.png"));
            catch(IOException ioe)
                System.out.println(ioe.getMessage());
    }

  • Transform a rectangular image into a trapezoid

    Hi i want to transform an image from a regular rectangle to a
    trapezium (almost like a flat topped triangle). Is that possible
    with actionscript?

    You can use shape tween
    Create a rectangle on frame one
    Hit F5 to extend the frames to say 10
    click on the last frame and hit F6 on the keyboard
    Click on the last frame
    move your cursor over the rectangle and shape as needed by
    pulling the edges adding points.
    Click once on the first frame
    Hold Shift and click on the last frame
    Go to the properties panel and choose Shape tween from the
    drop down
    Shane

  • Help needed on convert JTable to Image

    Hi, all
    I have made an application that can output a JTable with different colours in its every cells. Now I want to select the whole Table and put it as an Image to one of the Image Viewer Softwares(e.g. windows picture viewer).
    Is there anyone knows how to do that?
    Thanks in advance!
    Regards,
    swat.

    Now I want to select the whole Table and put it as an
    Image to one of the Image Viewer Softwares(e.g.
    windows picture viewer). If you don't have to do it programmatically, and you are working on windows, select the window with the table, Alt-PrtScr will copy just that window into the clipboard, and you can paste it into many different apps, including image views, word, so on.

  • Transformer un format image JPEG en calque transparent DNG

    Bonjour
    Comment puis je transformer une image en format JPEG en un autre format, comme DNG fond transparent.
    Le but étant de mettre cette image en calque incrustation ou superposition ou produit dans une autre image pour faire du compositing ?  
    (le résultat étant comme les fichiers que l'on peut télécharger gratuitement ... , afin de les faire moi-même)
    merci de votre aide
    Bien cordialement
    Christiane DELBECQUE

    Raw formats do not support transparency therefore DNG is the wrong choice to begin with. That and of course your choice of format should/ will be driven by how people are actually able to open your file, meaning it will have to be TIFF, PSD or PNG. You can create transparency in a variety of ways using selections and so on, but really, this is something for which you can just read the help or watch a tutorial on the Internet. The rest is not relevant - even if you provide the file with transparency, it doesn't automatically mean that people will not need extra steps to actualyl use the transparency info.
    Mylenium

  • ComboBoxRenderer on JTable - incorrect image when pressed again

    I have a JTable with a combobox (with images) the user can select an image from a dropdown box. the renderer I'm using (and I guess this is where I'm wrong) is this:
    import java.awt.Component;
    import javax.swing.ImageIcon;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.ListCellRenderer;
    class ComboBoxRenderer extends JLabel implements ListCellRenderer
        public ComboBoxRenderer()
            setOpaque(true);
            setHorizontalAlignment(CENTER);
            setVerticalAlignment(CENTER);
        public Component getListCellRendererComponent
            JList list,
            Object value,
            int index,
            boolean isSelected,
            boolean cellHasFocus)
            if (isSelected)
               setBackground(list.getSelectionBackground());
               setForeground(list.getSelectionForeground());
            else
               setBackground(list.getBackground());
               setForeground(list.getForeground());
            ImageIcon icon = (ImageIcon)value;
            try{
                 setText(icon.getDescription());             
            }catch(Exception e)
                 setText(""); //null
            setIcon(icon);
            return this;
    }The problem is this:
    I have 3 images (1,2,3). Say the user choose image 1 for row 1, image 2 for row 2...image 3 for row 3.
    If he wants to make a correction in row 1 (and change it to image 3) once he clicks the dropdown box he gets image 3 (?!) this is the last image he pressed. In other words, instead of getting the image he alrady pressed, he gets the last image he chose on the dropdown box.
    Any idea?

    No idea what you are talking about. Your question is about a JTable, but you code is about a JList.
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.
    I suggest you also start responding to previous questions berfore posting new questions.

  • Transformation of 2D image to 3D

    Hi all,
    I am new to Java3D. I am desperately needing help to complete my work of converting a single 2D image to 3D using Java.
    What API should I use, or is there some way to do it using JAI API.
    Please help me.
    Awaiting your valuable reply.
    Thanks,
    Sujeet.

    That is not a feature of iPhoto
    LN

  • JTable with Images

    Hi,
    I have created a Table in which each cell is displayed with Images.I am not able to select a cell. Is it possible to select an Image in a cell?
    Please give me a suggestion.
    Regards
    senthil

    Since you know how to display the images, I take it that you have developped a custom TableCellRenderer.
    Pretty sure that you are able to select the cell as usual - just check the table.isSelected(...) - most probably the problem is that you don't see it ;-)I completely agree with the queen of Aegypt on the likely cause of your problem, except she probably meant you should check the value of the boolean isSelected argument that is passed to your renderer's getTableCellRendererComponent(...) method, and render the image differently if it is true.

  • Transform Text to Image?

    I'm asking this question also on the Acrobat forum.
    I'm submitting a pdf to a vendor (bookbaby) to be converted to epub.
    Previous submissions mangled captions on photos, separating them from photos, mixing them up with text.
    I've been informed that if I include the captions as PART of the photos, they won't be searchable, but they WILL then remain fixed with the photos (plus changing fonts, font sizes, won't affect them).
    How can I turn the caption text into image so that it won't be confused with regular text?
    Can I do it in Adobe Acrobat, or must I do it in Indesign before I export it to Acrobat?
    Thanks for any help  (and don't ask why I don't try to do an epub myself. I've tried. It's a can of worms with all 87 images I've got.)

    You can maybe try Create Outlines feature in InDesign. What this feature does is convert the text to vector outlines.
    Select the frame containing the caption and chose the menu Type > Create Outlines
    Thanks

  • Free Transform Vs. Image Size - Quality Impact?

    I'm using Photoshop CS3 and I have a quick query regarding the difference in image quality between resizing an image using 'Image Size' compared to 'Free Transform'.
    I'm laying out several individual photographs on to a page (with some precision) and therefore using the transform function to scale the image to the right size is certainly the quickest and easiest option. However, I have always been keen to ensure maximum image quality and I don't know if this will degrade the image more than resizing the image using 'image size' before pasting it (obviously with a lot more effort involved).
    Any thoughts?

    Many thanks for your replies - that's very useful.
    I should have mentioned that I will always be resizing down. Also, when performing my standard method for resizing (using Image Size) I always stick to the standard Bicubic then follow up with sharpening (specific for my output). What you've told me is great as it means I can simply perform the transform of each image and then an output sharpening on the entire canvas. This should be equivalent to resizing, sharpening and then copy-paste of individual images to the same canvas.
    Using smart objects (which I seldom do at the moment) is an interesting thought, which I'll have to look into. I could copy a smart object from each of my source files, resize and then perform a smart object sharpening to them...
    Many thanks again!

  • CS3 Lion Error: Free Transform Blurs and Distorts Image

    Pretty self-explanitory when you look at the pics:
    You can see that when the image is rotated, it becomes blurry and the edges become jagged. The more the image is rotated the worse the condition becomes. I never had this problem before upgrading to Lion. Can anyone help me? Thank you!

    Many thanks for your replies - that's very useful.
    I should have mentioned that I will always be resizing down. Also, when performing my standard method for resizing (using Image Size) I always stick to the standard Bicubic then follow up with sharpening (specific for my output). What you've told me is great as it means I can simply perform the transform of each image and then an output sharpening on the entire canvas. This should be equivalent to resizing, sharpening and then copy-paste of individual images to the same canvas.
    Using smart objects (which I seldom do at the moment) is an interesting thought, which I'll have to look into. I could copy a smart object from each of my source files, resize and then perform a smart object sharpening to them...
    Many thanks again!

  • Transform an Edge .oam file in Muse

    This for when you right-click on a .oam file in Edge.
    I dropped in two additional options of Transform and Poster Image…:

    Hey Thats for your help. I'm new to dreamweaver can you please explain a bit more as to what I need to change.
    Here is the line of code for the Animate content:
    <object id="Page1" type="text/html" width="1116" height="620" data-dw-widget="Edge" data="../../ServiceIQ Online Flyer/edgeanimate_assets/page1/Assets/page 1.html">
            </object>
    Do I just change <object id> to <iframe>? and leave everything else?
    In your snippet below, what is the <COMPOSITION ID>?
    var comp = document.getElementById('<IFRAME ID>').contentWindow.AdobeEdge.getComposition("<COMPOSITION ID>");
      comp.getStage().playMovie('one');

Maybe you are looking for

  • "nested folders" error message

    When I use Disk Utility to "Verify Disk" (my iMac's internal hard drive), it says in red: "nesting of folders has exceeded the recommended limit of 100" . At the bottom it says in green "Volume passed verification," but under that in red it says "Vol

  • Auto Run ignores URL parameters and uses Defaults on first run

    We have BI Publisher 11g standalone (not OBIEE). We have a suite of BI Publisher reports, all set up on data sets with default parameters. All reports have Auto Run enabled and caching disabled. The reports are run from a Flex UI application using a

  • Plugin Containers hogging memory and Adobe problems

    Hi, I have regular problems with Firefox on my notebook. Firefox memory usage shoots beyond 500MB of memory and becomes extremely slow in any of the below conditions: 1) There are updates ready for some plugins: I thought it might be because I had en

  • Result Recording of Inspection Characterstics.

    Hi Gurus, Actually we have one scenario in QA in which for one material there are certain specification whose result we will come to know few days later after posting inspection lot in Unrestricted & also after doing UD. I want to know how to do resu

  • Back Camera friert ein

    Ich habe mein iPad air (32GB, WiFi) schon 3 mal zur Reparatur eingeschickt. Der Fehler konnte laut Bericht nicht reproduziert werden, tritt aber immer wieder auf. Die hintere Camera hängt sich, speziell bei Gerätetemperaturen um 30 grad C, auf. Das B