第一个Swing程序

package com.yds.gui.applet;import java.awt.Color;import java.awt.Container;import java.awt.GridLayout;import javax.swing.JFrame;import javax.swing.JLabel;public class JFtext1 { /** * @param args */ public static void main(String[] args) { JFrame jf=new JFrame(); Cont...
2010-05-20 20:24 | 阅读 909 次 | 评论 0 条

打开文件对话框和保存文件对话框

package com.yds.gui.fourpart;import java.awt.Button;import java.awt.FileDialog;import java.awt.Frame;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;public class FileSave implements ActionListener{ Button b1,b2; FileDialog f_open,f_save; Frame f; public void Ui(){...
2010-05-20 16:43 | 阅读 1048 次 | 评论 0 条

有子窗口的应用

import java.awt.*;import java.awt.event.*;public class TestDialog implements ActionListener{ private Label info; private Dialog loginDialog; private Dialog quitDialog; private TextField tf_name; private TextField tf_psw; public static void main( String args[]) { new Tes...
2010-05-20 16:14 | 阅读 817 次 | 评论 0 条

带事件的用户注册

package com.yds.gui.twopart;import java.awt.*;import java.awt.event.*;public class TestChoice implements ItemListener,ActionListener{ TextField name; CheckboxGroup cg; Choice career; List city; Checkbox[] favorite; public static void main( String args[]) { new TestChoic...
2010-05-20 15:27 | 阅读 781 次 | 评论 0 条

用户注册界面设计

package com.yds.gui.fourpart;import java.awt.Button;import java.awt.Checkbox;import java.awt.CheckboxGroup;import java.awt.Choice;import java.awt.FlowLayout;import java.awt.Frame;import java.awt.GridLayout;import java.awt.Label;import java.awt.List;import java.awt.Panel;import java.awt.TextFiel...
2010-05-20 15:27 | 阅读 1314 次 | 评论 0 条

记事本界面设计

public static void main(String[] args) { Frame f=new Frame("记事本"); MenuBar mb=new MenuBar(); Menu m1=new Menu("打开"); MenuItem mi1=new MenuItem("打开"); MenuItem mi2=new MenuItem("保存"); MenuItem mi3=new MenuItem("另存为"); MenuItem mi4=new MenuItem("退出"); Monst...
2010-05-20 14:30 | 阅读 768 次 | 评论 0 条

事件处理和界面不在同一个类中的设计方法

package com.yds.gui.fourpart;import java.awt.Button;import java.awt.Frame;import java.awt.Panel;import java.awt.TextArea;import java.awt.TextField;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;public class TextAreaBea { Frame f; TextArea ta; Button b; TextFie...
2010-05-20 14:10 | 阅读 984 次 | 评论 0 条

用户登录界面的设计

import java.awt.*;import java.awt.event.*; public class TestTextField implements ActionListener{ TextField name; TextField password; public static void main( String args[]) { TestTextField ttf = new TestTextField(); ttf.createUI(); } public void createUI(){ Frame f = new Frame("登录界面"); ...
2010-05-20 11:39 | 阅读 1414 次 | 评论 0 条

网络聊天系统的界面

public static void main(String[] args) { Frame f = new Frame("客户端"); Panel p1 = new Panel(); Label l1 = new Label("地址"); TextField t1 = new TextField(8); Label l2 = new Label("端口号"); TextField t2 = new TextField(4); Label l3 = new Label("称呢"); TextField t3 = new TextField(12); Button b1 ...
2010-05-18 15:57 | 阅读 861 次 | 评论 0 条
浏览274687次