JLabel.setBounds()方法,前提是该窗体的layout manager为null
解决方案 »
- RandomAccessFile.readChar方法读取中文乱码的问题
- 求详细的解释
- File类的 renameTo 方法
- 任务池问题
- 关于InputStreamReader(in,charsetName)的一个问题
- 类似QQ模版的问题 急。。。哪位高手帮帮呀
- 为什么会在编写程序的时候出现乱码?
- 如何用反射读取静态字段的值
- 关于JTree的问题,(急!!!顶者有分)
- 简单问题,求助!!
- D版Jbuilder5中bas的License key,哪位可知道?感激不尽!
- 我用vj写java,因为有msdn的超级帮助,连书也可丢了。可我想用jbuilder,可它速度爆慢,帮助不好。该如何是好?还有有没有好的jbuilder书??
import java.awt.*;
import java.awt.event.*;
public class MF extends JFrame
{
public MF()
{
this.getContentPane().setLayout(new GridBagLayout());
GridBagConstraints gbc=new GridBagConstraints();
gbc.gridx=0;
gbc.gridy=0;
gbc.anchor=gbc.WEST;
this.getContentPane().add(new JLabel("label1"),gbc);
gbc.gridy++;
this.getContentPane().add(new JLabel("label2"),gbc);
gbc.gridy++;
gbc.gridx++;
gbc.weightx=100;
gbc.weighty=100;
gbc.fill=gbc.BOTH;
this.getContentPane().add(new JLabel(),gbc);
this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
public static void main(String args[])
{
MF mf=new MF();
mf.setSize(600,600);
mf.setVisible(true); }
}