회원가입창을 로그인창에 액션을 넣는방법좀요 ㅠㅠ..
하늘
package m090429;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class join extends jpanel
{
public static voiatic void main(string[] args)
{
jframe frame = new jframe(회원가입);
frame.setdefaultcloseoperation(jframe.exit_on_close);
frame.getcontentpane().add(new layoutpanel());
frame.pack();
frame.show();
}
}
class layoutpanel extends jpanel
{
public layoutpanel()
{
jpanel panel1 = new jpanel();
jpanel panel2 = new jpanel();
jpanel panel3 = new jpanel();
jpanel panel4 = new jpanel();
jpanel panel5 = new jpanel();
jlabel label1 = new jlabel(통일 신문사에 오신 것을 환영합니다.);
jlabel label2 = new jlabel(성명: );
jlabel label3 = new jlabel(성별 );
jlabel label4 = new jlabel(e-mail: );
jlabel label5 = new jlabel(관심 분야);
jlabel label6 = new jlabel();
jtextfield textfield1 = new jtextfield();
jtextfield textfield2 = new jtextfield();
jradiobutton radiobutton1 = new jradiobutton(남자);
jradiobutton radiobutton2 = new jradiobutton(여자);
jcheckbox checkbox1 = new jcheckbox(스포츠);
jcheckbox checkbox2 = new jcheckbox(게임);
jcheckbox checkbox3 = new jcheckbox(영화);
jcheckbox checkbox4 = new jcheckbox(여행);
jcheckbox checkbox5 = new jcheckbox(기타);
jbutton button = new jbutton(제출);
button.addactionlistener( new buttonlistener() );
this.setlayout(new gridbaglayout());
gridbagconstraints c = new gridbagconstraints();
c.fill = gridbagconstraints.both;
c.gridx = 0;
c.gridy = 0;
c.gridwidth = 2;
c.gridheight = 1;
c.weightx = 1;
c.weighty = 1;
this.add(label1, c);
// this.add(panel1);
c.fill = gridbagconstraints.both;
c.gridx = 0;
c.gridy = 1;
c.gridwidth = 1;
c.gridheight = 1;
c.weightx = 1;
c.weighty = 1;
this.add(panel2, c);
panel2.setlayout(new gridlayout(4,2));
panel2.add(label2);
panel2.add(textfield1);
panel2.add(label3);
panel2.add(radiobutton1);
panel2.add(label6);
panel2.add(radiobutton2);
panel2.add(label4);
panel2.add(textfield2);
c.fill = gridbagconstraints.both;
c.gridx = 1;
c.gridy = 1;
c.gridwidth = 1;
c.gridheight = 1;
c.weightx = 1;
c.weighty = 1;
this.add(panel3, c);
panel3.setlayout(new gridlayout(6,1));
panel3.add(label5);
panel3.add(checkbox1);
panel3.add(checkbox2);
panel3.add(checkbox3);
panel3.add(checkbox4);
panel3.add(checkbox5);
c.fill = gridbagconstraints.both;
c.gridx = 0;
c.gridy = 2;
c.gridwidth = 2;
c.gridheight = 1;
c.weightx = 1;
c.weighty = 1;
this.add(panel4, c);
panel4.add(button);
setpreferredsize(new dimension(400,300));
}
private class buttonlistener implements actionlistener
{
public void actionperformed(actionevent event)
{
joptionpane.showmessagedialog( layoutpanel.this, 본사의 회원으로 가입해 주셔서 감사합니다 );
// dialog dialog = new dialog(본사의 회원으로 가입해 주셔서 감사합니다);
// dialog.setvisible(true);
}
}
}
위에 소스인데요
이거를 login class창에서 action으로 넣어서
버튼클릭하면 뜨게할려고하는데..생략
private class buttonhandler implements actionlistener {
public void actionperformed(actionevent event) {
if(event.getsource() == login)
{
joptionpane.showmessagedialog(cwc.this, string.format
(id : %s\npassword : %s\nwelcome to cwc, inputid.gettext(), inputpassword.gettext()));
new chat();
setvisible(false);
}
else if(event.getsource() == join)
{
new join();
}
이렇게 했거든요
근데 아무리생각해도
join에 있는 main method 설정때문에 그런거같은데
어렴풋이 감은 오는데 어떻게 해야할지모르곘네요 ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ
빨리 답변좀부탁드립니다 ...ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