ÀÚ¹Ù ºóÁî¿¡¼­ netscape ½ÇÇà½Ã ¿¡·¯...???


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :ÀÌÁ¤ÈÆ 1998³â 8¿ù 21ÀÏ 22:26:59

java beans À» °øºÎÇÏ´Ù ½ÇÇàÀÌ Àß µÇÁö ¾Ê¾Æ ÀÌ·¸°Ô ±ÛÀ» ¿Ã¸³´Ï´Ù.
Ȥ½Ã ¾Æ½Ã´Â ºÐÀº µµ¿òÀ» Á» ºÎŹµå¸³´Ï´Ù.
htm ¹®¼­´Â ¾Æ·¡¿Í °°½À´Ï´Ù.


<html>
<head>
<title>Three way button applet demo</title>
</head>
<body>
<h1>Three way button applet demo</h1>
<hr>
<applet code="BThreeWayButton.class" width=200 height=80>
<param name="caption" value="ÁýÀ¸·Î °©´Ï´Ù!">
<param name="tiptext" value="¶Ç ÁýÀ¸·Î À̵¿ÇÕ´Ï´Ù...">
<param name="audio" value="0.au">
<param name="dest" value="http://saejong.pufs.ac.kr">
</applet>
<applet code="BThreeWayButton.class" width=200 height=80>
<param name="caption" value="Sun»ç·Î °©´Ï´Ù!">
<param name="tiptext" value="Sun»ç·Î À̵¿ÇÕ´Ï´Ù...">
<param name="audio" value="0.au">
<param name="dest" value="http://www.sun.com">
</applet>

<applet code="BThreeWayButton.class" width=200 height=80>
<param name="caption" value="Go AltaVista!">
<param name="tiptext" value="¾ËŸºñ½º³ª·Î À̵¿ÇÕ´Ï´Ù...">
<param name="audio" value="0.au">
<param name="dest" value="http://www.altavista.com">
</applet>
<applet code="BThreeWayButton.class" width=200 height=80>
<param name="caption" value="Àڹ٠ȨÆäÀÌÁö·Î...">
<param name="tiptext" value="Àڹ٠ȨÆäÀÌÁö·Î À̵¿ÇÕ´Ï´Ù...">
<param name="audio" value="0.au">
<param name="dest" value="http://www.javasoft.com">
</applet>
</body>
</html>

°ü·ÃµÈ .java ÆÄÀÏÀº ¸ðµå ¿¡·¯ ¾øÀÌ ½ÇÇàµÇ°í jar ÆÄÀϵµ
¹®Á¦¾øÀÌ Àß µÇ¾ú´Âµ¥..
³Ý½ºÄÉÀÌÇÁ¿¡¼­ ½ÇÇà½ÃBThreeWayButton can't start error:java.
lang.NoSuchMethodError:java... ÀÌ·¸°Ô ³ª¿É´Ï´Ù.


µÎ°³ÀÇ ÀÚ¹Ù¼Ò½º ÆÄÀÏÀº ¾Æ·¡¿Í °°½À´Ï´Ù.

//BThreeWayButtonBeanInfo.java
import java.beans.*;
import java.awt.Image;
public class BThreeWayButtonBeanInfo extends SimpleBeanInfo {
    private final static Class beanClass = BThreeWayButton.class;
    public BeanDescriptor getBeanDescriptor() {
        BeanDescriptor bd = new BeanDescriptor(beanClass);
        bd.setDisplayName("Three Way Button");
        return bd;
    }
    public Image getIcon(int iconKind){
	    if(iconKind == BeanInfo.ICON_COLOR_16x16){
	        Image img = loadImage("ButtonIcon16.gif");
	        return img;
	    }
	    if(iconKind == BeanInfo.ICON_COLOR_32x32) {
	        Image img = loadImage("ButtonIcon32.gif");
	        return img;
	    }
	    return null;
    }
}

