Having trouble displaying image in JPanel

I want to display an image in jpanel making it to scale to the size of the panel.
And later i should be able to draw on that image , i am really new to all this , but i have to finish it soon.
This is the code i am compiling and getting error
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class LocaterClient extends JFrame
     JPanel panel;
     public LocaterClient()
          super("LocaterClient");
          panel = new JPanel();
          panel.setSize(374,378);
          panel.setOpaque(false);
          panel.setVisible(true);
     getContentPane().add(panel);
     /*JFrame f = new JFrame();
     f.setSize(374,378);
     f.getContentPane().add(panel);*/
     public void paintComponent(Graphics g)
          super.paintComponent(g);
          ImageIcon img = new ImageIcon("World_MER.jpg");
          ImageIcon fillImage = new ImageIcon(img.getImage().getScaledInstance
(getWidth(), getHeight(),Image.SCALE_REPLICATE));
          g.drawImage(fillImage.getImage(), 0,0, this);
     public static void main(String args[])
          LocaterClient lc = new LocaterClient();
          lc.setDefaultCloseOperation( EXIT_ON_CLOSE );
          lc.pack();
          lc.setVisible(true);
This is the error i am getting
LocaterClient.java:24: cannot resolve symbol
symbol : method paintComponent (java.awt.Graphics)
location: class javax.swing.JFrame
super.paintComponent(g);
^
1 error
If i remove super.paintComponent(g); line it compiles and runs but i get a tiny panel without the image.
PLease help me , i am not evn sure is this is the procedure should i follow , because i should be able to draw on that image later on .
Please provide me with some sample code.

