The above applet is an example of a presentation created with SlideWriter


Thumbnail.java

/**
 * SlidePresenter.java - Cory Goldfuss and Steve Borga - 20 Apr 2001
 * +++ Directions +++
 * Create a folder ( locally or on remote server ) in which the following must be placed:
 * -- SlidePresenter.class ( the applet )
 * -- The HTML file the SlideWriter application created ( user chooses name of HTML file )
 * -- ALL pictures used in the presentation.  These MUST be named exactly as they were when they
 *    were encorporated into the slides when using SlideWriter.  This is becuase the HTML that was
 *    file generated stores parameters read in by SlidePresenter.
 * 
 * Note: You do not need to include any .tray, .try, .slide, or .sld files in the folder.  These are 
 *       used merely for the SlideWriter application in order to save and view slides and trays.
 *
 */



import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;


public class SlidePresenter extends JApplet implements ActionListener
{
    private Thumbnail myThumb = new Thumbnail();
    private int numSlides; 
    private TitledBorder myBorder = new TitledBorder( new LineBorder( Color.black, 3 ) );
    private String title;
    private int red, blue, green; // to set background of slide
    private int currentSlide = 0;
    private ImageIcon pic;
    private Font titleFont;
    private Color c;
    
	public void init()
	{
		
		// This line prevents the "Swing: checked access to system event queue" message seen in some browsers.
		getRootPane().putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
		
		// This code is automatically generated by Visual Cafe when you add
		// components to the visual environment. It instantiates and initializes
		// the components. To modify the code, only use code syntax that matches
		// what Visual Cafe can generate, or Visual Cafe may be unable to back
		// parse your Java file into its visual environment.
		//{{INIT_CONTROLS
		getContentPane().setLayout(null);
		getContentPane().setBackground(java.awt.Color.white);
		setSize(525,300);
		displayPanel.setLayout(new GridLayout(1,1,0,0));
		getContentPane().add(displayPanel);
		displayPanel.setBounds(24,24,240,192);
		textArea.setSelectedTextColor(java.awt.Color.white);
		textArea.setLineWrap(true);
		textArea.setDisabledTextColor(java.awt.Color.black);
		textArea.setEditable(false);
		getContentPane().add(textArea);
		textArea.setFont(new Font("Dialog", Font.PLAIN, 11));
		textArea.setBounds(300,24,204,192);
		prevButton.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
		prevButton.setText("Previous");
		prevButton.setActionCommand("Previous");
		prevButton.setAlignmentY(0.0F);
		prevButton.setToolTipText("Previous Slide");
		prevButton.setMnemonic((int)'P');
		prevButton.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.HAND_CURSOR));
		getContentPane().add(prevButton);
		prevButton.setFont(new Font("Dialog", Font.BOLD, 10));
		prevButton.setBounds(36,252,100,30);
		nextButton.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
		nextButton.setText("Next");
		nextButton.setActionCommand("Next");
		nextButton.setAlignmentY(0.0F);
		nextButton.setToolTipText("Next Slide");
		nextButton.setMnemonic((int)'N');
		nextButton.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.HAND_CURSOR));
		getContentPane().add(nextButton);
		nextButton.setFont(new Font("Dialog", Font.BOLD, 10));
		nextButton.setBounds(156,252,100,30);
		countLbl.setOpaque(true);
		countLbl.setToolTipText("Current Slide");
		getContentPane().add(countLbl);
		countLbl.setBackground(java.awt.Color.white);
		countLbl.setForeground(java.awt.Color.black);
		countLbl.setFont(new Font("Dialog", Font.PLAIN, 10));
		countLbl.setBounds(336,252,110,26);
		//}}
		
		// things that are nice
		nextButton.grabFocus(); // allow mnemonics without first clicking
		prevButton.setFocusPainted( false ); // looks better
		nextButton.setFocusPainted( false );
	    textArea.setWrapStyleWord( true ); // word wrap on
		Container cont = getContentPane(); // used to change color of Applet's background
	    
	    // prepare first slide for viewing
	    numSlides = Integer.parseInt( getParameter( "ENTRIES" ) );
	    pic = new ImageIcon( getImage( getCodeBase(), getParameter( "IMGFILE0" )));
	    myThumb.setImage( pic );
	    textArea.setText( getParameter( "TEXT0" ) );
	    title = getParameter( "TITLE0" );
	    red = Integer.parseInt( getParameter("RED" + currentSlide ));
	    green =  Integer.parseInt( getParameter("GREEN" + currentSlide ));
	    blue =  Integer.parseInt( getParameter("BLUE" + currentSlide ));
	    
	    // setup border for slide
	    titleFont = new Font("Dialog", Font.PLAIN, 10);
	    myBorder.setTitle( " " + title + " " );
	    myBorder.setTitleFont( titleFont );
	    myBorder.setTitleColor( Color.black );
	    
	    // match all colors
	    Color c = new Color( red, green, blue); // grab color of first slide
	    cont.setBackground( c ); // set the background of the first slide
	    prevButton.setBackground( c );
	    nextButton.setBackground( c );
	    textArea.setBackground( c );
	    myThumb.setBackground( c );
	    countLbl.setBackground( c );
	    countLbl.setText("Slide " + 1 + " of " + numSlides );
	    
	    // panel and call displayImage to repaint.
	    displayPanel.add( myThumb );
	    displayPanel.setBorder( myBorder );
	    displayPanel.setBackground( c );
	    myThumb.displayImage();
	    
	    
	    prevButton.addActionListener( this );
	    nextButton.addActionListener( this );
	}
	

	//{{DECLARE_CONTROLS
	javax.swing.JPanel displayPanel = new javax.swing.JPanel();
	javax.swing.JTextArea textArea = new javax.swing.JTextArea();
	javax.swing.JButton prevButton = new javax.swing.JButton();
	javax.swing.JButton nextButton = new javax.swing.JButton();
	javax.swing.JLabel countLbl = new javax.swing.JLabel();
	//}}
	
	
	public void actionPerformed( ActionEvent e ){
	    // any time there is an action (prev or next) clear current silde
	    textArea.setText("");
	    displayPanel.remove( myThumb );
	    myThumb = new Thumbnail(); 
	    
	    if( e.getSource() == prevButton){
	        currentSlide = ( currentSlide + numSlides - 1 ) % numSlides;
	        countLbl.setText("Slide " + ( currentSlide + 1 ) + " of " + numSlides );
	    }
	    
	    if( e.getSource() == nextButton ){
	        currentSlide = ( currentSlide + 1 ) % numSlides;
	        countLbl.setText("Slide " + ( currentSlide + 1 ) + " of " + numSlides );
	        
	        
	    }
	        
	        // everytime an action is performed update the current slide
	        pic = new ImageIcon( getImage( getCodeBase(), getParameter( "IMGFILE" + currentSlide) ));
	        myThumb.setImage( pic );
	        textArea.setText( getParameter( "TEXT" + currentSlide ) );
	        title = getParameter( "TITLE" + currentSlide );
	        red = Integer.parseInt(getParameter("RED" + currentSlide ));
	        green =  Integer.parseInt(getParameter("GREEN" + currentSlide ));
	        blue =  Integer.parseInt(getParameter("BLUE" + currentSlide ));
	    
	        myBorder.setTitle( " " + title + " " );
	        c = new Color( red, green, blue );
	        getContentPane().setBackground( c ); // set the background of the first slide
	        countLbl.setBackground( c );
	        prevButton.setBackground( c );
	        nextButton.setBackground( c );
	        textArea.setBackground( c );
	        myThumb.setBackground( c );
	    
	        displayPanel.add( myThumb );
	        displayPanel.setBackground( c );
	        myThumb.displayImage();
	        
	        
	    
	}
	
	
}