荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: Lg (L.G.), 信区: Java
标  题: IO Exception while reading
发信站: 深圳大学荔园晨风电子公告牌 (Thu Apr  9 23:16:52 1998), 转信

I use jdk-1.1.2 to compile my java applet.
No error.But when I use "appletviewer" to
run applet,there were some error messages.

I/O exception while reading:\d:\........\Tabs
Make sure that Tabs is a file and is readable.

source code:

import java.applet.Applet;
import java.awt.*;

//
//
// Tabs
//
//
public class Tabs extends Applet
{
        TabCards cards;
        public void init() {

        cards = new TabCards();
        cards.addCard("Card 1",new Button("Card 1 button"));
        cards.addCard("Card 2",new Button("Card 2 button"));
        add(cards);
        }
}

import java.awt.*;
//
//
// TabCards
//
//
class TabCards extends Panel
{
        private Panel tabStrip;
        private Panel cardDeck;
        private CardLayout cardLayout;

        TabCards() {
                setLayout(new CardLayout());
                tabStrip = new Panel();
                cardDeck = new Panel();
                tabStrip.setLayout(new FlowLayout());
                cardLayout = new CardLayout();
                cardDeck.setLayout(cardLayout);
                add("North",tabStrip);
                add("Center",cardDeck);
        }

        void addCard(String cardName,Component comp) {
                tabStrip.add(new Button(cardName));
                cardDeck.add(cardName,comp);
        }

        public boolean action(Event e,Object arg) {
                cardLayout.show(cardDeck,(String) arg);
                return true;
        }
}




--
☆ 来源:.深大荔园晨风 bbs.szu.edu.cn.[FROM: www-post@linux.szu.e]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店