473,781 Members | 2,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Java applet with image effects, could you help me please

4 New Member
Hello everyone,

I've got a question about programming by using Java applet and the question is :
Design a web page containing an applet that simply switches from one image to the next with some transition effects such as :

Fade: Fade one image out while you fade the next one in.
Whirlpoo l fade: Building on the fade transition, rather than just fading between images the first image swirls out of focus; the swirl is then reversed and as it 'unswirls' the second image is revealed
Bathroom window fade: Again building on the fade transition, the image is broken up using a bathroom window effect, and as the effect is reversed the second image is revealed.


How to proceed

If you are unsure about how to tackle this exercise, then you may wish to break it down into smaller steps:
1.Create a basic web page with a static image
2.Replace the image with an applet that displays the image
3.Make the applet change between different images, and apply transitional effects to these changes.

Thanks in advance.
Oct 22 '06 #1
9 3239
r035198x
13,262 MVP
Hello everyone,

I've got a question about programming by using Java applet and the question is :
Design a web page containing an applet that simply switches from one image to the next with some transition effects such as :

Fade: Fade one image out while you fade the next one in.
Whirlpoo l fade: Building on the fade transition, rather than just fading between images the first image swirls out of focus; the swirl is then reversed and as it 'unswirls' the second image is revealed
Bathroom window fade: Again building on the fade transition, the image is broken up using a bathroom window effect, and as the effect is reversed the second image is revealed.


How to proceed

If you are unsure about how to tackle this exercise, then you may wish to break it down into smaller steps:
1.Create a basic web page with a static image
2.Replace the image with an applet that displays the image
3.Make the applet change between different images, and apply transitional effects to these changes.

Thanks in advance.
So where have you got so far? Were you able to create an html page with a picture on it? Were you able to make an applet that diplays a picture?
Oct 23 '06 #2
takeiteasy
4 New Member
I do not need to make it with HTML
I need just to make applet that displays pictures with the effects in any Java software like “ Netbeans”

this is some example of the effects on the pictures.

http://www.ericharshba rger.org/cgi-bin/j.cgi?imagediss olve/index.html

http://www.ericharshba rger.org/cgi-bin/j.cgi?imagefade/index.html

http://www.ericharshba rger.org/cgi-bin/j.cgi?imagefan/index.html

*** make the effects together ****

Many Thanks in advance
Oct 24 '06 #3
r035198x
13,262 MVP
I do not need to make it with HTML
I need just to make applet that displays pictures with the effects in any Java software like “ Netbeans”

this is some example of the effects on the pictures.

http://www.ericharshba rger.org/cgi-bin/j.cgi?imagediss olve/index.html

http://www.ericharshba rger.org/cgi-bin/j.cgi?imagefade/index.html

http://www.ericharshba rger.org/cgi-bin/j.cgi?imagefan/index.html

*** make the effects together ****

Many Thanks in advance
You still have to write something first. Can you write an applet that displays an image?
Oct 24 '06 #4
takeiteasy
4 New Member
You still have to write something first. Can you write an applet that displays an image?
Thank you for your answer .

the applet is something like that::

import java.awt.Graphi cs;
import java.awt.Image;
import java.net.URL;


public class NewClass extends javax.swing.JAp plet implements Runnable {
volatile Thread thread;

Image img;

public void ThreadApplet() {
}


public void init() {
try {
img = getImage(new URL(getDocument Base(), "http://www.hi-seas.com/pics/pool3.jpg"));


} catch (Exception e) {
e.printStackTra ce();
}
}
public void start()
{
Thread runThread = new Thread(this);
runThread.start ();
}

public void stop()
{
thread = null;
}

public void run()
{
try
{
while (thread == Thread.currentT hread())
{
repaint();
Thread.sleep(10 00);
System.out.prin tln("This is a thread");

}
}
catch (Exception e)
{
e.printStackTra ce();
}
}
public void paint(Graphics g)
{
g.drawImage(img ,10,10,this);
}


}
Oct 24 '06 #5
r035198x
13,262 MVP
Thank you for your answer .

the applet is something like that::

import java.awt.Graphi cs;
import java.awt.Image;
import java.net.URL;


