用JAVA编一个界面,高手进来!编码越基本越好!
按你的要求搞定,试一下还满意吗? import t。*;import t。event。*;import javax。swing。*;import javax。swing。event。*;public class PanDuan implements ActionListener{ JTextField jtf1; JButton b1; JFrame f=null; String title="结果"; String message=""; int type=JOptionPane。
PLAIN_MESSAGE; public PanDuan(){ f=new JFrame(); Container c= tContentPane(); tLayout(new BorderLayout()); JPanel p1=new JPanel(); tLayout(new GridBagLayout()); GridBagConstraints gb=new GridBagConstraints(); idx=0; idy=0; d(new JLabel("请输入数字:",JLabel。
CENTER),gb); idx=1; idy=0; jtf1=new JTextField(8); // tEnabled(false); d(jtf1,gb); idx=0; idy=1; b1=new JButton("确定"); dActionListener(this); d(b1,gb); d(p1); tSize(300, 300); tTitle("添加员工资料"); tVisible(true); dWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System。
exit(0); } }); } public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if( tSource()==b1){ String zhi= tText(); if(zhi。
equals("")){//判断输入的内容是否为空 type=JOptionPane。WARNING_MESSAGE; message="内容不能为空!!!"; owMessageDialog(f, message,title,type); return; } for(int i=0;i<zhi。
length();i++){//判断输入的是否是数字 if(! Digit( arAt(i))){ type=JOptionPane。WARNING_MESSAGE; message="请输出数字!!!"; owMessageDialog(f, message,title,type); return; } } int sz=Integer。
parseInt(zhi);//将去取出的字符串转换为整型的 if(sz>20){ type=JOptionPane。INFORMATION_MESSAGE; message="你输入的数字大于20!!!"; } if(sz==20){ type=JOptionPane。
INFORMATION_MESSAGE; message="你输入的数字等于20!!!"; } if(sz<20){ type=JOptionPane。
INFORMATION_MESSAGE; message="你输入的数字小于20!!!"; } owMessageDialog(f, message,title,type); } } public static void main(String[]args){ new PanDuan(); }}如满意别忘加点分啊,哈哈!!!!!!。
//C。javaimport javax。swing。*;import t。*;import t。event。*;public class C extends JDialog{ public static void main(String[] args) {new C()。
setVisible(true);} public C(){ tDefaultCloseOperation(JDialog。DISPOSE_ON_CLOSE); tSize(200,80); tLocationRelativeTo(null); n = new JTextField();add(n);b=new JButton("GO"); tPreferredSize(new Dimension(1,23));add(b,"South"); dActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ JOpti owMessageDialog( is,getMsg());//根据输入的内容显示相关的提示 tText(""); }}); } private String getMsg(){ String s = ""; if( tText()。
trim()。isEmpty())s="请输入数字"; try{ int a = rseInt( tText()。
trim()); s="你输入的数";s+=a>x?"大于 ":a<x?"小于 ":"等于 "; s+=x; }catch(Exception e){s="只能输入数字";} return s; } private JTextField n; private int x=20; private JButton b;}。
<html><head><title>表单<title><script language=javascript>{aa( lue);for(a=1;a<=1;a>=100);if(a==20)elsealert("这个数等于20");elsealert("这个数大于20"); elsealert("这个数小于20");}</script></head><body><form><input type="text"name="a"value=""><br><input type="button"name="b"value="提交" onclick="aa()"></form></body></html>
//完全按照你的要求来的 简单清楚明了import t。event。*;import java。util。*;import javax。swing。
*;public class Test extends JFrame implements ActionListener{ private JPanel pan; private JTextField tf; private JButton but; Test(){ tBounds(200, 200, 200, 200); pan = new JPanel(); tf = new JTextField(10); but = new JButton("确定"); dActionListener(this); d(tf); d(but); tContentPane(pan); tVisible(true); } public static void main(String args[]){ new Test(); } public void actionPerformed(ActionEvent e) { if( tSource()==but){ try { int i = rseInt( tText()); if(i==20){ owMessageDialog(this, "关系是:=20"); }else if(i>20){ owMessageDialog(this, "关系是:>20"); }else if(i<20){ owMessageDialog(this, "关系是:<20"); } } catch (Exception ee) { owMessageDialog(this, "输入错误"); } } }}。
答:买回来后,在背包里点击右键,你任务信息左边下面就可以召出老虎了,按‘P’键可以查看宠物信息。详情>>
答:同学习的目的是什么? 1、为了一技之长,养家糊口 2、为了一个兴趣爱好 3、为了考试及格 4、为了.... 总之,不管是学什么,目的都是为了提高在某个方面的知识...详情>>
答:用代IP的QQ就可以看详情>>