swing 问题
我是新手 为什么我运行BorderLayout.java可以运行
但是运行 FlowLayout.java 就说文件中不包含类FlowLyout ?
我加载的是 java.awt.*;
java.awt.evnet.*;
javax.swing.*;
是不是运行FlowLayout.java 需要加载别的包?
搜索更多相关的解决方案:
swing
----------------解决方案--------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FlowLayoutDemo
{
public FlowLayoutDemo()
{
JFrame f = new JFrame();
Container contentPane = f.getContentPane();
contentPane.setLayout(new FlowLayout());
contentPane.add(new JButton("first"));
contentPane.add(new JButton("second"));
contentPane.add(new JButton("third"));
contentPane.add(new JButton("fourth"));
contentPane.add(new JButton("fifth"));
contentPane.add(new JButton("This is the last button"));
f.setTitle("FlowLayout");
f.setSize(getPreferredSize());
f.setVisible(true);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvnet e)
{System.exie(0);}
});
}
public Dimension getPreferredSize()
{
return new Dimension(200,200);
}
public static void main(String [] args)
{
FlowLayoutDemo b = new FlowLayoutDemo();
}
}
----------------解决方案--------------------------------------------------------
问题已经解决 缩~
----------------解决方案--------------------------------------------------------