package pro;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class extest0 extends JFrame{
JButton j1 = new JButton("A");
extest0(){
setSize(100,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new FlowLayout());
c.add(j1);
j1.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
extest0a();
c.validate();
setVisible(false);
}
});
setVisible(true);
}
private void extest0a() {
// TODO Auto-generated method stub
new extest1();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new extest0();
}
}
package pro;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class extest1 extends JFrame{
JButton j2 = new JButton("B");
JButton j3 = new JButton("C");
public extest1(){
setSize(100,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new FlowLayout());
c.add(j2);
c.add(j3);
j2.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
extest1a();
c.validate();
setVisible(false);
}
});
j3.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
extest1a();
c.validate();
setVisible(false);
}
});
setVisible(true);
}
protected void extest1a() {
// TODO Auto-generated method stub
new extest0();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new extest1();
}
}
위쪽이 1번 소스 아래쪽이 2번 소스인데 정상적으로 잘 작동합니다
그런데 문제는 위쪽을 누르게 되면 화면이 사라졌다가 아래쪽 화면이 나오게 되는데요
화면이 사라졌다가 나타나지 않고 화면 그대로 뿌리는 방법이 있나요?