[질문] 자바에서 내부 프레임 사용시 문제점(스윙)
큰깃
다이어리 프로그램을 만들고 있습니다.
메뉴를 툴바로 넣었습니다.
그리고 툴바의 메뉴를 누르면 내부 프레임으로 창이 뜹니다.
그런데 문제가
내부 프레임을 끄지 않고 새로운 프레임을 띄우면
이상한 잔상이 생깁니다.
어떠한 잔상이냐 하면 새로운 프레임에서 입력등을 하려고 프레임을 클릭하면 예전에 떠 있던 프레임이 나타나고
다이얼로그를 띄우면 또 잔상이 생깁니다.
ㅜㅗㅜ
도저히 못고치겠습니다.
무슨 이유인지라도 알면 좋겠는데, 이유도 모르겠습니다.
도와주세요...엉엉엉....
------------------일부 소스-----------------
public NameCard() {JDesktopPane desktopPane = new JDesktopPane();JInternalFrame internalFrame = new JInternalFrame(title,true,true,true,true);
.
.
.
.
internalFrame.setSize(1024,650);
desktopPane.add(internalFrame);
Schedule.frame.getContentPane().add(desktopPane, BorderLayout.CENTER);
internalFrame.setVisible(true);
internalFrame.addInternalFrameListener(new InternalFrameAdapter() {
public void internalFrameClosing(InternalFrameEvent e){System.out.println(내부프레임을 닫습니다:); }});
} //NameCard의 생성자쪽에서 인터널 프레임을 설정해 주고요. 여기서는 인터널 프레임 설정은 이것뿐입니다.다른 클래스에서 NameCard를 불러오는 형식입니다.
큰 틀은 아래 소스 입니다..
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.beans.*;
public class Schedule extends JFrame implements ActionListener{
public static JFrame frame;
public static boolean daily = false;
public static String id = vvv;//public NameCard nc;private int index=0;
private JToolBar toolbar1;
private JButton button1, button2, button3, button4, button5, button6, button7, button8;
private Container contentPane;public Schedule(String title) {
super(title);
contentPane = this.getContentPane();
toolbar1 = new JToolBar();
ImageIcon calender= new ImageIcon(img/calender.gif);//월간스케줄버튼
ImageIcon month= new ImageIcon(img/month.gif);//월간누름
ImageIcon sc03 = new ImageIcon(img/sc03.gif);//일간스케줄버튼
ImageIcon day= new ImageIcon(img/day.gif);//일간누름
ImageIcon namecard= new ImageIcon(img/namecard.gif);//명함관리버튼
ImageIcon namecard01= new ImageIcon(img/namecard01.gif);//명함관리글
ImageIcon money= new ImageIcon(img/money.gif);//지출관리버튼
ImageIcon money01= new ImageIcon(img/money01.gif);//지출관리글
ImageIcon TSM= new ImageIcon(img/TSM.gif);//ABOUT TSM버튼
ImageIcon tsm01= new ImageIcon(img/TSM01.gif);//ABOUT TSM글
ImageIcon LOCK= new ImageIcon(img/LOCK.gif);//LOCK글
ImageIcon lock01= new ImageIcon(img/lock01.gif);//LOCK버튼
ImageIcon user= new ImageIcon(img/USER01.gif);//사용자관리 버튼
ImageIcon user01= new ImageIcon(img/user.gif);//사용자관리 글
ImageIcon code01= new ImageIcon(img/code.gif);//CODE 버튼
ImageIcon code02= new ImageIcon(img/code01.gif);//CODE 글
button1 = makeButton(img/calender.gif,월간스케줄);
button1.setPressedIcon(month);
button1.setToolTipText(월간스케줄);
button2 = makeButton(img/sc03.gif,일간스케줄);
button2.setPressedIcon(day);
button2.setToolTipText(일간스케줄);
button3 = makeButton(img/namecard.gif,명함관리);
button3.setPressedIcon(namecard01);
button3.setToolTipText(명함관리);
button4 = makeButton(img/money.gif,지출관리);
button4.setPressedIcon(money01);
button4.setToolTipText(지출관리);
button5 = makeButton(img/USER01.gif,사용자관리);
button5.setPressedIcon(user01);
button5.setToolTipText(사용자관리);
button6 = makeButton(img/lock01.gif,LOCK);
button6.setPressedIcon(LOCK);
button6.setToolTipText(LOCK);
button7 = makeButton(img/code.gif,코드관리);
button7.setPressedIcon(code02);
button7.setToolTipText(코드관리);
button8 = makeButton(img/TSM.gif,AboutTSM);
button8.setPressedIcon(tsm01);
button8.setToolTipText(AboutTSM);toolbar1.add(button1);
toolbar1.add(button2);
toolbar1.add(button3);
toolbar1.add(button4);
toolbar1.add(button5);
toolbar1.add(button6);
toolbar1.add(button7);
toolbar1.add(button8);/* 컴포넌트 추가 */
this.getContentPane().add(toolbar1, BorderLayout.NORTH);
setSize(1024,700);
setVisible(true);
&nbs
}
public JButton makeButton(String imagePath, String actionCommand) {
JButton b = new JButton(new ImageIcon(imagePath));
b.setActionCommand(actionCommand);
b.addActionListener(this);
return b;
}public void actionPerformed(ActionEvent e) {
String n = e.getActionCommand();
if (n.equals(월간스케줄)) {
MonthPlan mp = new MonthPlan(월간스케줄);
}else if (n.equals(일간스케줄)) {
DailyFrame mk = new DailyFrame(일간스케줄); }
else if (n.equals(명함관리)) {
NameCard nc = new NameCard(명함관리); }
else if (n.equals(코드관리)) {
CodeManagement cm = new CodeManagement(코드관리); }
else if (n.equals(지출관리)) {
Money mm = new Money(지출관리); }
else if (n.equals(사용자관리)) {
//CodeManagement cm = new CodeManagement(사용자관리);
}
else if (n.equals(AboutTSM)) {
AboutTSM at = new AboutTSM(AboutTSM); }
else if (n.equals(LOCK)) {
Lock lock = new Lock(); }
}//end of actionPerformedpublic static void main(String[] args) {
frame = new Schedule(TSM);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
-
한국녀
네..수정해서 소스도 적었어요..^ㅡ^;;
-
두루
소스를 살짝 보여주심, 고수님들이 많이 답변 해주시지 않을까 생각합니다. ^^