博文

java计算器(2006-04-05 00:36:00)

摘要:import java.awt.*;
import java.lang.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.text.DecimalFormat;
public class Calculator
    implements ActionListener { //导入动作监听接口
  //设计面板中的单位
  JFrame frame;
  JTextField textAnswer;
  JPanel panel, panel1, panel2, panel3;
  JMenuBar mainMenu;
  JTextField textMemory;
  JLabel labelMemSpace; //labelMemSpace单纯做摆设,控制面板的形状
  JButton buttonBk, buttonCe, buttonC;
  JButton button[];
  JButton buttonMC, buttonMR, buttonMS, buttonMAdd;
  JButton buttonDot, buttonAddAndSub, buttonAdd, buttonSub, buttonMul,
      buttonDiv, buttonMod;
  JButton buttonSqrt, buttonDao, buttonEqual;
  JMenu editMenu, viewMenu, helpMenu;
  JMenuItem copyItem, pasteItem, tItem, sItem, numberGroup, topHelp, aboutCal;
  DecimalFormat df; //设置数据输出精度
&nb......

阅读全文(15625) | 评论:12

书上的线程GUI(2006-04-05 00:25:00)

摘要:import java.awt.*;
import java.awt.event.*;
public class Welcome extends WindowAdapter implements ActionListener{
 Frame f;
 static Welcome.Thread3 wt1,wt2;
 public static void main(String args[]){
  Welcome w=new Welcome();
  w.display();
  wt1=w.new Thread3("welcome!");
  wt2=w.new Thread3("how are you?");
  wt2.start();
  wt2.setButton();
 }
 public void display(){
  f=new Frame("welcome");
  f.setSize(400,240);
  f.setLocation(200,140);
  f.setBackground(Color.lightGray);
  f.setLayout(new GridLayout(4,1));
  f.addWindowListener(this);
  f.setVisible(true);
 }
 public class Thread3 extends Thread{
  Panel p1;
  Label lb1;
  TextField tf1,tf2;
  Button b1,b2;
  int sleeptime=(int)(Math.random......

阅读全文(4773) | 评论:0

本人的文本输入(目前只有分数文本可用)(2006-04-02 23:59:00)

摘要:import java.awt.*;
import java.awt.event.*;
import javax.swing.*;   public class ButtonTest1 extends JFrame{
 private JButton aB,bB,exitButton,qrButton;
 
 private JLabel mz,fs;
 
 private JTextField mz1,fs1;
 
 public String mzsz[]=new String[20];
 public int fssz[]=new int[20];
 
 public ButtonTest1(){
  super("testing buttons");
  Container container=getContentPane();
  container.setLayout(new FlowLayout());
  
  aB=new JButton("输入学生姓名和分数");
  container.add(aB);
  
  //ButtonHandler handler=new ButtonHandler();
  bB=new JButton("退出");
  container.add(bB);
  
  ButtonHandler handler=new ButtonHandler();
  
  aB.addActionListener(handler);
  bB.addActionListener(handler);
  
  ......

阅读全文(4876) | 评论:0

本人完成差不多程序(2006-04-01 21:22:00)

摘要:import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ButtonTest1 extends JFrame{
 private JButton aB,bB,exitButton,qrButton;
 
 private JLabel mz,fs;
 
 private JTextField mz1,fs1;
 
 public String mzsz[]=new String[20];
 public int fssz[]=new int[20];
 
 public ButtonTest1(){
  super("testing buttons");
  Container container=getContentPane();
  container.setLayout(new FlowLayout());
  
  aB=new JButton("输入学生姓名和分数");
  container.add(aB);
  
  //ButtonHandler handler=new ButtonHandler();
  bB=new JButton("退出");
  container.add(bB);
  
  ButtonHandler handler=new ButtonHandler();
  
  aB.addActionListener(handler);
  bB.addActionListener(handler);
  
  setSi......

阅读全文(4682) | 评论:0

本人的JAVA分数输入程序(冒泡)(2006-04-01 21:19:00)

摘要:import javax.swing.JOptionPane;
public class FenShu{
 public static void main(String args[]){
  FenShu aaa=new FenShu();
  String n1,n2;
  int gs,average,sum=0;
  n1=JOptionPane.showInputDialog("请输入人数:");
  gs=Integer.parseInt(n1);
  int fs[]=new int[gs];
  for(int j=0;j<gs;j++)
  {n2=JOptionPane.showInputDialog("输入第"+(j+1)+"分数");
  fs[j]=Integer.parseInt(n2);
  }
 
//排训
//   System.out.print("!!!!!!!!!!!!") ;
  
  for(int o = fs.length - 1; o >= 0; o--)
{
    for(int k = 0,temp; k < o; k++)
  {
   if(fs[k]>fs[k+1])
   { temp=fs[k];
    fs[k]=fs[k+1];
    fs[k+1]=temp;}
    }
 
  }
  for(int w=0;w<fs.length;w++){
   sum+=fs[w];}
   average=sum/gs;
 
//输出
 ......

阅读全文(5946) | 评论:0

最好的Java程序员免费学习材料(English)(2006-02-28 07:48:00)

摘要: 最好免费的Training 和Tutorials资源: Java Programming Resources 19 Free Java Courses from IBM Introduction to Programming Using Java -Full TOC  -PDF version Studying for Java Certification on the Web Thinking In Java, by Bruce Eckel, 2nd Edition Richard Baldwin's Java Tutorials, plus Javascript and XML Jyothi Krishnan Java Certification Study Site Java Certification & Training by Michael Thomas Sun Certified Java Programmer (Java 2) Study Guide) (register here) Another Java 2 Programmer Study Guide Further Java, University of Cambridge The Java Boutique: The Ultimate Java Applet Resource: Articles: Tutorials The Developer's Guide to Understanding Enterprise JavaBeans Applications (pdf) Mastering_Enterprise_JavaBeans and the Java 2 Platform (zipped pdf) Java Bean Tutorial from Sun A Walking Tour of JavaBeans Advanced JavaBeans Java Servlet Articles from Webreview.com Java Servlet Tutorial from Webmonkey S......

阅读全文(6773) | 评论:0