//BThreeWayButton.java
import java.applet.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.net.URL;
import java.net.MalformedURLException;
public class BThreeWayButton extends Applet	implements MouseListener
{
    private Image img_a = null;
    private Image img_b = null;
    private String caption;
    private String tiptext;
    private String dest;
    private String audio;
    private boolean b_border = true;
    private boolean b_active = false;
    private boolean b_notext = false;
    public void setNotext(boolean b)
    {
        b_notext = b;
        repaint();
    }
    public boolean getNotext()
    {
        return b_notext;
    }
    public void setBorder(boolean b)
    {
        b_border = b;
        repaint();
    }
    public boolean getBorder()
    {
        return b_notext;
    }
    public void setDisplay(String cap)
    {
        caption = cap;
        b_notext = false;
        repaint();
    }
    public String getDisplay()
    {
        return caption;
    }
    public void init()
    {
        addMouseListener(this);
        String param;
        param = getParameter("caption");
        if(param == null)
        {
            caption = "Hello?";
        }
        else
            caption = param;
        param = getParameter("active-image");
        if(param == null)
            img_a = getImage(getDocumentBase(), "img_a.gif");
        else
            img_a = getImage(getDocumentBase(), param);
        param = getParameter("grayed-image");
        if(param == null)
            img_b = getImage(getDocumentBase(), "img_b.gif");
        else
            img_b = getImage(getDocumentBase(), param);
        param = getParameter("tiptext");
        tiptext = param;
        param = getParameter("dest");
        dest = param;
        param = getParameter("border");
        if(param == null)
            b_border = true;
        else
            b_border = param.equals("yes") ? true : false;
        param = getParameter("audio");
        audio = param;
    }
    public void start()
    {
    }
    public void run()
    {
    }
    public void stop()
    {
    }
    public void paint(Graphics g)
    {
        drawBorder(g, true);
        drawImage(g);
    }
    public void drawCaption(Graphics g, Dimension di)
    {
        if(b_notext) return;
        Dimension dc = getSize();
        FontMetrics fm = g.getFontMetrics();
        int fw = fm.stringWidth(caption);
        int fh = fm.getMaxAscent() - fm.getMaxDescent();
        int xpos = 10 + di.width + 10;
        int ypos = (dc.height + fm.getMaxAscent() - fm.getMaxDescent()) / 2;
        g.setFont(new Font("±¼¸²", Font.PLAIN, 14));
        Color oldColor = g.getColor();
        if(b_active) {
            g.setColor(Color.black);									//mytest
           
            g.drawString(caption, xpos + 1, ypos + 1);
            g.setColor(Color.white);
            g.drawString(caption, xpos, ypos);
        }
        else {
            g.setColor(Color.gray);
            g.drawString(caption, xpos + 1, ypos + 1);   //mytest
            g.setColor(Color.gray);
            g.drawString(caption, xpos, ypos);
        }
        g.setColor(oldColor);
    }
    public void drawImage(Graphics g)
    {
        Dimension di;
        Dimension dc = getSize();
        if(b_active == true) {
            di = new Dimension(img_a.getWidth(this), img_a.getHeight(this));
            if(b_notext == true)
                g.drawImage(img_a, dc.width/2 - di.width/2, dc.height/2 - di.height/2, this);
            else
                g.drawImage(img_a, 10, dc.height/2 - di.height/2, this);
        }
        else {
            di = new Dimension(img_b.getWidth(this), img_b.getHeight(this));
            if(b_notext == true)
                g.drawImage(img_b, dc.width/2 - di.width/2, dc.height/2 - di.height/2, this);
            else
                g.drawImage(img_b, 10, dc.height/2 - di.height/2, this);
        }
        drawCaption(g, di);
    }
    public void drawBorder(Graphics g, boolean up)
    {
        if(b_border == false) return;
        Dimension d = getSize();
        int w = d.width - 1;
        int h = d.height - 1;
        Color oldColor = g.getColor();
        if(b_active) {
            if(up)
                g.setColor(Color.white);
            else
                g.setColor(Color.gray);
            g.drawLine(0, 0, w, 0);
            g.drawLine(0, 1, w - 1, 1);
            g.drawLine(0, 0, 0, h - 1);
            g.drawLine(1, 0, 1, h - 2);
            if(up)
                g.setColor(Color.gray);
            else
                g.setColor(Color.white);
            g.drawLine(0, h, w, h);
            g.drawLine(1, h - 1, w, h - 1);
            g.drawLine(w, 0, w, h);
            g.drawLine(w - 1, 1, w - 1, h);
        }
        else {
            g.setColor(Color.lightGray);
            g.drawLine(0, 0, w, 0);
            g.drawLine(0, 1, w - 1, 1);
            g.drawLine(0, 0, 0, h - 1);
            g.drawLine(1, 0, 1, h - 2);
            g.drawLine(0, h, w, h);
            g.drawLine(1, h - 1, w, h - 1);
            g.drawLine(w, 0, w, h);
            g.drawLine(w - 1, 1, w - 1, h);
        }
        g.setColor(oldColor);
    }
    ///////////////////////////////////////////////////////////////////////////
    public void mousePressed(MouseEvent evt)
    {
        Graphics g = getGraphics();
        drawBorder(g, false);
    }
    public void mouseReleased(MouseEvent evt)
    {
        if(!b_active) return;
        Graphics g = getGraphics();
        drawBorder(g, true);
    }
    public void mouseEntered(MouseEvent evt)
    {
        b_active = true;
        Graphics g = getGraphics();
        drawBorder(g, true);
        drawImage(g);
        AppletContext ac = getAppletContext();
        if(tiptext != null) ac.showStatus(tiptext);
    }
    public void mouseExited(MouseEvent evt)
    {
        b_active = false;
        Graphics g = getGraphics();
        drawBorder(g, false);
        drawImage(g);
        AppletContext ac = getAppletContext();
        if(tiptext != null) ac.showStatus("");
    }
    public void mouseClicked(MouseEvent evt)
    {
        if(audio != null) {
            AudioClip oc = getAudioClip(getDocumentBase(), audio);
            oc.play();
        }
        AppletContext ac = getAppletContext();
        if(dest != null) {
            try	{
                URL url = new URL(dest);
                ac.showDocument(url);
            }
                catch(MalformedURLException e) {
                System.out.println("Malformed URL: " + dest);
                return;
            }
        }
    }
    public void mouseDragged(MouseEvent evt)
    {
    }
    public void mouseMoved(MouseEvent evt)
    {
    }
}


¾Æ½Ã´Â ºÐµéÀÇ °í°ßÀ» ±â´Ù¸®¸ç....
¼ö°íµé Çϼ¼¿ä.



´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]