public class NewClass extends javax.swing.JAp plet implements Runnable {
volatile Thread thread;

Image img;

public void ThreadApplet() {
}


public void init() {
try {
img = getImage(new URL(getDocument Base(), "http://www.hi-seas.com/pics/pool3.jpg"));


} catch (Exception e) {
e.printStackTra ce();
}
}
public void start()
{
Thread runThread = new Thread(this);
runThread.start ();
}

public void stop()
{
thread = null;
}

public void run()
{
try
{
while (thread == Thread.currentT hread())
{
repaint();
Thread.sleep(10 00);
System.out.prin tln("This is a thread");

}
}
catch (Exception e)
{
e.printStackTra ce();
}
}
public void paint(Graphics g)
{
g.drawImage(img ,10,10,this);
}


}
This will make it alternate between 2 images in the codebase

Expand|Select|Wrap|Line Numbers
  1. import java.awt.Graphics;
  2. import java.awt.Image;
  3. import java.net.URL;
  4.  
  5.  
  6. public class NewClass extends javax.swing.JApplet implements Runnable {
  7. Thread thread;
  8.  
  9. Image img;
  10.  
  11. public void ThreadApplet() {
  12. }
  13.  
  14.  
  15. public void init() {
  16. try {
  17.  
  18. img = getImage(new URL(getDocumentBase(), "Sample.jpg"));
  19.  
  20.  
  21. } catch (Exception e) {
  22. e.printStackTrace();
  23. }
  24. }
  25. public void start()
  26. {
  27. Thread runThread = new Thread(this);
  28. runThread.start();
  29. }
  30.  
  31.  
  32.  
  33. public void run()
  34. {
  35. try
  36. {
  37. while (true)
  38. {
  39.  
  40. img = getImage(new URL(getDocumentBase(), "sunlogo64x30.gif"));
  41. repaint();
  42. Thread.sleep(1000);
  43. getGraphics().clearRect(10, 10, img.getWidth(this), img.getHeight(this));
  44. repaint();
  45. img = getImage(new URL(getDocumentBase(), "Sample.jpg"));
  46. repaint();
  47. Thread.sleep(1000);
  48. getGraphics().clearRect(10, 10, img.getWidth(this), img.getHeight(this));
  49. System.out.println("This is a thread");
  50.  
  51. }
  52. }
  53. catch (Exception e)
  54. {
  55. e.printStackTrace();
  56. }
  57. }
  58. public void paint(Graphics g)
  59. {
  60. g.drawImage(img,10,10,this);
  61. }
  62.  
  63.  
  64. }
Oct 25 '06 #6
takeiteasy
4 New Member
This will make it alternate between 2 images in the codebase

Expand|Select|Wrap|Line Numbers
  1. import java.awt.Graphics;
  2. import java.awt.Image;
  3. import java.net.URL;
  4.  
  5.  
  6. public class NewClass extends javax.swing.JApplet implements Runnable {
  7. Thread thread;
  8.  
  9. Image img;
  10.  
  11. public void ThreadApplet() {
  12. }
  13.  
  14.  
  15. public void init() {
  16. try {
  17.  
  18. img = getImage(new URL(getDocumentBase(), "Sample.jpg"));
  19.  
  20.  
  21. } catch (Exception e) {
  22. e.printStackTrace();
  23. }
  24. }
  25. public void start()
  26. {
  27. Thread runThread = new Thread(this);
  28. runThread.start();
  29. }
  30.  
  31.  
  32.  
  33. public void run()
  34. {
  35. try
  36. {
  37. while (true)
  38. {
  39.  
  40. img = getImage(new URL(getDocumentBase(), "sunlogo64x30.gif"));
  41. repaint();
  42. Thread.sleep(1000);
  43. getGraphics().clearRect(10, 10, img.getWidth(this), img.getHeight(this));
  44. repaint();
  45. img = getImage(new URL(getDocumentBase(), "Sample.jpg"));
  46. repaint();
  47. Thread.sleep(1000);
  48. getGraphics().clearRect(10, 10, img.getWidth(this), img.getHeight(this));
  49. System.out.println("This is a thread");
  50.  
  51. }
  52. }
  53. catch (Exception e)
  54. {
  55. e.printStackTrace();
  56. }
  57. }
  58. public void paint(Graphics g)
  59. {
  60. g.drawImage(img,10,10,this);
  61. }
  62.  
  63.  
  64. }

Thanks mate for your time and answer.

I tried with array of images and it is working probably.
But it is the first step in the program .
The second step is to do fade effect between images (3 images or 4 ,....)
Like this website

http://www.appletcolle ction.com/dissolveimage.h tml


****** the code of load array of images is *****

import java.awt.Graphi cs;
import java.awt.Image;
import java.net.URL;