import javax.swing.*;
import java.awt.*;
public class ImagePainter extends JPanel{
  private Image img;
  public ImagePainter(){
    img = Toolkit.getDefaultToolkit().getImage("MyImage.gif");
  public void paintComponent(Graphics g){
    g.drawImage(img,0,0,getSize().width,getSize().height);
  public static void main(String[]args){
    JFrame frame = new JFrame();
    frame.getContentPane.add(new ImagePainter());
    frame.setSize(500,500);
    frame.show();

Similar Messages

  • Having trouble displaying images on a page in APEX through IE.

    I'm trying to conditionally display images (used as toggle buttons) in a tabular report in APEX. This is for our Benefits application where an employee can include or exclude his/her dependents from the plan. For each row, in one column I want to show only 'Include' button if an individual is not already a member, and in another column show only 'Remove' button if already included. I'm using the button images as links and passing information to a page process.
    I was able to come up with the SQL query which works perfectly fine in Firefox. But the images won't display in Internet Explorer. Does anyone have any idea how to make this work in IE?
    Below is my query. This code will display 'Include in plan' image only if the member is not already added to the plan. If 'Y' is the result of the query, then the member is already included and no image is displayed. Otherwise display the image. Pass the member_id to an application item and process the record in a Before Header process.
    select elected_member_id, member_type, last_name, first_name, middle_name, gender,date_of_birth,student_flag,trunc(months_between(sysdate ,date_of_birth)/12) AGE,
    decode((select 'Y'
    from eben_elected_plan_info epi
         where plan_name not in ('Delta', 'Vision', 'HEALTH_FLEX', 'DEP_FLEX')
         and epi.elected_member_id = emi.elected_member_id
         and transaction_type <> 'END'), null,'<a href="f?p=&APP_ID.:70:&SESSION.::::F_APP_MEMBER_INCLUDE:'||elected_member_id||'<img src="&WORKSPACE_IMAGES.include.png"></a>') elected_member_id_include,
    elected_member_id elected_member_id_exclude
    from eben_elected_members_info emi
    where emp_person_id = :f_app_person_id
    and member_type <> 'Employee'

    I was able to resolve this issue by creating the SQL statement from scratch in IE. It then recognized the images.

  • Having trouble displaying images on my results page

    I have tried placing the following code (<img src="*<?php echo $row_rsppleresults['picture_upload']; ?>*>) BOLDED AREA (see code below very last entry) in hopes that it would display the image. However, what happens after I place the code in that location is that I get an invalid code error that there is something wrong with the Italic BOLDED area (see below very last entry). In addition, to that it changes the html formatting on my page when I try to view the page and no image shows up.  As of right now when someone fills out the input form the photo automatically get uploaded into the following directory-/public_html/rescuealerts/fomdata/uploads_missing_person_form.  I am clueless how to connect the correct image with the correct input information in the search display table. Below you will find the following- my code for the results page and my dynamic table.  Everything else in the dynamic table displays correctly. It the images that I can seem to get displayed. Any help would be greatly appreciated.
    Results page:
    <?php require_once('../Connections/rescue.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $currentPage = $_SERVER["PHP_SELF"];
    $maxRows_rsppleresults = 10;
    $pageNum_rsppleresults = 0;
    if (isset($_GET['pageNum_rsppleresults'])) {
      $pageNum_rsppleresults = $_GET['pageNum_rsppleresults'];
    $startRow_rsppleresults = $pageNum_rsppleresults * $maxRows_rsppleresults;
    mysql_select_db($database_rescue, $rescue);
    $query_rsppleresults = "SELECT missing_name, `description`, picture_upload, missing_person_form.missing_name, missing_person_form.`description`, missing_person_form.picture_upload FROM missing_person_form";
    $query_limit_rsppleresults = sprintf("%s LIMIT %d, %d", $query_rsppleresults, $startRow_rsppleresults, $maxRows_rsppleresults);
    $rsppleresults = mysql_query($query_limit_rsppleresults, $rescue) or die(mysql_error());
    $row_rsppleresults = mysql_fetch_assoc($rsppleresults);
    if (isset($_GET['totalRows_rsppleresults'])) {
      $totalRows_rsppleresults = $_GET['totalRows_rsppleresults'];
    } else {
      $all_rsppleresults = mysql_query($query_rsppleresults);
      $totalRows_rsppleresults = mysql_num_rows($all_rsppleresults);
    $totalPages_rsppleresults = ceil($totalRows_rsppleresults/$maxRows_rsppleresults)-1;$maxRows_rsppleresults = 10;
    $pageNum_rsppleresults = 0;
    if (isset($_GET['pageNum_rsppleresults'])) {
      $pageNum_rsppleresults = $_GET['pageNum_rsppleresults'];
    $startRow_rsppleresults = $pageNum_rsppleresults * $maxRows_rsppleresults;
    $colname_rsppleresults = "-1";
    if (isset($_POST['missing_name'])) {
      $colname_rsppleresults = $_POST['missing_name'];
    mysql_select_db($database_rescue, $rescue);
    $query_rsppleresults = sprintf("SELECT missing_name, `description`, picture_upload FROM missing_person_form WHERE missing_name LIKE %s", GetSQLValueString("%" . $colname_rsppleresults . "%", "text"));
    $query_limit_rsppleresults = sprintf("%s LIMIT %d, %d", $query_rsppleresults, $startRow_rsppleresults, $maxRows_rsppleresults);
    $rsppleresults = mysql_query($query_limit_rsppleresults, $rescue) or die(mysql_error());
    $row_rsppleresults = mysql_fetch_assoc($rsppleresults);
    if (isset($_GET['totalRows_rsppleresults'])) {
      $totalRows_rsppleresults = $_GET['totalRows_rsppleresults'];
    } else {
      $all_rsppleresults = mysql_query($query_rsppleresults);
      $totalRows_rsppleresults = mysql_num_rows($all_rsppleresults);
    $totalPages_rsppleresults = ceil($totalRows_rsppleresults/$maxRows_rsppleresults)-1;
    $queryString_rsppleresults = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_rsppleresults") == false &&
            stristr($param, "totalRows_rsppleresults") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_rsppleresults = "&" . htmlentities(implode("&", $newParams));
    $queryString_rsppleresults = sprintf("&totalRows_rsppleresults=%d%s", $totalRows_rsppleresults, $queryString_rsppleresults);
    ?>
    Here is my code for the dynamic table (this is also where I have been trying to edit the code to look for the images that were uploaded with the initial form.
    Dynamic Table:
        <tr>
          <td style="font-weight: normal; color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"><div align="left"><?php echo $row_rsppleresults['missing_name']; ?></div></td>
          <td style="font-weight: normal; color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"><div align="left"><?php echo $row_rsppleresults['description']; ?></div></td>
          <td style="font-weight: normal; color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"><div align="left"><?php echo $row_rsppleresults['picture_upload']; ?></div></td>
        </tr>
        <?php } while ($row_rsppleresults = mysql_fetch_assoc($rsppleresults)); ?>
    </table>
    Thank you,
    hjohnson2011

        <tr>
          <td style="font-weight: normal; color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"><div align="left"><?php echo $row_rsppleresults['missing_name']; ?></div></td>
          <td style="font-weight: normal; color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"><div align="left"><?php echo $row_rsppleresults['description']; ?></div></td>
          <td style="font-weight: normal; color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"><div align="left"><?php echo $row_rsppleresults['picture_upload']; ?></div></td>
        </tr>
        <?php } while ($row_rsppleresults = mysql_fetch_assoc($rsppleresults)); ?>
    </table>
    First off, you should style the table, rows and cells by using CSS. Also, there is no need for a div within the cell because, again, you can use CSS to do the styling for you. Not only that, depending on the DOCTYPE that has been used, tou will get an invalid markup when using align=left.
    Depending on what is included in the picture_upload field (just the name and extension or the complete path and file name) your markup should look like
    <table>
      <tr>
        <td><?php echo $row_rsppleresults['missing_name']; ?></td>
        <td><?php echo $row_rsppleresults['description']; ?></td>
        <td><img src="<?php echo $row_rsppleresults['picture_upload']; ?>"></td>
      </tr>
    </table>
    if the picture_upload field contains all of the info, or if it only contains the filename+extension
    <table>
      <tr>
        <td><?php echo $row_rsppleresults['missing_name']; ?></td>
        <td><?php echo $row_rsppleresults['description']; ?></td>
        <td><img src="escuealerts/fomdata/uploads_missing_person_form/<?php echo $row_rsppleresults['picture_upload']; ?>"></td>
      </tr>
    </table>
    Gramps

  • Having  trouble displaying images on TV

    I am able to show my movies on TV (version 2)but am unable to see images
    I tried the advanced  option but I only see a couple of imahes in my download folder
    How do I get photos and other images to to sho up or to load into iTuunes?

    When yo go to that option it lets you browse your whole computer so i'm not sure I understand. If you have all of your pictures in one folder (no matter where they are on your system) you should be able to find them.
    Navigate to the correct spot or put your photos in one place (folder) if they are not already

  • Having trouble displaying a JPanel on a JFrame

    Hello all,
    I'm fairly new to Java and I am having trouble displaying a JPanel on a JFrame. Pretty much I have a class called Task which has a JPanel object. Everytime the user creates a new task, a JPanel with the required information is created on screen. However, I cannot get the JPanel to display.
    Here is some of the code I have written. If you guys need to see more code to help don't hesitate to ask.
    The user enters the information on the form and clicks the createTask button. If the information entered is valid, a new task is created and the initializeTask method is called.
    private void createTaskButtonMouseClicked(java.awt.event.MouseEvent evt) {                                             
        if (validateNewTaskEntry())
         String name = nameTextField.getText().trim();
         Date dueDate = dueDateChooser.getDate();
         byte hourDue = Byte.parseByte(hourFormattedTextField.getText());
         byte minuteDue = Byte.parseByte(minuteFormattedTextField.getText());
         String amOrPm = amPmComboBox.getSelectedItem().toString();
         String group = groupComboBox.getSelectedItem().toString();
         numberTasks++;
    //     if (numberTasks == 1)
    //     else
         Task newTask = new Task(mainForm, name, dueDate, hourDue, minuteDue,
             amOrPm, group);
         newTask.initializeTask();
         this.setVisible(false);
    }This is the code that I thought would display the JPanel. If I put this code in anther form's load event it will show the panel with the red border.
    public void initializeTask()
         taskPanel = new JPanel();
         taskPanel.setVisible(true);
         taskPanel.setBorder(BorderFactory.createLineBorder(Color.RED));
         taskPanel.setBounds(0,0,50,50);
         taskPanel.setLayout(new BorderLayout());
         mainForm.setLayout(new BorderLayout());
         mainForm.getContentPane().add(taskPanel);
    }I was also wondering if this code had anything to do with it:
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new AddTaskForm(new MainForm()).setVisible(true);
        }As you can see I create a new MainForm. The MainForm is where the task is supposed to be drawn. This code is from the AddTaskForm (where they enter all the information to create a new task). I had to do this because AddTaskForm needs to use variables and methods from the MainForm class. I tried passing the mainForm I already created, but I get this error: non-static variable mainForm cannot be referenced from a static context. So to allow the program to compile I passed in new MainForm() instead. However, in my AddTaskForm class constructor, I pass the original MainForm. Here is the code:
    public AddTaskForm(MainForm mainForm)
       initComponents();
       numberTasks = 0;
       this.mainForm = mainForm;
    }Is a new mainForm actually being created and thats why I can't see the JPanel on the original mainForm? If this is the case, how would I pass the mainForm to addTaskForm? Thanks a ton for any help/suggestions!
    Brian

    UPDATE
    While writing the post an idea popped in my head. I decided to not require a MainForm in the AddTaskForm. Instead to get the MainForm I created an initializeMainForm method.
    This is what I mean by not having to pass new MainForm():
        public static void main(String args[])
         java.awt.EventQueue.invokeLater(new Runnable()
             public void run()
              new MainForm().setVisible(true);
        }Even when I don't create the new MainForm() the JPanel still doesn't show up.
    Again, thanks for any help.
    Brian

  • Having trouble displaying small image in Cart

    Hello everyone. I have been having trouble displaying the small image in my cart. I know that the image is there, yet it wont display. Any help would be appreciated. Thanks
    http://www.highestgoodclothing.com/men/stl-tee

    .productitemcell { }
    That in your css has no height.
    Add height:auto; to your code.

  • I'm having trouble getting a custom JPanel to display correctly...

    HI, I'm having trouble getting a custom JPanel to display correctly. I'm using the JPanel inside a JFrame to display some really custom graphs. The graphing side of this whole thing works flawlessly. The problem I'm having is that when I close the JFrame by using setVisible(false); and then openning it again using setVisible(true); all the information on it is garbage. There are buttons from the JFrame which orgininally opened it and it has trouble openning a second graph if I choose too. I also have the same problem if i move the frame off the screen and move it back. I'd really appreciate any help.
    Thanks!

    With option #1 -- I modified and rebuilt the 3rd-party JARs and referenced them in NetBeans. When I choose clean and build, the Ant processes results in an error: "jarsigner returns 1". So it doesn't seem to run at all.As long as you rebuilt the jars correctly without the original signature, I think it should work.
    An example of unsigning a jar using ant is here:
    http://frank.zinepal.com/unsign-a-jar-with-ant
    Do you think the multiple-JNLP idea would work if NetBeans didn't apply "my" signature to the 3rd-party JARs? Aside from manually copying the original JARs into the \dist directory, is there a better way to tell NetBeans to leave the 3rd-party JAR alone (ie, don't sign it again)?I think it's supposed to work (it's the mixed code signing situation I referred to in my prior post).
    For example, from your description it sounds like the default NetBeans build doesn't really support this style of deployment, so you would have to create a custom build which does what you need and is not triggered by NetBeans - which is doable, but annoying - it's sounds like you tried this, but were unable to get it to work as expected. For NetBeans specific help, you are better posting to a NetBeans forum (though you might be just the second person who has tried to do this with a JavaFX app).
    Also need to check the end user experience is acceptable too, because I think the dialog and warning handling for the mixed code situation is different.
    Look at the deployment guide section "Using <fx:resources> for Extension Descriptors" - I think it documents how to do what you want if you use a custom build file rather than letting NetBeans do the work:
    http://docs.oracle.com/javafx/2/deployment/javafx_ant_task_reference002.htm#CIABGCEE
    Hmm, a lot of running around to deploy an app which can open a file . . .

  • Having trouble displaying the Logged in Customer details.  The customer is able to register himself

    Having trouble displaying the Logged in Customer details.  The customer is able to register himself to my site but when he enters his username and password I don't know how to display the welcome username message and switch the login link to logout. Even afte the customer is logged in it still shows login. Please look at the image for more details.

    Thanks Sidney, that worked........I tried to change the css style of make the log out link to stay in same horizontal line as the Logged in but I can't.(Please see the image) Is it the module that is designed to work this way???
    And one more .....is there a way where I can change the message "No one logged in" to say LogIn.
    Thank you

  • Having trouble burning images to cd, get error code 0x8002006E - what is it?

    Hello all, I am having trouble burning images to a cd, I get error code 0x8002006E - what is it?  I have an older MacBook Pro, OSX 10.6.8.  Help!

    You might also try SMC and PRAM resets:
    http://support.apple.com/kb/ht3964
    http://support.apple.com/kb/ht1379
    And you might try deleting the "com.apple.finder.plist" in your Library.
    Ciao.

  • Need to display image on JPanel

    Hello
    I am trying to implement a graphical version of the Knights Tour. I am done with the algorithm part of the problem itself. I am having problem with displaying the chess board. Although seemingly straightforward the images will not display on the JPanel. Below is a sample of what I am trying to do. Can anyone explain why the code does not work even though it seems okay. Thanks and best regards.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    public class test extends JFrame { 
    public test(){ 
    panel pane = new panel();
    getContentPane().add(pane);
    public static void main(String[]args){   
    test tst = new test();
    tst.setSize(500,500);
    tst.show();
    public class panel extends JPanel{   // inner class
    private Image img;
    private ImageIcon icon;
    public panel(){
    icon = new ImageIcon("cross.gif");
    img = icon.getImage();
    public void paintComponent(Graphics g)
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D)g;
    System.out.println("I am here");
    g.drawImage(img,40,40,this);
    }

    package com.lc.util.swing ;
    import java.awt.Color ;
    import java.awt.Graphics ;
    import java.awt.Image;
    import java.awt.Insets;
    import java.awt.Dimension ;
    import java.awt.image.ImageObserver ;
    import javax.swing.JPanel;
    import javax.swing.border.Border;
    * Panel displaying an {@link Image}.
    * <ul>
    * <li>8 positions,</li>
    * <li>
    * can stretch image for filling the whole available area, or diminish
    * its size if too large in width or height,
    * </li>
    * <li>respects borders (as defined by
    * {@link javax.swing.JComponent#setBorder( javax.swing.border.Border ) JComponent.setBorder}
    * </li>
    * </ul>
    * @author Laurent Caillette
    * @version $Revision: 1.1.1.1 $ $Date: 2002/02/19 22:12:04 $
    public class JImagePanel extends JPanel {
    public JImagePanel() {
    imageObserver = this ;
    * Constructeur assignant une image.
    public JImagePanel( Image image ) {
    this() ;
    setImage( image ) ;
    private Image image ;
    private ImageObserver imageObserver ;
    public void setImage( Image image ) {
    this.image = image ;
    adjustPreferredSize();
    public void setBorder( Border newBorder ) {
    super.setBorder( newBorder ) ;
    adjustPreferredSize() ;
    private void adjustPreferredSize() {
    if( image != null ) {
    int w = image.getWidth( imageObserver ) ;
    int h = image.getHeight( imageObserver ) ;
    Border border = getBorder() ;
    if( border != null ) {
    Insets insets = border.getBorderInsets( this ) ;
    if( insets != null ) {
    w += ( insets.left + insets.right ) ;
    h += ( insets.top + insets.bottom ) ;
    Dimension dim = new Dimension( w, h ) ;
    this.setPreferredSize( dim ) ;
    private int placement = CENTER ;
    public int getPlacement() { return placement ; }
    public void setPlacement( int placement ) {
    if( ( placement < CENTER ) || ( placement > STRETCH ) ) {
    throw new IllegalArgumentException( "Unsupported placement value" ) ;
    this.placement = placement ;
    public void paint( Graphics gr ) {
    // x of Image to draw
    int x ;
    // y of Image to draw
    int y ;
    // width of Image to draw
    int iw ;
    // height of Image to draw
    int ih ;
    // thickness of left border
    int bl = 0 ;
    // thickness of upper border
    int bt = 0 ;
    // thickness of right border
    int br = 0 ;
    // thickness of lower border
    int bb = 0 ;
    // width of drawable area
    int pw = this.getWidth() ;
    // height of drawable area
    int ph = this.getHeight() ;
    // Handle borders
    Insets insets = null ;
    Border border = getBorder() ;
    if( border != null ) {
    insets = getBorder().getBorderInsets( this ) ;
    if( insets != null ) {
    bl = insets.left ;
    br = insets.right ;
    bb = insets.bottom ;
    bt = insets.top ;
    pw = pw - bl - br ;
    ph = ph - bt - bb ;
    // Always display background, for supporting transparency.
    super.paint( gr ) ;
    if( image != null ) {
    iw = image.getWidth( imageObserver ) ;
    ih = image.getHeight( imageObserver ) ;
    if( ( placement == STRETCH ) ||
    ( iw > pw ) ||
    ( ih > ph )
    gr.drawImage(image, bl, bt, pw, ph, imageObserver ) ;
    } else {
    iw = image.getWidth( imageObserver ) ;
    ih = image.getHeight( imageObserver ) ;
    switch( placement ) {
    case CENTER :
    x = ( pw - iw ) / 2 ;
    y = ( ph - ih ) / 2 ;
    break ;
    case NORTH :
    x = ( pw - iw ) / 2 ;
    y = 0 ;
    break ;
    case NORTHEAST :
    x = pw - iw ;
    y = 0 ;
    break ;
    case EAST :
    x = pw - iw ;
    y = (ph - ih ) / 2 ;
    break ;
    case SOUTHEAST :
    x = pw - iw ;
    y = ph - ih ;
    break ;
    case SOUTH :
    x = ( pw - iw ) / 2 ;
    y = ph - ih ;
    break ;
    case SOUTHWEST :
    x = 0 ;
    y = ph - ih ;
    break ;
    case WEST :
    x = 0 ;
    y = ( ph - ih ) / 2 ;
    break ;
    case NORTHWEST :
    x = 0 ;
    y = 0 ;
    break ;
    default :
    throw new IllegalArgumentException(
    "Unsupported placement value" ) ;
    // Add border offset
    x += bl ;
    y += bt ;
    gr.drawImage( image, x, y, this ) ;
    public final static int CENTER = 0 ;
    public final static int NORTH = 1 ;
    public final static int NORTHEAST = 2 ;
    public final static int EAST = 3 ;
    public final static int SOUTHEAST = 4 ;
    public final static int SOUTH = 5 ;
    public final static int SOUTHWEST = 6 ;
    public final static int WEST = 7 ;
    public final static int NORTHWEST = 8 ;
    public final static int STRETCH = 9 ;

  • Display image in JPanel without saving any file to disk

    Hi,
    I am fetching images from database. I am saving this image, display in JPanel and delete it. But this is not actually I want.
    I wish to fetch this image as stream , store in memory and display in JPanel without saving any fiel in disk.
    I wonder if it is Possible or any used implementation that I can use in my project. Any idea or experienced knowledge is enough.
    Thanks

    In what format is the image coming to you from the database? If it's an InputStream subclass, just use javax.imageio.ImageIO:
    InputStream in = getImageInputStream();
    BufferedImage image = null;
    try {
       image = ImageIO.read(in);
    } finally {
       in.close();
    // ... Display image in your JPanel as you have beenIf you receive the image as an array of bytes, use the same method as above, but with a ByteArrayInputStream:
    byte[] imageData = getImageData();
    ByteArrayInputStream in = new ByteArrayInputStream(imageData);
    BufferedImage image = null;
    try {
       image = ImageIO.read(in);
    } finally {
       in.close();
    // ... Display image in your JPanel as you have been

  • Having trouble with image processor...help please!

    HI there...First off I just bought a new iMac and haven't a clue what I'm doing so my problem could be related to that.  While I'm waiting for Adobe to transfer over my platform I downloaded the trial of CS5 Extended to get me started.  I'm having trouble with the image processor...I choose file/scripts/image processor...the dialog box comes up and I choose use open files and then try and choose the folder I want to save them in.  I choose my folder and hit run and it keeps telling me specify folder destination.  I can't for the life of me figure this out...what am I doing wrong?  It always worked fine for me on my PC and CS3.  I can't handle saving each image individually in the new folder...
    Thanks!!

    I haven't renamed anything as far as I know.  I made a new folder when I hit Folder option and it's highlighted as well as the path shows up in the processor box.  Just when I choose run it tells me to specify a folder.  The only thing I can think of is that maybe something messed up b/c I'm copied the files and folders over from my PC but it let me save as on the mac.  Also the folder I'm choosing to put them in is on the Mac harddrive.  IDK...

  • Im having trouble saving images from photoshop to my samsung tablet any ideas

    im having trouble saving photoshopped imsges onto my samsung tablet any ideas ?

    I have no knowledge of the Android OS.  I do have an iPod and its OS iOS is not really comparable my Windows  OS.  The iPod does mount as a dive on windows and the iPod camera roll is accessible. The jpes images can be copied to my pc.  However the PC does not have access to the iOS file system even apple user don't have real access the iOS file system.   Image need to be synced between the iPod and PC through iTunes sync.  Itunes messes with your PC images and creates some sort of image database and syncs that database between PC and Apple mobile devices.  There are also apps that help you share file between PC and Apple mobile devices.  I have no idea how files are shared between PC Operating Systems platform versions and Android OS versions.  Photoshop may not be able to save to Android files system.  Photoshop Can not save to Apple mobile devices. Photoshop may be able to save to Apple's Mac unix file system through some form of network share.
    How does one share files between Android devices and PC OS devices?

  • Help! I'm having trouble with images on my web page.

    I'm trying to create a page with a bunch of my photos but I need the photos broken up into groups so I can discuss the different groups. So I simply cut and paste the photo area several times BUT now when I click on any picture in any group it only does a slideshow for the last group of photos.
    I guess I could simply break the single page into multiple pages but that is so inconvenient in iWeb since it doesn't let you cut and paste template pages! Apple needs to seriously fix this shortcoming. How can you not allow cutting and pasting of pages??
    Here's the page I'm having trouble with:
    http://photo.braintransplants.com/Site/Astronomy.html
    Thanks!
    PowerBook G4 17 (A1085) 1.5 GHz / 1.5 GB RAM / 128 MB VRAM / 80 GB HD   Mac OS X (10.4.2)  

    You probably realise by now that you're attempting to do things with iWeb which it just wasn't intended to do. Cutting and pasting the photo grid area just won't work as you want it to. To work within iWeb's limitations might i suggest that you use the 'nesting' approach described in several posts here already. Use a single representative image on your main page for each of the situations you want to cover, and link each of these to an appropriate Photo page which has 'Include page in navigation menu' unchecked.
    You could add a link on each of the Photo pages which returns to your main descriptive page.

  • Display image using JPanel

    i have got buffered image from webcam using jmf. i want to display it on JPanel.
    i override paint() but it doesn't display as it captures
    when i maximize window it then displays
    urgent help needed

    The bounds of your JPanel may be incorrect. You should try the setBounds(int x, int y, int width, int height) method on it.
    Please past your code for more help :p

Maybe you are looking for