⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slideshow.java

📁 国外的一些较好的APPLET收集(含原码)!
💻 JAVA
字号:
/*
    A basic extension of the java.applet.Applet class
 */

import java.awt.*;
import java.applet.*;
import java.io.*;
import symantec.itools.awt.*;
import java.net.URL;
import java.net.MalformedURLException;

public class SlideShow extends Applet {
    String  caption, imagebase, imagetype;
	int totalimages;
    
    public String[][] getParameterInfo(){
        String[][] info = {
            {"caption", "string", "Title of the Slide Show"},
			{"totalimages", "string", "Total number of images"},
			{"imagebase", "string", "Name of Image file base."},
			{"imagetype", "string", "Type of image (ie: jpg or gif)."},
            };
       return info;
    }
            
            
            
	void slideShowHTML_SlideChanged(Event event) {


		//{{CONNECTION
		// Disable the Button on condition... Is at last image?
		buttonNext.enable(! slideShowHTML.isAtLastImage());
		//}}

		//{{CONNECTION
		// Disable the Button on condition... Is at the first image?
		buttonPrevious.enable(! slideShowHTML.isAtFirstImage());
		//}}

		//{{CONNECTION
		// Set the text for WrappingLabel... Get current description
		{
			wrappingLabelDesc.setText(slideShowHTML.getDescription(slideShowHTML.getCurrentImageIndex()));
		}
		//}}

	}

	void buttonNext_Clicked(Event event) {


		//{{CONNECTION
		// Go to the SlideShow's next image
		slideShowHTML.nextImage();
		//}}
	}

	void buttonPrevious_Clicked(Event event) {


		//{{CONNECTION
		// Go to the SlideShow's previous image
		slideShowHTML.previousImage();
		//}}
	}


	public void init() {
		super.init();
		caption = getParameter("caption");
		totalimages = Integer.valueOf(getParameter("totalimages")).intValue();
		imagebase = getParameter("imagebase");
		imagetype = getParameter("imagetype");
		setLayout(null);
		addNotify();
		resize(460,390);
		wrappingLabelDesc = new symantec.itools.awt.WrappingLabel();
		wrappingLabelDesc.reshape(384,12,240,225);
		wrappingLabelDesc.setFont(new Font("Dialog", Font.PLAIN, 14));
		add(wrappingLabelDesc);
		slideShowHTML = new symantec.itools.multimedia.SlideShow();
		showStatus(imagebase + " Files Loading");
		getSlideShowEntries();
		slideShowHTML.reshape(12,0,340,235);
		add(slideShowHTML);
		buttonPrevious = new java.awt.Button("Previous");
		buttonPrevious.reshape(36,300,96,40);
		buttonPrevious.setFont(new Font("Dialog", Font.BOLD, 14));
		buttonPrevious.setForeground(new Color(0));
		buttonPrevious.setBackground(new Color(16777215));
		add(buttonPrevious);
		buttonNext = new java.awt.Button("Next");
		buttonNext.reshape(204,300,96,40);
		buttonNext.setFont(new Font("Dialog", Font.BOLD, 14));
		buttonNext.setForeground(new Color(0));
		buttonNext.setBackground(new Color(16777215));
		add(buttonNext);
		labelDescription = new java.awt.Label(caption);
		labelDescription.reshape(0,252,363,38);
		labelDescription.setFont(new Font("Dialog", Font.BOLD, 12));
		add(labelDescription);
		//}}
		buttonPrevious.enable(false);
	    wrappingLabelDesc.setText(slideShowHTML.getDescription(0));
		

	}

	public boolean handleEvent(Event event) {
		if (event.target == buttonPrevious && event.id == Event.ACTION_EVENT) {
			buttonPrevious_Clicked(event);
			return true;
		}
		if (event.target == buttonNext && event.id == Event.ACTION_EVENT) {
			buttonNext_Clicked(event);
			return true;
		}
		if (event.target == slideShowHTML && event.id == Event.ACTION_EVENT) {
			slideShowHTML_SlideChanged(event);
			return true;
		}
		return super.handleEvent(event);
	}

	//{{DECLARE_CONTROLS
	symantec.itools.multimedia.SlideShow slideShowHTML;
	java.awt.Button buttonPrevious;
	java.awt.Button buttonNext;
	symantec.itools.awt.WrappingLabel wrappingLabelDesc;
	java.awt.Label labelDescription;
	//}}
	
	private void getSlideShowEntries()
	{
		try
	    {
			for(int i = 1; i < totalimages + 1; i++)
			{
				String description = getParameter("text" + i);
				imagebase = getParameter("imagebase");
				imagebase = getCodeBase() + imagebase + i + "." + imagetype;
				URL photoURL =  new java.net.URL(imagebase);
				slideShowHTML.addImageAndDescription( photoURL, description);
			}
		} catch(MalformedURLException e) {
	    }
	    
	    catch (IOException e)
	    {
			showStatus("Error reading file: ");
	    }
    }
	            
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -