标题:swing 问题
只看楼主
sdr2000
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2007-11-17
 问题点数:0 回复次数:2 
swing 问题
我是新手  为什么我运行BorderLayout.java
可以运行
但是运行 FlowLayout.java  就说文件中不包含类FlowLyout ?

我加载的是  java.awt.*;
                   java.awt.evnet.*;
                   javax.swing.*;

是不是运行FlowLayout.java  需要加载别的包?
搜索更多相关主题的帖子: swing 
2007-11-26 18:35
sdr2000
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2007-11-17
得分:0 
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();
    }
}
2007-11-26 18:36
sdr2000
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2007-11-17
得分:0 
问题已经解决  缩~
2007-11-26 19:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-188561-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.040734 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved