如题。
本人才学Java不久。对AWT和事件处理完全不懂。
自己昨天弄了一晚上结果界面排得乱七八糟的,更别说事件处理了。
我写了一小段代码。是查看统计用的。
谁能帮我解决下这个界面问题。我自己用PPT画了个布局,但是小弟愚笨不会传上来。
谁可以帮帮我。我QQ:13611377  、 如果上QQ不方便你把邮箱给我,我把代码和PPT发给你也可以。先谢谢了。

解决方案 »

  1.   

    建议你随便找个简单的AWT例子 参照着做
      

  2.   


    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;public class Gl1010_Test1 { public int getWantSegmentCount(String[] filePaths, String containStr)
    throws Exception {
    return this.getWantSegment(filePaths, containStr).size();
    } public List<String> getWantSegment(String[] filePaths, String containStr)
    throws Exception {
    List<String> list = new ArrayList<String>();
    for (String filePath : filePaths) {
    List<String> segments = this.getFileContent(filePath);
    if (segments.size() > 0) {
    for (String segment : segments) {
    if (segment.indexOf(containStr) != -1)
    list.add(segment);
    }
    }
    }
    return list;
    } private List<String> getFileContent(String filePath) throws IOException {
    List<String> list = new ArrayList<String>();
    StringBuilder sb = new StringBuilder();
    BufferedReader reader = new BufferedReader(new FileReader(filePath));
    String oneLine = "";
    while ((oneLine = reader.readLine()) != null) {
    if (oneLine.trim().length() == 0) {
    list.add(sb.toString());
    sb = new StringBuilder();
    }
    sb.append(oneLine).append("\r\n");
    }
    return list;
    } public static void main(String[] args) {
    Gl1010_Test1 test1 = new Gl1010_Test1();
    try {
    String[] files = new String[] { "d:/20081118.log" };//多文件读取
    List<String> wantSegments = test1.getWantSegment(files,
    "15983973763");
    int wantSegmentsCount = test1.getWantSegmentCount(files,
    "15983973763");
    for (String wantSegment : wantSegments)
    System.out.println(wantSegment);
    System.out.println(wantSegmentsCount);
    } catch (Exception e) {
    e.printStackTrace();
    } }}
    containStr是输入框中的内容。点击统计的时候调用getWantSegmentCount方法点查询的时候调用getWantSegment方法参数filePaths就是文件信息中的文件路径
      

  3.   

    用netbean先画好,再贴到eclipse里最快
      

  4.   

    用java做介面,叫你知道什么是痛苦。
    支持你加油。