/* * * Copyright (C) 1997 Jayakrishnan Nair jk@csr.uvic.ca * WWW: http://www.csc.uvic.ca/~jk * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ import java.applet.*; import java.awt.*; import java.net.*; public class ToolBar extends Panel{ ImageButton fButton; ImageButton bButton; FancyLabel fLabel; int width; int height; public ToolBar(Applet applet,int width, String leftArrow, String rightArrow, String title, int height) { int buttonWidth = (int)(width * 0.125); int labelWidth = width-(2*buttonWidth); this.width = width; this.height = height; Image image = null; String labelImageName = title; String bImgSrc = rightArrow; String fImgSrc = leftArrow; Image fImg = applet.getImage(applet.getDocumentBase(),fImgSrc); Image bImg = applet.getImage(applet.getDocumentBase(),bImgSrc); Image labelImg = applet.getImage(applet.getDocumentBase(),labelImageName); fButton = new ImageButton( fImg,buttonWidth,height,SlideProjector.PREV_IMAGE ); bButton = new ImageButton(bImg,buttonWidth,height,SlideProjector.NEXT_IMAGE); fLabel = new FancyLabel(this,labelImg,labelWidth,height); setLayout(new FlowLayout(FlowLayout.LEFT,0,0)); setBackground(Color.black); add(fLabel); add (fButton); add(bButton); //resize(width,height); } public Dimension preferredSize() { return new Dimension(width,height); } }