Changing images on jsp

I created a jsp page with a button and a image (ImageComponent). When the button is pressed a picture is retrieved from a database and saved on the CLIENTs harddrive (ex: "C:\\img.jpg"). After this the image should be changed to the picture just downloaded from the database.
The tried to call the methode:
image.setUrl("C:\\img.jpg");
then the current image dissapears, but the new image isn't displayed.
Did I used the right methode, or should I just call some kind of refresh methode? Can you please help.
THANX

Google "banner rotation".
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"informatic-tec" <[email protected]> wrote in
message
news:efj729$mpa$[email protected]..
> Hellow to everybody, i would like to know witch is the
html code or script
> that let me change images on and web page any time i
refres it.
>
> I would like to make a page with 4 images at the top,
that change
> any time that one user refresh it.
>
> Thanks to anyone who can help me.
>
> David
>
>
>

Similar Messages

  • How to change image in jsp in a web application

    I had created a web application in which I have given the option to change the image in a jsp, and I am saving that image in a folder.
    The image is saved during the run time.But I am not getting that changed image.
    If I restart my server the image is retrieved . What is the solution for getting the changed image during the runtime itself?

    use javascript
    example:
    <img id='img' src="Img1.gif" border=0
         onMouseover="document.getElementById('img').src='Img2.gif'"
         onMouseout="document.getElementById('img').src='Img1.gif'">

  • How to change images dynamically in jsp?

    Hi All,
    i Want to know how to change images dynamically in jsp, for example in any site if u look at advertise or any images, it will be changed after every few seconds.
    Please guide me
    Thanks
    Sandesh S

    sandeshas wrote:
    Hi BlusC,
    i was searching your mail Id to ask the question directly to u,i checked in your blog also, but i didnt get,I want to keep my email spam safe. Only trusted people and direct friends have it. Just use the forums for discussion.
    my question is suppose if i want to display and change the advertise(adds from different company ) in my web site,how can i do it by using jsp?
    Do i need to create animated gifs which contains all company adds??one might be from movie add,after few seconds next one migth be some other web site add like that, how can i achieve this in my servet,jsp or using struts.You create animated gifs with an [animated gif editor|http://google.com/search?q=animated+gif+editor]. There is nothing what JSP can do for you here.

  • Dynamic imaging in jsp doesnt work

              Hi,
              The following piece of code works in tomcat but does not work in weblogic. can
              anybody please help me with this.
              <%@ page contentType="image/jpeg" import="java.awt.*,java.awt.image.*,com.sun.image.codec.jpeg.*,java.util.*"%>
              <%
              // Create image
              int width=200, height=200;
              BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
              // Get drawing context
              Graphics g = image.getGraphics();
              // Fill background
              g.setColor(Color.white);
              g.fillRect(0, 0, width, height);
              // Create random polygon
              Polygon poly = new Polygon();
              Random random = new Random();
              for (int i=0; i < 5; i++) {
              poly.addPoint(random.nextInt(width),
              random.nextInt(height));
              // Fill polygon
              g.setColor(Color.cyan);
              g.fillPolygon(poly);
              // Dispose context
              g.dispose();
              // Send back image
              ServletOutputStream sos = response.getOutputStream();
              JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
              encoder.encode(image);
              %>
              Thanx in advance.
              regards,
              Subramaniam
              

              Thanx a lot.Just read your solution again. Didnt get it the first time .Its pretty
              interesting.I think i will opt for the servlets solution.
              Dimitri Rakitine <[email protected]> wrote:
              >I thought I did. This version works (on 6.1 at least) :
              >
              >----------
              ><%@ page contentType="image/jpeg" import="java.awt.*,java.awt.image.*,com.sun.image.codec.jpeg.*,java.util.*"%><%
              >
              >// Create image
              >int width=200, height=200;
              >BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
              >
              >// Get drawing context
              >Graphics g = image.getGraphics();
              >
              >// Fill background
              >g.setColor(Color.white);
              >g.fillRect(0, 0, width, height);
              >
              >// Create random polygon
              >Polygon poly = new Polygon();
              >Random random = new Random();
              >for (int i=0; i < 5; i++) {
              > poly.addPoint(random.nextInt(width),
              > random.nextInt(height));
              >}
              >
              >// Fill polygon
              >g.setColor(Color.cyan);
              >g.fillPolygon(poly);
              >
              >// Dispose context
              >g.dispose();
              >
              >// Send back image
              >ServletOutputStream sos = response.getOutputStream();
              >JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
              >encoder.encode(image);
              >%>
              >----------
              >
              >Subramaniam <[email protected]> wrote:
              >
              >> Hi,
              >
              >> There is out.println("\n")'s in the java file generated by weblogic.
              >There is
              >> out.write("\n")'s in the java file generated by tomcat. So does that
              >make a difference
              >> ?
              >
              >> You told me to make a change in the jsp - could you be more specific
              >as to what
              >> change needs to be made(if i dont want to use a servlet).
              >
              >> Thanx in advance,
              >
              >> Subramaniam
              >
              >> Dimitri Rakitine <[email protected]> wrote:
              >>>Look at the generated .java file - WebLogic's JSP compiler adds
              >>>'out.println("\n")'s at the beginning. Try to change your JSP (or,
              >>>even better, use servlet to generate images) :
              >>>
              >>><%@ page contentType="image/jpeg" import="java.awt.*,java.awt.image.*,com.sun.image.codec.jpeg.*,java.util.*"%><%
              >>>
              >>>// Create image
              >>>int width=200, height=200;
              >>>BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
              >>>
              >>>// Get drawing context
              >>>Graphics g = image.getGraphics();
              >>>
              >>>// Fill background
              >>>g.setColor(Color.white);
              >>>g.fillRect(0, 0, width, height);
              >>>
              >>>// Create random polygon
              >>>Polygon poly = new Polygon();
              >>>Random random = new Random();
              >>>for (int i=0; i < 5; i++) {
              >>> poly.addPoint(random.nextInt(width),
              >>> random.nextInt(height));
              >>>}
              >>>
              >>>// Fill polygon
              >>>g.setColor(Color.cyan);
              >>>g.fillPolygon(poly);
              >>>
              >>>// Dispose context
              >>>g.dispose();
              >>>
              >>>// Send back image
              >>>ServletOutputStream sos = response.getOutputStream();
              >>>JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
              >>>encoder.encode(image);
              >>>%>
              >>>
              >>>Subramaniam <[email protected]> wrote:
              >>>
              >>>> Hi,
              >>>
              >>>> The following piece of code works in tomcat but does not work in
              >weblogic.
              >>>can
              >>>> anybody please help me with this.
              >>>
              >>>
              >>>
              >>>> <%@ page contentType="image/jpeg" import="java.awt.*,java.awt.image.*,com.sun.image.codec.jpeg.*,java.util.*"%>
              >>>
              >>>> <%
              >>>
              >>>> // Create image
              >>>> int width=200, height=200;
              >>>> BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
              >>>
              >>>> // Get drawing context
              >>>> Graphics g = image.getGraphics();
              >>>
              >>>> // Fill background
              >>>> g.setColor(Color.white);
              >>>> g.fillRect(0, 0, width, height);
              >>>
              >>>> // Create random polygon
              >>>> Polygon poly = new Polygon();
              >>>> Random random = new Random();
              >>>> for (int i=0; i < 5; i++) {
              >>>> poly.addPoint(random.nextInt(width),
              >>>> random.nextInt(height));
              >>>> }
              >>>
              >>>> // Fill polygon
              >>>> g.setColor(Color.cyan);
              >>>> g.fillPolygon(poly);
              >>>
              >>>> // Dispose context
              >>>> g.dispose();
              >>>
              >>>> // Send back image
              >>>> ServletOutputStream sos = response.getOutputStream();
              >>>> JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
              >>>> encoder.encode(image);
              >>>> %>
              >>>
              >>>
              >>>> Thanx in advance.
              >>>> regards,
              >>>> Subramaniam
              >>>
              >>>--
              >>>Dimitri
              >
              >
              >--
              >Dimitri
              

  • Problem in displaying image on jsp page

    I want to display an image on jsp page.I copied the image the image in WebContent folder.
    I am able to see the image on the design pane when using the following code:-
    <img src="/image.gif" height="50" width="50"> but when i run it in the browser nothing gets diplsyed.
    also when i use the image container and select the source option that image is not displayed in the WebContents file..plz help.

    Hi,
    Seems that the Problem is there with the way how you specifuied the Image relative Path:
    You have specified the below: The opath of image starts with (/) forward slash:
    *<img src="/image.gif" height="50" width="50">*
    It means to access this Image WebLogic Container will form a Path like this:
    http://localhost:7001/image.gif
    BUT may be the image is available inside your Context root: So Change the <Img> tag like following in your JSP:
    *<img src="image.gif" height="50" width="50">*
    (*NOTE:* Never Start your src path with a Preceesing /)
    Now WLE will consider the path like below ..if your Applications Context root is "TestApp"
    http://localhost:7001/TestApp/image.gif
    I am Assuming that Inside the TestApp Application "image.gif" And "your.jsp" jSP pages are Co-Located (Means available in the Same Directory).
    Thanks
    Jay SenSharma
    http://jaysensharma.wordpress.com (WebLogic Magical Stuff)

  • Best way to manage images on jsp web application

    Hi,
    Am developing a jsp web application, in that project, the user will upload the image files, now I created an image directory in the context root and when the image is uploaded by the user it is saved in the /images directory and the image path is saved in the database. I can display this image using the <img src="images/a.jsp" > tag.
    but when I rebuild the project all the images in the /images directory get deleated but the image path is remained in the database, is there any method that I make /image dir outside my project context root so that when I rebuild the project the /images dir can get changed and my project will save images outside the context root that is in the /images dir which is now outside the project context root. and is it possible to display those images using <img src""> tag. because this time my /images dir is at D:/images . what could be the best method or way to handle images with the web application.
    any suggestion will be helpfull

    Well my friend as per your given case there are to two ways of approaching your problem.
    Case 1:
    How to save the relevant data ??
    .Create a backup folder Workstation on which you are hosting your application where you can store all the uploaded files which is outside the scope of webserver(However we can write a dedicated servlet which can access that file) and make sure we pickup from any the folder path from a specfic MessageResource bundle or an context/servlet init parameter in web.xml.
    .Write a Upload servlet/Backing Bean which saves all the files in the discussed folder using utility packages like Commons FileUpload,Oreilly MultipartRequest & etc and then register saved fileName in the database user specfic table specific to user.
    How to display the Image ??
    .Write a dedicated servlet which can pickup user related fileName specfic information from the database and the read the file from backup folder by constructing the path from the entry made as a init param in web.xml or any other custom MessageResource bundle and then stream the Image data using the ServletOutputStream.
    NOTE: do not forget to pickup & setImage file ContentType & Set the content length.
    .Just try to render the JSP view file where we are displaying the displaying the images by calling the dedicated ImageServlet.
    <img src="ImageServlet?userid=2345" align="center"/>Try to refer below posts to get a better understading.
    Dedicated Image Servlet:
    http://forum.java.sun.com/thread.jspa?threadID=5208858&messageID=9840042#9840042
    Uploading Files Using Servlet:
    http://muimi.com/j/jakarta/commons/fileupload/
    Case 2
    The second method would more or less the same but here we would save the uploaded file
    content is saved in the Database as a Blob and we would retrive it back using a dedicated image servlet again.
    However,in terms of performance the second case implementation is very costly.
    Try to refer below posts to get a better understading on the second case.
    http://forum.java.sun.com/thread.jspa?threadID=5193481&tstart=50
    http://forum.java.sun.com/thread.jspa?threadID=5211649&messageID=9853670#9853670
    Hope this might help :)
    REGARDS,
    RaHuL

  • Change image contrast

    Hi,
    I need to change image contrast, that code working for .bmp image only.
    public static BufferedImage rescale(BufferedImage indexed,
                   float scaleFactor, float offset) {
              System.out.println(indexed.getHeight());
              IndexColorModel icm = (IndexColorModel) indexed.getColorModel();
              return new BufferedImage(rescale(icm, scaleFactor, offset), indexed
                        .getRaster(), false, null);
    public static IndexColorModel rescale(IndexColorModel icm,
                   float scaleFactor, float offset) {
              int size = icm.getMapSize();
              byte[] reds = new byte[size], greens = new byte[size], blues = new byte[size], alphas = new byte[size];
              icm.getReds(reds);
              icm.getGreens(greens);
              icm.getBlues(blues);
              icm.getAlphas(alphas);
              rescale(reds, scaleFactor, offset);
              rescale(greens, scaleFactor, offset);
              rescale(blues, scaleFactor, offset);
              return new IndexColorModel(8, size, reds, greens, blues, alphas);
         public static void rescale(byte[] comps, float scaleFactor, float offset) {
              for (int i = 0; i < comps.length; ++i) {
                   int comp = 0xff & comps;
                   int newComp = Math.round(comp * scaleFactor + offset);
                   if (newComp < 0)
                        newComp = 0;
                   else if (newComp > 255)
                        newComp = 255;
                   comps[i] = (byte) newComp;
         }If i am use .jpeg or .jpg image then following error will appearjava.lang.ClassCastException: java.awt.image.ComponentColorModel
         at com.maan.image.DAO.ImageBean.rescale(ImageBean.java:141)
         at com.maan.image.DAO.ImageBean.loadImage(ImageBean.java:39)
         at org.apache.jsp.imgManipulation.alterImage_jsp._jspService(org.apache.jsp.imgManipulation.alterImage_jsp:59)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)any one help me, what i am going to do,
    Thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    My guess is that it's this line:
    IndexColorModel icm = (IndexColorModel) indexed.getColorModel(); The BufferedImage that you are sending to rescale probably uses a ComponentColorModel when you load from a .jpg and an IndexColorModel when you load from a .bmp file. You can't cast between the two. You may be able to do what you're trying to do by using the getRBG method from BufferedImage and forget about the ColorModel.

  • How to change images based on action.Even clicking changed images should ?

    how to change images based on action.
    Even clicking changed images should do respective actions.
    and while displaying only one image at a time sholud get displayed.
    I am using three images for a single column of a table in Jsp.
    Any clues.
    Any link for any good javascript html jsp site where i can find some good solution.
    vijendra

    In broad way if i say i have multiple situations in mutiple tables where i need such a logic to operate in for all tables.
    lets say in first time load of page by default one image will be displayed (one with sorted order for first column rest all non sorted)Now after every click to any image respective sort should get called.along with all images should get changed.Here with every function one/two images will get effect at least.
    As in first if i say sort by desc then this image will change rest all will remain in unsort form.
    when i move to other column and click on new image the previos will convert to unsort and new one will convert to sort by ascending. rest all will be in unsort form as it is.
    Now it seems like same logic is required with two three conditions.
    even for everyaction different parametrs has to be passed at differnt situations.
    Any good idea if someone can suggest.
    I will be very greatful for him.
    thanks
    vijendra

  • Problem with displaying BLOB images on JSP page using a servlet

    hi. I have a big problem with displaying BLOB images using JSP. I have a servlet that connects to the oracle database, gets a BLOB image , reads it, and then displays it using a BinaryStream. The problem is , this works only when i directly call that servlet, that is http://localhost:8080/ImageServlet. It doesn't work when i try to use that servlet to display my image on my JSP page (my JSP page displays only a broken-image icon ) I tried several coding approaches with my servlet (used both Blob and BLOB objects), and they work just fine as long as i display images explicitly using only the servlet.
    Here's what i use : ORACLE 10g XE , Eclipse 3.1.2, Tomcat 5.5.16 , JDK 1.5
    here is one of my image servlet's working versions (the essential part of it) :
                   BLOB blob=null;
              rset=st.executeQuery("SELECT * FROM IMAGES WHERE ID=1");
              while (rset.next())
                   blob=((OracleResultSet)rset).getBLOB(2);
              response.reset();
              response.setContentType("image/jpeg");
              response.addHeader("Content-Disposition","filename=42.jpeg");
                    ServletOutputStream ostr=response.getOutputStream();
                   InputStream istr=blob.getBinaryStream(1L);
                    int size=blob.getBufferSize();
              int len=-1;
                    byte[] buff = new byte[size];
                         while ((len=istr.read( buff ))!=-1 ) {
                   ostr.write(buff,0,len);
             response.flushBuffer();
             ostr.close(); and my JSP page code :
    <img src="/ImageServlet" border="0"  > If you could just tell me what i'm doing wrong here , or if you could show me your own solutions to that problem , i would be very greatful ,cos i'm realy stuck here , and i'm rather pressed for time too. Hope someone can help.

    I turns out that it wasn't that big of a problem after all. All i had to do was to take the above code and place it into another JSP page instead of into a servlet like i did before. Then i just used that page as a source for my IMG tag in my first JSP. It works perfectly well. Why this doesn't work for servlets i still don't know, but it's not a problem form me anymore . Ofcourse if someone knows the answer , go ahead and write. I would still appriceatte it.
    here's the magic tag : <img src="ImageJSP.jsp" border="0"  > enjoy : )

  • Display image in JSP Portlet

    I create a JSP portlet. But The portlet can't display image(gif file, jpg file). I have modified the provider.xml and the following line is added:
    <imageURL>URL_Path</imageURL>
    But, the image still cannot be displayed.
    How can I display image in JSP portlet?

    Leo Cheung,
    You could try the following :
    1. Add a virtual directory path Alias 'imgf' in the Apache configuration file httpd.conf to load the image file. Add the following line under the alias section :
    Alias /imgf/ "<your directory>\images/"
    2. Place your gif/jpg files (eg., work.gif) in the images directory.
    3. Use the IMG tag of HTML :
    <IMG src="/imgf/work.gif" border=0 width=80 height=80> in the JSP file at the location where you need to display the image.
    Hope this helps
    Pushkala

  • How to display uploaded image in jsp page.

    Hello,
    I am using struts 1.2.9 and and have uploaded image on the server. Now what I want to do display the image in jsp page after clicking on one link in jsp. I have tried many thing to display image in jsp page. But I am getting an error during displaying image in jsp. I have displayed absolute path in servlet. and used InputStream and outputstream to display image in jsp page.
    Can any one help.
    Thanks in advance
    Manveer Singh

    Follow this. This topic is very popular recently on the forum.

  • Changing Images at Runtime...it's sending me nuts (I'm a newbie, go easy)

    Hi all,
    I am trying change images at runtime and quite frankly it's driving me nuts. I'm pretty new to Java and don't understand some of the principles but I'm trying. I have this code below, that loads up a few images. I want to be able to change some/all of these images either on a timed even or on a button press, but all the things I've tried don't work. Can someone offer me some help....thanks in advance
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class bc extends JFrame implements ActionListener {
         public static void main(String[] args) {new bc();}
         bc() {
              //setUndecorated(true); // - this removed the titlebar!
                    setTitle("BC...");
              setSize(350,125);
              setResizable(false);
              setLocation(50,50);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              setBackground(new Color(0,0,0));
              getContentPane().setBackground(new Color(255,255,255));
              JPanel hours = new JPanel();
              hours.setLayout(new GridLayout(4,2));
              hours.add(hour14);
              hours.add(hour24);
              hours.add(hour13);
              hours.add(hour23);
              hours.add(hour12);
              hours.add(hour22);
              hours.add(hour11);
              hours.add(hour21);
              JPanel mins = new JPanel();
              mins.setLayout(new GridLayout(4,2));
              mins.add(min14);
              mins.add(min24);
              mins.add(min13);
              mins.add(min23);
              mins.add(min12);
              mins.add(min22);
              mins.add(min11);
              mins.add(min21);
              JPanel secs = new JPanel();
              secs.setLayout(new GridLayout(4,2));
              secs.add(sec14);
              secs.add(sec24);
              secs.add(sec13);
              secs.add(sec23);
              secs.add(sec12);
              secs.add(sec22);
              secs.add(sec11);
              secs.add(sec21);
              JPanel helptext = new JPanel();
              helptext.setLayout(new GridLayout(4,2));
              helptext.add(new JLabel("8"));
              helptext.add(new JLabel("4"));
              helptext.add(new JLabel("2"));
              helptext.add(new JLabel("1"));
    //add action listenters
              changeImg.addActionListener(this);
              JPanel cp = new JPanel();
              cp.setLayout(new GridLayout(1,6));
              cp.setBackground(new Color(255,255,255));
              cp.add(hours);
              cp.add(mins);
              cp.add(secs);
              cp.add(helptext);
              cp.add(changeImg);
              setContentPane(cp);
              setVisible(true);
         public void actionPerformed(ActionEvent ae) {
              hour11.PaintOff(1);
              //JOptionPane.showMessageDialog(this, "changed");
              repaint();
    JPanel hour11 = new PaintOff(0);
    JPanel hour12 = new PaintOff(0);
    JPanel hour13 = new PaintBlank();
    JPanel hour14 = new PaintBlank();
    JPanel hour21 = new PaintOff(0);
    JPanel hour22 = new PaintOff(0);
    JPanel hour23 = new PaintBlank();
    JPanel hour24 = new PaintBlank();
    JPanel min11 = new PaintOff(0);
    JPanel min12 = new PaintOff(0);
    JPanel min13 = new PaintOff(0);
    JPanel min14 = new PaintOff(0);
    JPanel min21 = new PaintOff(0);
    JPanel min22 = new PaintOff(0);
    JPanel min23 = new PaintOff(0);
    JPanel min24 = new PaintOff(0);
    JPanel sec11 = new PaintOff(0);
    JPanel sec12 = new PaintOff(0);
    JPanel sec13 = new PaintOff(0);
    JPanel sec14 = new PaintOff(0);
    JPanel sec21 = new PaintOff(0);
    JPanel sec22 = new PaintOff(0);
    JPanel sec23 = new PaintOff(0);
    JPanel sec24 = new PaintOff(0);
    JButton changeImg = new JButton("change");
    }///---------This is my PaintOff class ---------------\\\
    import javax.swing.*;
    import java.awt.*;
    import java.awt.Image.*;
    public class PaintOff extends JPanel {
    Toolkit tk = Toolkit.getDefaultToolkit();
    public Image imgOff = tk.getImage("off.jpg");
    public Image imgOn = tk.getImage("on.jpg");
    public Image paintMe = tk.getImage("off.jpg");
         PaintOff(int a) {
              if(a == 1) {
                   vOn();
              } else {
                   vOff();
         public void vOn() {
            paintMe = imgOn;
         //JOptionPane.showMessageDialog(new bc(), "shown");
         public void vOff() {
            paintMe = imgOff;
         public void paintComponent(Graphics g) {
              g.drawImage(paintMe,0,0,this);
    }PaintBlank class is not included here, it's basically just the same as PaintOff but only has one image inside.
    When I try and compile this code, I get
    C:\jdk1.4\bin\bclock>javac bc.java
    bc.java:79: cannot resolve symbol
    symbol : method PaintOff (int)
    location: class javax.swing.JPanel
    hour11.PaintOff(1);
    ^
    1 error
    I don't understand this either, I've tried replacing "PaintOff(1)" with "vOn()" but I get the same error. This is baffling to be, as I thought that the hour11 would have access to all the methods inside the PaintOff class?
    Anyway, thanks for any help you guys give me!
    Cheers
    //Chris.

    Hi!
    Your problem is that you've used a widening conversion to convert from PaintOff to a JPanel. JPanel has no such method, and so the compiler is complaining that it can't find it.
    e.g
    public class NoCompile{
         public static void main(String args[]){
              One one = new Two();
              one.methTwo();
    public class Two extends One{
         public Two(){}
         public void methTwo(){
            System.out.println("Executed 2");
    public class One{
         public One(){}
         public void meth1(){}
    } will give you the same sort of error message. To make the compiler happy, use a cast.
    Now this will compile and gives the right result.
    public class NoCompile{
         public static void main(String args[]){
              One one = new Two();
              ((Two)one).methTwo();
    }So in your case, you want to do
    ((PaintOff)hour11).vOn();
    Does that help?
    :) jen

  • Photoshop Elements 5.0 - won't let me change image aspect ratio. Box is greyed out. Have reinstalled

    I've been using Photoshop Elements 5.0 for years.  As of today, it won't let me change image aspect ratio. Box is greyed out. Have reinstalled the program with no change

    Where in photoshop elements 5 are you seeing the "Box" geyed out?
    Or how are you trying to change the image aspect ratio?

  • Filter plugin. Problem after change image depth.

    Hi All !
    I already wrote filter plugin it work fine but only for image depth 8bit, after i change image depth on 16 or 32 bits I getting error msg box from photoshop.
    I try change on 'destination.colBits = 8' or 'destination.colBits = pChannel->depth' or ' (pChannel->bounds.bottom - pChannel->bounds.top) * pChannel->depth;'  but all the same.
    PixelMemoryDesc destination;
    destination.data = data; //*pixel
    destination.depth = pChannel->depth;
    destination.rowBits = (pChannel->bounds.right - pChannel->bounds.left) * pChannel->depth;
    destination.colBits = 8;
    destination.bitOffset = 0 ;
    Please help someone !
    Very Thanks in Advance !
    All code below:
    //  Gauss.cpp
    //  gauss
    //  Created by Dmitry Volkov on 30.12.14.
    //  Copyright (c) 2014 Automatic System Metering. All rights reserved.
    #include "Gauss.h"
    #include "GaussUI.h"
    #include "FilterBigDocument.h"
    #include <fstream>
    using namespace std;
    SPBasicSuite* sSPBasic = NULL;
    FilterRecord* gFilterRecord = NULL;
    PSChannelPortsSuite1* sPSChannelPortsSuite = NULL;
    PSBufferSuite2* sPSBufferSuite64 = NULL;
    int16* gResult = NULL;
    void DoParameters ();
    void DoPrepare ();
    void DoStart ();
    void DoFinish ();
    void DoEffect();
    void GaussianBlurEffect(ReadChannelDesc* pChannel, char* data);
    void ReadLayerData(ReadChannelDesc* pChannel, char* pLayerData);
    void WriteLayerData(ReadChannelDesc* pChannel, char* pLayerData);
    DLLExport MACPASCAL void PluginMain(const int16 selector,
                                        FilterRecordPtr filterRecord,
                                        intptr_t * data,
                                        int16 * result)
        sSPBasic = filterRecord->sSPBasic;
        gFilterRecord = filterRecord;
        gResult = result;
        try {
                if (sSPBasic->AcquireSuite(kPSChannelPortsSuite,
                                                   kPSChannelPortsSuiteVersion3,
                                                   (const void **)&sPSChannelPortsSuite))
                    *gResult = errPlugInHostInsufficient;
                if (sSPBasic->AcquireSuite( kPSBufferSuite,
                                                   kPSBufferSuiteVersion2,
                                                   (const void **)&sPSBufferSuite64))
                    *gResult = errPlugInHostInsufficient;
                if (sPSChannelPortsSuite == NULL || sPSBufferSuite64 == NULL)
                    *result = errPlugInHostInsufficient;
                    return;
                switch (selector)
                    case filterSelectorParameters:
                        DoParameters();
                        break;
                    case filterSelectorPrepare:
                        DoPrepare();
                        break;
                    case filterSelectorStart:
                        DoStart();
                        break;
                    case filterSelectorFinish:
                        DoFinish();
                        break;
        catch (...)
            if (NULL != result)
                *result = -1;
    void DoParameters ()
    void DoPrepare ()
    void DoStart ()
        if (*gResult == noErr)
            if (doUi())
                DoEffect();
    void DoFinish ()
    #define defColBits 8
    void DoEffect()
        // Start with the first target composite channel
        ReadChannelDesc *pChannel = gFilterRecord->documentInfo->targetCompositeChannels;
        // Calculation width and height our filter window
        int32 width = pChannel->bounds.right - pChannel->bounds.left;
        int32 height = pChannel->bounds.bottom - pChannel->bounds.top;
        fstream logFile ("/Volumes/Macintosh Media/GaussLogFile.txt", ios::out);
        logFile << endl << "top " << pChannel->bounds.top;
        logFile << endl << "bottom " << pChannel->bounds.bottom;
        logFile << endl << "left " << pChannel->bounds.left;
        logFile << endl << "right " << pChannel->bounds.right;
        logFile << endl << "depth " << pChannel->depth;
        logFile << endl << "vRes " << gFilterRecord->documentInfo->vResolution;
        logFile << endl << "hRes " << gFilterRecord->documentInfo->hResolution;
        // Get a buffer to hold each channel as we process. Note we can using standart malloc(size_t) or operator new(size_t)
        // functions, but  Adobe recommend sPSBufferSuite64->New() for memory allocation
        char *pLayerData = sPSBufferSuite64->New(NULL, width*height*pChannel->depth/8);
        if (pLayerData == NULL)
            return;
        // we may have a multichannel document
        if (pChannel == NULL)
            pChannel = gFilterRecord->documentInfo->alphaChannels;
        // Loop through each of the channels
        while (pChannel != NULL && *gResult == noErr)
            ReadLayerData(pChannel, pLayerData);
            GaussianBlurEffect(pChannel, pLayerData);
            WriteLayerData(pChannel, pLayerData);
            // off to the next channel
            pChannel = pChannel->next;
        pChannel = gFilterRecord->documentInfo->targetTransparency;
        // Delete pLayerData
        sPSBufferSuite64->Dispose((char**)&pLayerData);
    void GaussianBlurEffect(ReadChannelDesc* pChannel, char *data)
        // Make sure Photoshop supports the Gaussian Blur operation
        Boolean supported;
        if (sPSChannelPortsSuite->SupportsOperation(PSChannelPortGaussianBlurFilter,
                                                    &supported))
            return;
        if (!supported)
            return;
        // Set up a local rect for the size of our port
        VRect writeRect = pChannel->bounds;
        PIChannelPort inPort, outPort;
        // Photoshop will make us a new port and manage the memory for us
        if (sPSChannelPortsSuite->New(&inPort,
                                      &writeRect,
                                      pChannel->depth,
                                      true))
            return;
        if (sPSChannelPortsSuite->New(&outPort,
                                      &writeRect,
                                      pChannel->depth,
                                      true))
            return;
        // Set up a PixelMemoryDesc to tell how our channel data is layed out
        PixelMemoryDesc destination;
        destination.data = data; //*pixel
        destination.depth = pChannel->depth;
        destination.rowBits = (pChannel->bounds.right - pChannel->bounds.left) * pChannel->depth;
        destination.colBits = defColBits;
        destination.bitOffset = 0 ;
        // Write the current effect we have into this port
        if (sPSChannelPortsSuite->WritePixelsToBaseLevel(inPort,
                                                         &writeRect,
                                                         &destination))
            return;
        // Set up the paramaters for the Gaussian Blur
        PSGaussianBlurParameters gbp;
        int inRadius = 1;
        Fixed what = inRadius << 16;
        gbp.radius = what;
        gbp.padding = -1;
        sPSChannelPortsSuite->ApplyOperation(PSChannelPortGaussianBlurFilter,
                                                                 inPort,
                                                                 outPort,
                                                                 NULL,
                                                                 (void*)&gbp,
                                                                 &writeRect);
        if (sPSChannelPortsSuite->ReadPixelsFromLevel(outPort,
                                                      0,
                                                      &writeRect,
                                                      &destination))
            return;
        // Delete the temp port in use
        sPSChannelPortsSuite->Dispose(&inPort);
        sPSChannelPortsSuite->Dispose(&outPort);
    void ReadLayerData(ReadChannelDesc *pChannel, char *pLayerData)
        // Make sure there is something for me to read from
        Boolean canRead;
        if (pChannel == NULL)
            canRead = false;
        else if (pChannel->port == NULL)
            canRead = false;
        else if (sPSChannelPortsSuite->CanRead(pChannel->port, &canRead))
            // this function should not error, tell the host accordingly
            *gResult = errPlugInHostInsufficient;
            return;
        // if everything is still ok we will continue
        if (!canRead || pLayerData == NULL)
            return;
        // some local variables to play with
        VRect readRect = pChannel->bounds;
        PixelMemoryDesc destination;
        // set up the PixelMemoryDesc
        destination.data = pLayerData;
        destination.depth = pChannel->depth;
        destination.rowBits = pChannel->depth * (readRect.right - readRect.left);
        destination.colBits = defColBits;
        destination.bitOffset = 0 ;
        // Read this data into our buffer, you could check the read_rect to see if
        // you got everything you desired
        if (sPSChannelPortsSuite->ReadPixelsFromLevel(
                                                      pChannel->port,
                                                      0,
                                                      &readRect,
                                                      &destination))
            *gResult = errPlugInHostInsufficient;
            return;
    void WriteLayerData(ReadChannelDesc *pChannel, char *pLayerData)
        Boolean canWrite = true;
        if (pChannel == NULL || pLayerData == NULL)
            canWrite = false;
        else if (pChannel->writePort == NULL)
            canWrite = false;
        else if (sPSChannelPortsSuite->CanWrite(pChannel->writePort, &canWrite))
            *gResult = errPlugInHostInsufficient;
            return;
        if (!canWrite)
            return;
        VRect writeRect = pChannel->bounds;
        PixelMemoryDesc destination;
        destination.data = pLayerData;
        destination.depth = pChannel->depth;
        destination.rowBits = pChannel->depth * (writeRect.right - writeRect.left); //HSIZE * pChannel->depth * gXFactor*2;
        destination.colBits = defColBits;
        destination.bitOffset = 0 ;
        if (sPSChannelPortsSuite->WritePixelsToBaseLevel(
                                                         pChannel->writePort,
                                                         &writeRect,
                                                         &destination))
            *gResult = errPlugInHostInsufficient;
            return;

    Have you reviewed your code vs the Dissolve example? It is enabled for other bit depths as well.

  • Automator - Change Image Type - Multiple page PDF- TIFF conversion

    I was able to do this on a friend's computer (not sure which version of OS X they were running), but this seems impossible on Snow Leopard.
    I need to convert hundreds of multiple page PDFs to TIFFs. I can't get this to work, and the Change Image Type option only lists single page PDF conversion. I could separate PDFs into multiple files, convert to TIFFs, but then I don't know how to recombine a bunch of TIFF pages into a larger file. From google searches, I know this is possible using tiffutil, but I don't really understand how to use that well, and I really need an automatic process.
    I'm at my wits end with this, because I did it just last week on someone else's computer and it was easy as pie. Why can't you convert multiple page PDFs in Snow Leopard?
    Any ideas?
    Thanks!

    I just tried this - two problems.
    It creates a separate tiff document for each page of the input pdf.
    Also, this action is just annoying because it results in randomly named files in some temp folder that i can only locate using the reveal finder item action. I know I can rename files in automator, but I'd really like to have the output file have the same name as the input file.
    It confuses me why they would remove this functionality in Snow Leopard.

Maybe you are looking for