import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class aa extends JFrame
{
private JTextPane aTP,bTP;
private JScrollPane aSP,bSP;
public aa()
{
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(null);
setSize(300,200);
aTP=new JTextPane();
aSP=new JScrollPane();
aSP.setBounds(10,10,100,50);
aSP.setViewportView(aTP);
getContentPane().add(aSP);
bTP=new JTextPane();
bSP=new JScrollPane();
bSP.setBounds(10,120,100,50);
bSP.setViewportView(bTP);
getContentPane().add(bSP);
}
public static void main(String args[])
{
aa aa1=new aa();
}
}
运行上面的程序,有时两个JTextPane都会出现,有时出现一个,有时一个都不出现..
为什么?