如题 。。

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【shisi0325】截止到2008-07-31 09:42:30的历史汇总数据(不包括此帖):
    发帖的总数量:48                       发帖的总分数:1180                     每贴平均分数:24                       
    回帖的总数量:14                       得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:44                       结贴的总分数:1090                     
    无满意结贴数:2                        无满意结贴分:40                       
    未结的帖子数:4                        未结的总分数:90                       
    结贴的百分比:91.67 %               结分的百分比:92.37 %                  
    无满意结贴率:4.55  %               无满意结分率:3.67  %                  
    值得尊敬

    取消马甲机器人,请点这里:http://www.java2000.net/mycsdn/robotStop.jsp?usern=shisi0325
      

  2.   

    建议楼主去看看API,中文版的现在很多CHM做得很好了。SWING的基本控件跟AWT差不多,JFrame窗口,JButton按钮,JTextField文本输入框,JLabel标签,JTextArea文本区域,JMenu窗口菜单,还有强大的Layout布局,关于这方面的书本和电子图书都很多,一般的JAVA基础书上都有讲到!
      

  3.   

    入门的么?
    package com.zhangkai;import javax.swing.JFrame;public class TestJFrame extends JFrame {
    public TestJFrame() {
    setLocation(300,300);//显示位置
    setSize(300,300);//大小
    setTitle("第一个Swing!");
    setVisible(true);//显示。
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//关闭
    }
    public static void main(String[] args) {
    new TestJFrame();
    }
    }哦了。
      

  4.   

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class JavaSwing extends JFrame{
    JButton jb=new JButton("jbutton");
    public JavaSwing(){
    jb.setSize(80,25);
    jb.setLocation(210,100);
    jb.addActionListener(new Al());
    this.setLayout(null);
    this.add(jb);
    this.setDefaultCloseOperation(3);
    this.setVisible(true);
    this.setSize(500,200);
    this.setLocation(300,300);
    }
    class Al implements ActionListener{
    public void actionPerformed(ActionEvent e){
    JOptionPane.showInputDialog("输入你的名字");
    }
    }
    public static void main (String[] args) {
    try {
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (Exception ex) {
    }
    new JavaSwing();
    }
    }
      

  5.   

    也!原来楼主是要例子啊!呵呵,补个例子!import java.awt.Color;
    import java.awt.Container;
    import java.awt.TextArea;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.File;import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField;public class System extends JFrame{
    JLabel l;
    JButton b1,b2;
    JTextField t1;
    TextArea t2;
    Container c;
    JFileChooser fc;
    String filePath,targetPath,result;
    File selectedFile;


    System() {
    setTitle("aaa");
    setBounds(350,300,440,410);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    input();
    setVisible(true);
    }

    public void input(){
    b1 = new JButton();
    b1.setText("button1");
    b2 = new JButton();
    b2.setText("button2");
    t1 = new JTextField();
    t1.setText("text1");
    t1.setEditable(false);
    t1.setBackground(Color.WHITE);
    l = new JLabel();
    l.setText("txt2");
    l.setVisible(false);
    t2 = new TextArea("",0,0,TextArea.SCROLLBARS_VERTICAL_ONLY);
    c = this.getContentPane();
    c.setLayout(null);
    c.add(b1);
    c.add(b2);
    c.add(t1);
    c.add(l);
    c.add(t2);
    b1.setBounds(10, 10, 100, 25);
    b2.setBounds(10, 45, 100, 25);
    t1.setBounds(120, 10, 300, 25);
    l.setBounds(120, 45, 200, 25);
    t2.setBounds(10, 80, 410, 290);



    b1.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e) {
    fc = new JFileChooser();
    fc.setDialogTitle("choose");
    fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    if(JFileChooser.APPROVE_OPTION==fc.showOpenDialog(null)){
    selectedFile = fc.getSelectedFile();
    filePath = selectedFile.getAbsolutePath();
    t1.setText(filePath);
    }
    }
    });


    b2.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e) {
    if(!("".equals(filePath)||filePath == null)){
                                          //do something!
    t2.setText("succes");
    l.setVisible(true);
    }
    else{
    t2.setText("No choose");
    }
    }
    });
    }


    public static void main(String[] args) {
    new System();
    }}
      

  6.   

    import javax.swing.*;
    import java.awt.*;
    class MyFrame extends JFrame
    {
    MyFrame(String title)
    {
    super(title);
    setLayout(new FlowLayout());
    setBounds(50,50,600,300);
    setVisible(true);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
    }
    }简单而有用的类
      

  7.   

    去这个网站吧:里面可以找到大部分java demo 当然包括:swing的了!http://www.java2s.com/
      

  8.   

    Swing Componentshttp://www.java2s.com/Code/Java/Swing-Components/CatalogSwing-Components.htm