Inserting an image to Jframe and save it ,  in SQL database

Hai guys,
I just wanna know about the inserting image in to a Jframe (in netBeans) it will be a grate help if you tell me the way to call a image to Jframe through a Button click and save the image in MySQl database.
Is anyone has a idea about this task, please tell me
Thanks,

Image class should work to get the data, then add it to a Canvas object, then you can save the bytes from the Image into an SQL statement through JDBC.
The implementation details will vary based on which approch and database you select.

Similar Messages

  • Inserting image to jFrame and save it in a sql database

    Hai guys, I have a problem in inseting a image in jfame and save it in database (my sql)
    does any one have an idea about this task reply me pls
    thanks
    bay !

    Use BLOB (Binary Large Object) to save your image to a database.
    As far as displaying a image on Jframe, search the forum.

  • Transform implementation goes wrong when I try transforming a image through script and save the new image using a HTML to canvas plugin.

    Transform implementation goes wrong when I try transforming a image through script and save the new image using a HTML to canvas plugin. The rotation comes up fine, but the origin of the transformation is faulty (compared to other browsers like Chrome & IE)

    A good place to ask advice about web development is at the mozillaZine "Web Development/Standards Evangelism" forum.
    *http://forums.mozillazine.org/viewforum.php?f=25
    The helpers at that forum are more knowledgeable about web development issues.
    You need to register at the mozillaZine forum site in order to post at that forum.

  • How to insert row in table control and save the data in tables

    Hi,
    I have one table control i am displaying data into table control ,
    my problem is : i want to display data into read mode in table control.
    but when i click on insert button on the same screen i want one blank line should inserted into table control , then i want to insert some data into table control on that row , when i click the save button . the new data inserted into the table control is insert that data into ztable ,
    please give me solution
    main problen is  how can know inserted line in table control and pass that data into ztable.

    Hi,
    Follow the below logic,
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0001.
      MODULE POPULATE_TABLE_CONTROL. --> Get the data from table store in 
                                                                          ITAB
      LOOP AT GT_CTRL_LP_D516 INTO GS_WA_CTRL_LP_D516
           WITH CONTROL CTRL_LP_D516
           CURSOR CTRL_LP_D516-CURRENT_LINE.
      The following module moves data to control
        MODULE MOVE_TO_CONTROL.--> Move data from ITAB to table control
      ENDLOOP.
    PROCESS AFTER INPUT.
      LOOP AT GT_CTRL_LP_D516.
      ENDLOOP.
      MODULE EXIT AT EXIT-COMMAND.
      MODULE USER_COMMAND_0001.  --> Here you have to take out the values from table control and update database table
    Reward points if helpful.
    Thanks and regards,
    Mallareddy Rayapureddy,
    Munich, Germany.

  • Catch the image of JTree and save it as a file

    There is an JTree and it has a few nodes.
    And there, I want to capture both the image of JTree and
    the images of it's child nodes as they show in screen.
    if possible, I want to capture image of all expanded nodes in tree and
    save them as jpg file.
    I try to capture the Image of JTree from JTree.createImage() method.
    and I also tried to capture the images of child nodes
    from JTree.getComponents() and capture images all of child nodes as they were.
    I,however,get to know the method
    Component.createImage() doesn't return the image that shows in screen as it was.
    could anybody tell me the answer?

    Hi,
    don't know if I got you right, but what you want is a "screenshot" of the JTree, right ?
    Try to paint the JTree in a BufferedImage and encode this as JPEG or whatever.
    BufferedImage theImage = new BufferedImage(
          owner.getWidth(), owner.getHeight(), BufferedImage.TYPE_INT_RGB);
          Graphics g = theImage.createGraphics();
          g.setClip( 0, 0, owner.getWidth(), owner.getHeight());
          owner.paint( g);owner is your JTree or any other component you want.
    Hope that helped.

  • When I rotate an image in Preview and save it, it reverts back to original

    This is a really frustrating problem! When I click on a picture in Finder, it comes up in Preview. If I rotate and save it, the rotation isn't saved and it ends up being the same as the original picture. How am I able to rotate and save the rotation?!

    What application are you using to rotate the picture? Applications such as Preview and GraphicConverter save the rotated picture, but with others such as iPhoto you need to export the rotated image.

  • Error when save date in SQL database

    Hi all,
    I try to save a date in to a sql database, but when I run my program I get following error:
    Invalid object 11/21/05 9:32 AM of type java.sql.Date assigned to host variable 3.
    In my database table I have a fields date (type Data)en time type(Time).
    this is the source:
         public void createTitle(int title_id, String description, String user)
              throws SQLException {
              // TODO Auto-generated method stub
              Date date = new Date();
              String dateFormat = "YYYY-MM-DD";
              String timeFormat = "HH:mm:ss";
              SimpleDateFormat ddf = new SimpleDateFormat(dateFormat);
              SimpleDateFormat tdf = new SimpleDateFormat(timeFormat);
              String det = ddf.format(date);
              String creationTime = tdf.format(date);
              PreparedStatement newTitle = conn.prepareStatement("INSERT INTO BE_TITLE (TITLE_ID, DESCRIPTION, DATE_CREATE, TIME_CREATE, USER_CREATE) VALUES (?,?,?,?,?)");     
              try{
                   newTitle.setInt(1,title_id);
                   newTitle.setString(2,description);
                   newTitle.setDate(3, new java.sql.Date(date.getTime()));
                   newTitle.setTime(4, new java.sql.Time(date.getTime()));
                   newTitle.setString(5, user);
                   newTitle.executeUpdate();
              }finally{
                   newTitle.close();
    Can someone give me a solution for this error
    Richard

    Hi Richard,
    in your application, you atempt to insert a java.sql.Date value into a DATE column, which has non-zero time-components. Open SQL rejects such an atempt.
    Please allow me to quote from the OSS message (452727 2004), which Detlev refers to in his quote:
    <i>
    about one year ago, we had a very lengthy discussion on this issue - not only internally at SAP but also with Jonathan Bruce, the specification lead for JBDC at Sun.                                                                               
    We have the following dillema:                                                                               
    The javadoc of the constructor java.sql.Date(long) states:                                                                               
    "If the given milliseconds value contains time information, the driver will set the time components to the time in the default time zone (the time zone of the Java virtual machine running the application) that corresponds to zero GMT."                                                                               
    With Jonathan Bruce, we tried to clarify when this normalization should take place.                                                               
    1) Source code inspection shows that it is not the class java.sql.Date the performs the normalization.                                                                               
    2) The Javadoc states that the JDBC driver should perform the             
    normalization. If it is the driver, more open questions arrise:                                                                               
    a) When shall the normalization be performed?                             
       - if a setDate method is invoked?                                      
       - only for INSERT and update statements or also for all other parameters?                                                               
       - shall the getDate method perform the normalization?                  
       - what about set/getObject?                                            
       - the java Docs of set/getDate don't tell anything about normalization.                                                            
       - according to which time zone shall the value be normalized?          
         - UTC                                                                
         - vm time zone?                                                      
         - database time zone?                                                                               
    3) If an automatic normalization is performed, data will be modified upon insertion (or extraction) from the database. This means that we cannot quarantee if we insert and Date object retrieve it again that the two objects will be equal.
    In the discussion with Jonathan, we couldn't clarify the issue. However, Jonathan promised that the JDK should be modified in such a way that the JDK is responsible for the normalization. (So far such a change has not been done).                                                                               
    In order to be on the safe side, SAP chose that Open SQL should reject any Date values that are not normalized. This is what we have          
    implemented and documented. I agree, that in this repect, Open SQL is stricter than the JDBC standard demands.                                                                               
    To help the application with the task to normalize a Date (and Time) object, we offer the helper class                                      
    com.sap.sql.DateTimeNormalizer which you find in opensql.jar.                                                                               
    To come to a conclusion, the bevavoir you observed is from our side not a bug of Open SQL but a feature. Please use DateTimeNormalizer to normalize Date objects appropriately.                                  
    </i>
    I hope, you can follow our reasoning.
    Best regards,
    Adrian

  • Load Image resize it and save

    I want to write a program that recievs a directory name and then
    goes through all sub directories looknig for images and resises them to
    one size.
    Is it possible ?
    Can anybody refer me to a link/thread that i can look at ?

    This might work http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/

  • Can't convert raster image to vector and save with a transparent ground.

    I'm pretty sure I know all the right steps as far as Live Trace and Expand go, but it seems I can't detach the image from the white workspace background. I tried selecting the white in my image and deleting it, but Illustrator isn't even allowing me to select. I feel like something very simple and fundamental is wrong, I just can't figure out what it is.

    Thanks, didn't see that option before. Tried it, but I still have the problem of the file including all of the workspace and being much larger than the original file. There has to be some trick to detaching the black from the background we're missing.

  • Insert an image in header and export to PDF/Excel WAD

    Hi experts!
    I'm trying to create a Web template for one of my queries with the WAD.
    I've added a table at the top, containing a logo and One custom text. Below that table, I've added a CONTAINER_LAYOUT_ITEM, and in this element, I've added different item, like BUTTON_GROUP_ITEM, INFO_FIELD_ITEM, NAVIGATION_PANE_ITEM and ANALISYS_ITEM, related with one query.
    One of the buttons I've created one with the action EXPORT but in the Data Binding secction, only the items (BUTTON_GROUP_ITEM, INFO_FIELD_ITEM, NAVIGATION_PANE_ITEM and ANALISYS_ITEM) are shown. So I can't select the table I've created for the export.
    I've tried to put the table in one CONTAINER_ITEM, and the select it in the export command, but it doesn't work.
    Does anybody any idea about how to inlcude the logo and the Title in the PDF or Excel export??
    Thanks in advance for your help
    Best regards,

    When you post code, please use[code] and [/code] tags as described in Formatting tips on the message entry page. It makes it much easier to read.
    I'm confused, you are returning a GIF, not a PDF in the code below, but you are telling the client you are returning a JPEG.
    Graphics2D.drawImage
    ImageIO.read

  • What is the difference between "Save image to downloads" and "save image to iPhoto library"???

    Typically I have been saving my photos to the iphoto library. Im not sure which is the best option. What is the difference between these 2 options?

    one goes to your downloads folder and the other goes to your iPhoto library.

  • WEBUTIL upload file to blob and save a file in database harddisk

    Dear all,
    Webutil have a file upload from client to blob.
    It can run smoothlly.
    My problem is, how to download my file on the blob into a file in database harddisk.
    For your information, my file is DBF data file.
    Pls help me.
    Best regards
    Jansen Hutagalung

    Why do you try with BFILE type?

  • After downloading IO6, can't capture photos from Facebook. I get "save photo" instead of "save image".  While browsing, save image comes up and photos save to camera roll.  Seems to be a problem only on FB.

    Downloaded IO6 on my iPhone 4s.  Now I can't capture a photo off Facebook to the camera roll.  When I try, I get a "Save Photo" tab rather than a "Save Image" button,  The photo does not save to camera roll.  For email images and Safari images, "save image" comes up and save to camera roll.  Seems only a problem with images on FB.  Any ideas?  Thanks

    You launched iPhoto and from its Preferences you selected Connecting camera opens.....

  • How to transfer a 2D array from NI-scop into a gray scale image and save it

    Dear all,
    I acquired a 2D array and want to transfer it into a gray scale image (12 bits) and save it into my hard disk but I don't know how to do it.
    I can use Intensity graph to show the 2Darray into gray scale image, but the intensity graph.vi can not save the image in real time.
    Thank you.
    Solved!
    Go to Solution.

    The 24-bit is a color image with 8-bits per color channel per pixel (interleaved, if I remember correctly).  It is not a 24-bit gray-level, so I don't think it will work for you.  I believe the IMAQ library (a LabVIEW add-on) will handle 16-bit gray-scale, if you can get a copy.
    As a native LabVIEW workaround, you could also split your image into two 8-bit images, with one image representing the high bytes, the other the low.  You could then combine them when you do the analysis, if your analysis program is capable of this.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Effects combine and save!

    I have a small graphics programm, where I can rotate the picture and the change the brightness
    in the JMenu "Edit".
    I can also save these changes, but with the restriction that only one of the two will be saved. So if I rotate it and then set the brightness, the image jumps to the old position back. For brightness, it is exactly the same thing in reverse.
    But now i want both, to rotate the image and change the image brightness. And save it.
    It would be nice if someone could help me.
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GridLayout;
    import java.awt.Image;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.KeyEvent;
    import java.awt.geom.AffineTransform;
    import java.awt.geom.Point2D;
    import java.awt.image.AffineTransformOp;
    import java.awt.image.BufferedImage;
    import java.awt.image.BufferedImageOp;
    import java.awt.image.ColorConvertOp;
    import java.awt.image.RescaleOp;
    import java.io.File;
    import java.io.IOException;
    import javax.swing.*;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    import javax.imageio.ImageIO;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JSlider;
    import javax.swing.JTextField;
    import javax.swing.WindowConstants;
    import javax.swing.filechooser.FileNameExtensionFilter;
    public class Grafikprogramm extends JFrame {
         private JMenuItem opennow;
         private JMenuItem close;
         private JMenuItem save;
         private JMenuItem quit;
         private JFileChooser fileChooser;
         private JMenuItem brightness;
         private JMenuItem rotate ;
         private JMenu menuBearbeiten;
         private JFrame f = new JFrame("Test");
         private File datei;
         private BufferedImage image;
         private BufferedImage originalImage;
         private JPanel unten;
         ViewComponent view = new ViewComponent(); // Layer with the picture
         private JSlider slider;
         private JSlider slider1;
         private JSlider slider2;
         private int centerX, centerY;
         Grafikprogramm() {
              super();
              Container content = getContentPane();
              this.setTitle("Bildbearbeiter");
              // MenuBar with Shortcuts
              JMenuBar menuLeiste = new JMenuBar();
              JMenu menuDatei = new JMenu("File");
              menuDatei.setMnemonic('D');
              menuBearbeiten = new JMenu("Edit");
              menuBearbeiten.setMnemonic('B');
              // Shortcuts Menu Aktionen
              opennow = new JMenuItem("Open", KeyEvent.VK_O);
              close = new JMenuItem("Close Picture", KeyEvent.VK_S);
              quit = new JMenuItem("Quit Program ", KeyEvent.VK_P);
              save = new JMenuItem("Save", KeyEvent.VK_S);
              opennow.addActionListener(new MenueAktion01());
              quit.addActionListener(new MenueAktion01());
              close.addActionListener(new MenueAktion01());
              save.addActionListener(new MenueAktion01());
              //Panel for Slider south
              unten = new JPanel();
              add(unten,BorderLayout.SOUTH);
              unten.setLayout(new GridLayout(4,1));
              unten.add(slider = new JSlider(1,50,25));
              unten.add(slider1 = new JSlider(1,50,25));
              unten.add(slider2 = new JSlider(1,50,25));
              slider.setVisible(false);
              slider1.setVisible(false);
              slider2.setVisible(false);
              // File selection for jpg and gif
              fileChooser = new JFileChooser();
              FileNameExtensionFilter filter = new FileNameExtensionFilter("Bildformate gif+jpg", "gif","jpg");
              fileChooser.setAcceptAllFileFilterUsed(false);
              fileChooser.addChoosableFileFilter(filter);
              menuDatei.add(opennow);
              menuDatei.add(close);
              menuDatei.add(save);
              menuDatei.add(quit);
              menuLeiste.add(menuDatei);
              menuLeiste.add(menuBearbeiten);
              this.setJMenuBar(menuLeiste);
              brightness = new JMenuItem("Brightness", KeyEvent.VK_H);
              rotate = new JMenuItem ("Rotate",KeyEvent.VK_D);
              menuBearbeiten.add(brightness);
              menuBearbeiten.add(rotate);
              brightness.addActionListener(new MenueAktion01());
              rotate.addActionListener(new MenueAktion01());
              close.setEnabled(true);
              menuBearbeiten.setEnabled(false);
              // window for the picture
              add(view);
         class ViewComponent extends JComponent {
              int width,height;
              public void setImage(File file) {
                   try {
                        image = ImageIO.read(file);
                        repaint();
                        width = image.getWidth(null);
                        height = image.getHeight(null);
                        originalImage =
                             new BufferedImage(width, height,
                             BufferedImage.TYPE_INT_RGB);
                     Graphics g = originalImage.createGraphics();
                     g.drawImage(image, 0, 0, null);
                     g.dispose();
                   catch (IOException e) {
                        JOptionPane.showMessageDialog(f, e.getMessage(), "Error",
                                  JOptionPane.ERROR_MESSAGE);
              public void paint(Graphics g) {
                   if (image != null) {
                        // if the image is load you can edit it
                        menuBearbeiten.setEnabled(true);
                        save.setEnabled(true);
                        Graphics2D g2d = image.createGraphics();
                   } else {
                        g.drawString("No Picture load", 280, 200);
                        //     slider.setVisible(false);
                        save.setEnabled(false);
                   g.drawImage(image, 0, 0, null);
         // rotate method
         public void rotate(double multiple) {
              AffineTransformOp op = new AffineTransformOp(
              AffineTransform.getRotateInstance(multiple,
                            centerX,
                            centerY),
                    AffineTransformOp.TYPE_BILINEAR);
                    image =  op.filter(originalImage, null);
                 repaint();
         // brightness method
         public void setBrightnessFactor(float multiple) {
               RescaleOp op = new RescaleOp(multiple, 0, null);
               image = op.filter(originalImage, null);
               repaint();
         // Aktionen for Menu Items
         class MenueAktion01 implements ActionListener {
              int result;
              public void actionPerformed(ActionEvent e) {
                   if (e.getSource() == opennow) {
                        slider.setVisible(false);
                        result = fileChooser.showOpenDialog(null);
                        if (result == fileChooser.APPROVE_OPTION) {
                             datei = fileChooser.getSelectedFile();
                             System.out.println(fileChooser.getSize());
                             System.out.println(datei);
                             if (fileChooser.getWidth() > 100) {
                                  view.setImage(datei);
                                  opennow.setEnabled(false);
                                  close.setEnabled(true);
                   // Close Programmm
                   if (e.getSource() == quit) {
                        System.exit(0);
                   // close picture
                   if (e.getSource() == close) {
                        image = null;
                        slider.setVisible(false);
                        menuBearbeiten.setEnabled(false);
                        opennow.setEnabled(true);
                        close.setEnabled(false);
                        save.setEnabled(false);
                        slider.setVisible(false);
                        slider1.setVisible(false);
                        slider2.setVisible(false);
                        repaint();
                   // save MenuItem
                   if (e.getSource() == save) {
                        slider.setVisible(false);
                        // new JFileChooser for save
                        JFileChooser fc = new JFileChooser();
                        int returnVal = fc.showSaveDialog(Grafikprogramm.this);
                        if (returnVal == JFileChooser.APPROVE_OPTION) {
                             datei = fc.getSelectedFile();
                        // write with ImageIO
                             try {
                                  ImageIO.write(image, "jpg", datei);
                             } catch (IOException e1) {
                                  e1.printStackTrace();
                   // rotate
                   if (e.getSource()== rotate) {
                        slider.setVisible(false);
                        slider1.setVisible(false);
                        slider2.setVisible(true);
                        rotate(0);
                        slider2.addChangeListener(new ChangeListener() {
                             public void stateChanged(ChangeEvent e) {
                                  centerX = (int)originalImage.getWidth()/2;
                                 centerY = (int)originalImage.getHeight()/2;
                                  rotate((double) (slider2.getValue()- 25.5) /4);
                   // brightness               
                   if (e.getSource() == brightness){
                        slider1.setVisible(true);
                        slider.setVisible(false);
                        slider2.setVisible(false);
                        setBrightnessFactor(1);
                        slider.setVisible(false);
                        slider1.setVisible(true);
                        slider1.addChangeListener(new ChangeListener(){
                             public void stateChanged(ChangeEvent e){
                                  setBrightnessFactor((float)(slider1.getValue())/25);
         public static void main(String[] args) {
              Grafikprogramm main = new Grafikprogramm();
              main.setLocation(135, 0);
              main.setSize(640, 480);
              main.setBackground(Color.WHITE);
              main.setVisible(true);
              main.setAlwaysOnTop(false);
              main.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }

    your problem is that your original image is being used each time you call a method, either rotate or brightness. in order to do both, you have to either have the method return the adjusted image and store it back in the original image, or make a new method that does both.
    for example:
         public BufferedImage rotate(double multiple, BufferedImage image) {
              AffineTransformOp op = new AffineTransformOp(
              AffineTransform.getRotateInstance(multiple,
                            centerX,
                            centerY),
                    AffineTransformOp.TYPE_BILINEAR);
                    this.image =  op.filter(image, null);
                 repaint();
                                       return this.image;
          }so when you call your method, you supply the original BufferedImage image as the second argument.
    null

Maybe you are looking for

  • How do you put text into a photo book?

    I am new to Photoshop Elements, using Elements 11, and my first project is to make a photo book for a recent trip.  I have figured out importing the pictures and titles.  I want to include a 3000 word story on 3 or 4 pages.  I have spent hours trying

  • Camera roll did not download photos

    My camera roll did not download to my phone on icloud reset. Some pics from photo stream did but none on camera roll. ??

  • How to save pdf in APEX 3.0

    is there a way to save the pdf output into APEX database in ver 3

  • Tax calculation for Service Entry Sheet

    Hi all, We have the following issue: In Purchase Orders we have a formula in Conditions in order to calculate the tax amount according to Gross Price. ( It is a legal requeriment of the country ) When we execute ML81N, the value of Gross Price is rig

  • How to install sound driver in HP Compaq Presario C794VU laptop in windows XP

    i want to install sound driver in windows XP in my laptop HP Compaq Presario C794VU. i have driver setup. i have run the setup but sound not comes. please give me the procedure how to install the sound driver. thank you