public class NewClass extends javax.swing.JAp plet implements Runnable {
volatile Thread thread;

Image[] img = new Image[3];
Image image;
boolean stopped = false;


public void ThreadApplet() {
}


public void init() {
try {

for(int i=0;i<3;i++)
{
img[i] = getImage(getCod eBase(), i+1+".gif");
}

} catch (Exception e) {
e.printStackTra ce();
}
}
public void start()
{
Thread runThread = new Thread(this);
runThread.start ();
}

public void stop()
{
thread = null;
}

public void run()
{
try
{
int i=0;
while(!stopped)
{
image = img[i];
i = (++i)%3;
try
{
Thread.sleep(10 00);
Thread.yield();
}
catch(Exception e)
{}
repaint();
}
}
catch (Exception e)
{
e.printStackTra ce();
}
}

public void paint(Graphics g)
{
g.drawImage(ima ge,10,10,this);
}
}
Oct 25 '06 #7
r035198x
13,262 MVP
Thanks mate for your time and answer.

I tried with array of images and it is working probably.
But it is the first step in the program .
The second step is to do fade effect between images (3 images or 4 ,....)
Like this website

http://www.appletcolle ction.com/dissolveimage.h tml


****** the code of load array of images is *****

import java.awt.Graphi cs;
import java.awt.Image;
import java.net.URL;


public class NewClass extends javax.swing.JAp plet implements Runnable {
volatile Thread thread;

Image[] img = new Image[3];
Image image;
boolean stopped = false;


public void ThreadApplet() {
}


public void init() {
try {

for(int i=0;i<3;i++)
{
img[i] = getImage(getCod eBase(), i+1+".gif");
}

} catch (Exception e) {
e.printStackTra ce();
}
}
public void start()
{
Thread runThread = new Thread(this);
runThread.start ();
}

public void stop()
{
thread = null;
}

public void run()
{
try
{
int i=0;
while(!stopped)
{
image = img[i];
i = (++i)%3;
try
{
Thread.sleep(10 00);
Thread.yield();
}
catch(Exception e)
{}
repaint();
}
}
catch (Exception e)
{
e.printStackTra ce();
}
}

public void paint(Graphics g)
{
g.drawImage(ima ge,10,10,this);
}
}
Yeah second step is a bit tricky. I'll have a look at it just now and will keep you posted.
My first hunch is that we're going to need
MediaTracker, PixelGrabber and MemoryImageSour ce
Oct 25 '06 #8
LostInADesert
1 New Member
i guess too late........
Oct 20 '07 #9
r035198x
13,262 MVP
i guess too late........
Yep, I guess that's one of those that got lost in a desert ...
Oct 22 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
9874
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ********************************** package Celcom.Client;
3
8211
by: Don | last post by:
Hi, I try to get a simple applet working, the class-file does load, but the image doesn't appear;( An error doesn't appear. The view is and stays 'grey' What I want: Automatic refresh of a webcam image Filename is the same. File is located in same directory as applet.
2
2880
by: Christian Galbavy | last post by:
Hy! My next problem is to make an applet from my program. I have just add the "extend applet" to my class and removed the main-method by the start-method of the applet. I was thinking that this is enough, but it does not work, the file does not appear on the server. I have tried to start the applet local and also from the server, but it does not work. Here is the code: *****************************************
2
2524
by: Mark Richards | last post by:
An applet on one of my pages uses a big picture as background. I want to load it before the applet and the rest of the html source. By doing this I want to avoid that the pane of the applet is grey during the load of the picture. How do I do that? Or even better: How can I display something like a progress bar or at least a temporary, self removing message (dialog) "Please wait a few second..." until the picture and the applet were...
1
9654
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
1
6642
by: dishal | last post by:
Can anyone help me please? How do I convert these codes to launch from a JFrame instead of a Java Applet? A simple program where the user can sketch curves and shapes in a variety of colors on a variety of background colors. The user selects a drawing color form a pop-up menu at the top of the applet. If the user clicks "Set Background", the background color is set to the current drawing color and the drawing ...
3
5717
by: =?Utf-8?B?TWFya19C?= | last post by:
I recognize that this question has a substantial Java component and I have cross posted it on Sun’s website. But it is a problem of interface with VS.NET and I suspect they will angrily redirect me to a .NET forum. I have a device that serves a picture by way of a Java app. I can render the picture in IE by navigating to the device: http://192.168.0.57/tvJVIEW.HTM I can also fill a webbrowser control with the image: private void...
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10143
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10076
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.