[´äº¯] ´ÙÀ̾ó·Î±× ¹Ú½º¿Í ¾ÖÇø´°£ÀÇ µ¥ÀÌÅÍ ±³È¯


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

±Û¾´ÀÌ :±èÇÊÈ£ 1998³â 11¿ù 17ÀÏ 18:18:57

In Reply to: [Q]´ÙÀ̾ó·Î±× ¹Ú½º¿Í ¾ÖÇø´°£ÀÇ µ¥ÀÌÅÍ ±³È¯ posted by ÀåÀαâ on 1998³â 11¿ù 17ÀÏ 05:52:22:

appletviewer ·Î ½ÇÇàÇÏ¸é ´ÙÀ½°ú ºñ½ÁÇÑ ¿¡·¯°¡ ³Ê¿À´Âµ¥ ¸Â³ª¿ä?


###### ¿¡·¯ ³»¿ë
wing: checked access to system event queue.
xception occurred during event dispatching:
java.lang.ClassCastException: com.sun.java.swing.SwingUtilities$2
at Dialog1.action(AppletFrame2.java:127)
at java.awt.Component.handleEvent(Compiled Code)
at java.awt.Window.postEvent(Compiled Code)
at java.awt.Component.postEvent(Compiled Code)
at java.awt.Component.postEvent(Compiled Code)
at java.awt.Component.postEvent(Compiled Code)
at java.awt.Component.postEvent(Compiled Code)
at java.awt.Component.postEvent(Compiled Code)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)



º¸¿©ÁֽŠ¼Ò½º ÁßÀÇ Dialog1.action() ¿¡ ÀÖ´Â
((ResultProcessor)getParent()).processResult(this, new ConnectInfo(username.getText(), password.getText()));
¿Í ¾Æ·¡ÀÇ °íÄ£ ¼Ò½º ÁßÀÇ Dialog3.action() ¿¡ ÀÖ´Â
applet.processResult(this, new ConnectInfo(username.getText(), password.getText()));
¸¦ Àß ºñ±³ÇØ º¸¼¼¿ä.
ÀÌ°É ±âÁØÀ¸·Î ´Ù¸¥ °÷µéµµ ¹Ù²î¾ú°Åµç¿ä...



// ###### °íÄ£ ¼Ò½º
//
// ÆÄÀϸí: AppletFrame3.java
//
// Á¦°¡ JBuiler ¸¦ ¾²Áö ¾Ê´Â °ü°è·Î
// ´ÙÀ̾ó·Î±× »óÀÚ¿¡¼­ XYLayout ´ë½Å
// GridLayout



import java.awt.*;
import com.sun.java.swing.*;
///// import borland.jbcl.layout.*;



interface ResultProcessor
{
public void processResult(JDialog source, Object obj);
}



class ConnectInfo
{
String username;
String password;
public ConnectInfo(String u, String p)
{
username = u;
password = p;
}
}



class Dialog3 extends JDialog {


JPanel jPanel1 = new JPanel();


///// XYLayout xYLayout1 = new XYLayout();


Label label1 = new Label();
TextField username = new TextField();
Label label2 = new Label();
TextField password = new TextField();
Label label3 = new Label();
Button button1 = new Button();
Button button2 = new Button();


AppletFrame3 applet;


public Dialog3(AppletFrame3 applet, String title, boolean modal) {
super(null, title, modal);
this.applet = applet;
try {
jbInit();
pack();
}
catch (Exception ex) {
ex.printStackTrace();
}
}



public Dialog3() {
this(null, "", false);
}



void jbInit() throws Exception {


///// jPanel1.setLayout(xYLayout1);
///// xYLayout1.setHeight(189);
///// xYLayout1.setWidth(297);
jPanel1.setLayout(new GridLayout(4, 1));


label1.setText("ÇÐ ¹ø");
label2.setText("ºñ¹Ð¹øÈ£");
password.setEchoChar('*');
label3.setText("* ºñ¹Ð¹øÈ£´Â Áֹεî·Ï¹øÈ£ 13ÀÚ¸®ÀÔ´Ï´Ù.");
button1.setLabel("È®ÀÎ");
button2.setLabel("Ãë¼Ò");
getContentPane().add(jPanel1);


Panel panel1 = new Panel();
panel1.add(label1);
panel1.add(username);
jPanel1.add(panel1);


Panel panel2 = new Panel();
panel2.add(label2);
panel2.add(password);
jPanel1.add(panel2);


jPanel1.add(label3);


Panel panel3 = new Panel();
panel3.add(button1);
panel3.add(button2);
jPanel1.add(panel3);
}


public boolean action(Event evt, Object arg)
{
if ( evt.target instanceof Button ) {
if ( ((String) arg).equals("È®ÀÎ") )
{
applet.processResult(this, new ConnectInfo(username.getText(), password.getText()));
return true;
}
else if( ((String) arg).equals("Ãë¼Ò") ) {
dispose();
return true;
}
else
return super.action(evt,arg);
}


return false;
}
}



public class AppletFrame3 extends JApplet implements ResultProcessor {


String x,y;


Dialog3 d1;



public void init()
{
///// d1 = new Dialog1(null,"A Dialog Window",true);
d1 = new Dialog3(this,"A Dialog Window",true);
d1.show();
d1.resize(300,300);
}



public void processResult(JDialog source, Object result)
{
if (source instanceof Dialog1) {
ConnectInfo info = (ConnectInfo)result;
System.out.println(info.username + " " + info.password);
}
}
}



´ÙÀ½ ±Ûµé:



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

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
HTML ÅÂ±× Æ÷ÇÔ ¿©ºÎ: HTML ¹®¼­ÀÏ °æ¿ì üũ
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


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