05 2012 档案

报告一个现象(关于Windows桌面图标莫名改变)
摘要:前几天给电脑扩了2G内存,然后索性装了64位的操作系统。然后笔记本电脑你懂的。。。。一股脑的猛地装驱动,重启,装软件,重启。。。。。。然后就是重点了,Eclipse图标突然变了,怎么都恢复不了。起初觉得是64位系统的原因。也没有在意就这么用着,没有管它了。今天突然想试一下谷歌的拼音输入法,于是就把搜狗给写卸了,结果奇迹发生了Eclipse图标变正常了。初步得出结论是搜狗输入法修改了系统的什么东西,导致某些软件不兼容。其实,改变图标也不只是Eclipse,还有360的软件管家和魔方的一键清理等等图标。 阅读全文

posted @ 2012-05-23 23:56 Yours风之恋 阅读(131) 评论(0) 推荐(0)

Windows 7 自动进入桌面
摘要:在设密码的情况下,每次都要输入密码是很麻烦的一件事。你可以用如下步骤实现自动登录:1,windows + R , 输入:CMD 进入命令行2,输入:control userpasswords2 ,勾掉“要使用本机,用户必须输入用户名和密码”3,确定。 阅读全文

posted @ 2012-05-20 11:58 Yours风之恋 阅读(146) 评论(0) 推荐(0)

android基础(对话框风格Activity实现)
摘要:在此补充一下TaskTask是应用程序调用栈 阅读全文

posted @ 2012-05-17 22:58 Yours风之恋 阅读(216) 评论(0) 推荐(0)

android基础(android程序的后台运行问题)
摘要:在做一个小例子程序时,笔者做了一个小的测试:1,在结束程序的时候直接调用Activity类的finish()方法,因为是真机调试所以,很轻松的看到程序后台运行了。2,笔者想到以前做过j2se桌面开发时用的System.exit()方法。果然就不会后台运行了。然后想到一些在论坛上被骂的开发者...................这叫一个心寒啊为什么就不调用System.exit()呢?不过笔者还是建议用finish(),因为用System.exit()杀死程序很暴力的!!! 阅读全文

posted @ 2012-05-14 23:25 Yours风之恋 阅读(149) 评论(0) 推荐(0)

android基础(Activity的生命周期)
摘要:启动程序FirstActivity -------- onCreate()FirstActivity -------- onStart()FirstActivity -------- onResume()在第一Activity中调用了第二个ActivityFirstActivity -------- onPause()SecondActivity -------- onCreate()SecondActivity -------- onStart()SecondActivity -------- onResume()FirstActivity -------- onStop()退出第二个Act 阅读全文

posted @ 2012-05-14 23:14 Yours风之恋 阅读(108) 评论(0) 推荐(0)

android基础(Activity)
摘要:package ahu.edu;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.view.Menu;import android.view.MenuItem;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.EditText;import android.widget 阅读全文

posted @ 2012-05-14 22:01 Yours风之恋 阅读(129) 评论(0) 推荐(0)

android基础(开发环境搭建)
摘要:Window + Eclipse + ADT + Java SDK + Android SDK安装步骤:Java SDK ==> eclipse ==> ADT==>Android SDK下载地址:Java SDK:http://www.oracle.com/technetwork/java/javase/downloads/index.htmlEclipse:http://www.eclipse.org/downloads/ADT:http://developer.android.com/sdk/eclipse-adt.html#troubleshootingAndroid 阅读全文

posted @ 2012-05-14 21:51 Yours风之恋 阅读(129) 评论(0) 推荐(0)

坦克大战[源码] ---你懂得
摘要:import java.awt.Color;import java.awt.Frame;import java.awt.Graphics;import java.awt.Image;import java.awt.event.KeyAdapter;import java.awt.event.KeyEvent;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.util.ArrayList;import java.util.List;public class TankClient ex 阅读全文

posted @ 2012-05-08 23:07 Yours风之恋 阅读(227) 评论(0) 推荐(0)

用内部类实现java多重实现中的方法同名问题
摘要://实现两个名字一样但返回值不一样的方法;public class TestClass implements A { public int a() { return 1; } private static class Inner implements B { public void a() { System.out.println("public void a()"); } } public static void main(String[] args) { TestClass tc = new TestClass(); Inner i = new Inner(); i.a 阅读全文

posted @ 2012-05-08 22:18 Yours风之恋 阅读(197) 评论(0) 推荐(0)

java(敲 七)
摘要:Problem输出7和7的倍数,还有包含7的数字例如(17,27,37...70,71,72,73...)Input一个整数N。(N不大于30000)Output从小到大排列的不大于N的与7有关的数字,每行一个。Sample Input20Sample Output71417来源:http://acm.tongji.edu.cn/showproblem.php?problem_id=1006参考代码:import java.util.*;public class TestKnockSeven { public static void main(String[] args) { Scanner. 阅读全文

posted @ 2012-05-08 19:20 Yours风之恋 阅读(417) 评论(0) 推荐(0)

java例程练习(键盘事件)
摘要:import java.awt.*;import java.awt.event.*;public class TestKeyEvent { public static void main(String[] args) { new KeyFrame().launchFrame(); }}class KeyFrame extends Frame { public void launchFrame() { setSize(200,200); setLocation(200,200); this.addKeyListener(new MyKeyMonitor()); this.s... 阅读全文

posted @ 2012-05-06 22:56 Yours风之恋 阅读(190) 评论(0) 推荐(0)

java例程练习(匿名类用法)
摘要://用匿名类实现关闭窗口功能import java.awt.*;import java.awt.event.*;public class TestAnony { Frame f = new Frame("Test"); TextField tf = new TextField(10); Button b1 = new Button("Start"); public TestAnony() { f.add(b1, BorderLayout.NORTH); f.add(tf, BorderLayout.SOUTH); b1.addActionListener 阅读全文

posted @ 2012-05-06 22:34 Yours风之恋 阅读(220) 评论(0) 推荐(0)

java例程练习(简单的画图程序[鼠标事件处理])
摘要://简单的画图程序//注意repaint()方法的使用import java.awt.*;import java.awt.event.*;import java.util.*;public class TestMyMouseAdater { public static void main(String[] args) { new MyFrame("Drawing ......"); }}class MyFrame extends Frame { ArrayList points = null; MyFrame(String s) { super(s); points = n 阅读全文

posted @ 2012-05-06 22:07 Yours风之恋 阅读(252) 评论(0) 推荐(0)

java例程练习(Graphics类[paint()方法])
摘要://Graphics类---简单的画图实现import java.awt.*;public class TestPaint { public static void main(String[] args) { new PaintFrame().launchFrame(); }}class PaintFrame extends Frame { public void launchFrame() { setBounds(200, 200, 700, 500); setVisible(true); } public void paint(Graphics g) {//每次需要重画时自动调用pa... 阅读全文

posted @ 2012-05-06 21:29 Yours风之恋 阅读(189) 评论(0) 推荐(0)

java例程练习(关于内部类的一个非常重要的作用)
摘要://实现两个名字一样但返回值不一样的方法;public class TestClass implements A { public int a() { return 1; } class Inner implements B { public void a() { System.out.println("public void a()"); } } public static void main(String[] args) { TestClass tc = new TestClass(); System.out.println(tc.a()); }}interface A 阅读全文

posted @ 2012-05-06 21:16 Yours风之恋 阅读(122) 评论(0) 推荐(0)

java例程练习(简单的计算器[调停者 设计模式 及 内部类 ])
摘要:import java.awt.*;import java.awt.event.*;public class TestInnerClass { public static void main(String[] args) { new TFFrame().launchFrame(); }}class TFFrame extends Frame { public void launchFrame() { TextField num1 = new TextField(10); TextField num2 = new TextField(10); TextField num... 阅读全文

posted @ 2012-05-06 20:59 Yours风之恋 阅读(210) 评论(0) 推荐(0)

java例程练习(TextField)
摘要:import java.awt.*;import java.awt.event.*;public class TestTFAction { public static void main(String[] args) { new TFFrame(); }}class TFFrame extends Frame { TFFrame() { TextField tf = new TextField(); add(tf); tf.addActionListener(new TFActionListener()); tf.setEchoChar('*'); pack(); setVis 阅读全文

posted @ 2012-05-06 20:14 Yours风之恋 阅读(214) 评论(0) 推荐(0)

java例程练习(事件监听机制)
摘要://事件监听机制import java.awt.*;import java.awt.event.*;public class TestEvent { public static void main(String[] args) { Frame f = new Frame("Test"); Button b = new Button("Press Me!"); Monitor bh = new Monitor(); //实现了某种监听器接口的类的对象 b.addActionListener(bh); //注册 f.add(b, BorderLa... 阅读全文

posted @ 2012-05-06 19:58 Yours风之恋 阅读(147) 评论(0) 推荐(0)

java例程练习(BorderLayou&GridLayout)
摘要:import java.awt.*;public class TestBorderLayout { public static void main(String[] args) { Frame f = new Frame("Border Layout"); Button bn = new Button("BN"); Button bs = new Button("BS"); Button bw = new Button("BW"); Button be = new Button("BE"); B 阅读全文

posted @ 2012-05-06 16:13 Yours风之恋 阅读(298) 评论(0) 推荐(0)

java例程练习(布局管理器[FlowLayout])
摘要://FlowLayout,Panel类的默认布局管理器import java.awt.*;public class TestLayout { public static void main(String[] args) { Frame f = new Frame("Flow Layout"); Button b1 = new Button("OK"); Button b2 = new Button("Open"); Button b3 = new Button("Close"); f.setLayout(new F 阅读全文

posted @ 2012-05-06 15:54 Yours风之恋 阅读(242) 评论(0) 推荐(0)

java例程练习(图像编程[Frame&Panel])
摘要://java的第一个图形界面程序import java.awt.*;public class TestFrame { public static void main(String[] args) { Frame f = new Frame(); f.setLocation(20,20); f.setSize(500,500); f.setBackground(Color.red); f.setResizable(false); f.setVisible(true); }}//创建自己的图形类//可以从Frame类继承import java.awt.*;public class Te... 阅读全文

posted @ 2012-05-06 15:14 Yours风之恋 阅读(173) 评论(0) 推荐(0)

java例程练习(网络编程[简单UDP通信试验])
摘要:import java.net.*;import java.io.*;public class TestUDPServer { public static void main(String[] args) throws Exception { byte [] buf = new byte[1024]; DatagramPacket dp = new DatagramPacket(buf,buf.length); DatagramSocket ds = new DatagramSocket(5678); ByteArrayInputStream bais = new ByteArra... 阅读全文

posted @ 2012-05-06 13:55 Yours风之恋 阅读(229) 评论(0) 推荐(0)

java例程练习(网络编程[简单双向通信试验])
摘要:import java.net.*;import java.io.*;public class TestTCPServer { public static void main(String[] args) { InputStream in = null; OutputStream out = null; try { ServerSocket ss = new ServerSocket(8888); Socket socket = ss.accept(); in = socket.getInputStream(); out = socket.getOutputStre... 阅读全文

posted @ 2012-05-06 13:07 Yours风之恋 阅读(185) 评论(0) 推荐(0)

java例程练习(网络编程[简单网络连接试验])
摘要:import java.net.*;import java.io.*;public class TestTCPServer { public static void main(String[] args) { try { ServerSocket ss = new ServerSocket(6666);//阻塞式的 while(true) { //未经行异常处理!// Socket s = ss.accept();// DataInputStream dis = // new DataInputStream(s.getInputStream());/... 阅读全文

posted @ 2012-05-06 12:46 Yours风之恋 阅读(195) 评论(0) 推荐(0)

java例程练习(多线程综合练习[生产者-消费者问题])
摘要:/* * 生产者与消费者问题 * 此问题用到Object类的wait(),notify() * 还要注意一个问题: * sleep()与wait()的区别: * sleep()过程中,对象仍未解锁 * wait ()过程中,对象解锁,其他线程可以访问当前对象,当唤醒时需重新锁定 */public class Test { public static void main(String[] args) { ThingsStack ts = new ThingsStack(); Producer p = new Producer(ts); Consumer c = new Consum... 阅读全文

posted @ 2012-05-05 22:17 Yours风之恋 阅读(215) 评论(0) 推荐(0)

java例程练习(关于线程同步的补充)
摘要:/* * 从运行结果看,当m1()方法被锁定后,m2()方法仍然可以执行。 * 而且b的值被改变。由此可以得出结论: * sychronized 只是防止其定义的代码段被同时调用。 * */public class Test implements Runnable{ int b = 100; public synchronized void m1() throws Exception { b = 1000; Thread.sleep(5000); System.out.println("b = " + b); } public void m2() { System.out. 阅读全文

posted @ 2012-05-05 20:53 Yours风之恋 阅读(121) 评论(0) 推荐(0)

java例程练习(多线程[死锁问题])
摘要:/* *死锁产生有2个原因: *1,资源竞争 *2,进程间的推进顺序非法 * *程序模拟的是第一个情况 */public class TestDeadLock implements Runnable { public int flag = 1; static Object o1 = new Object(); static Object o2 = new Object(); public void run() { System.out.println("flag=" + flag); if(flag == 1) { synchronized(o1) { try { Thr. 阅读全文

posted @ 2012-05-05 16:00 Yours风之恋 阅读(154) 评论(0) 推荐(0)

java例程练习(多线程[线程同步问题])
摘要://线程同步问题public class TestThread implements Runnable{ Timer timer = new Timer(); public static void main(String[] args) { TestThread test = new TestThread(); Thread t1 = new Thread(test); Thread t2 = new Thread(test); t1.setName("t1"); t2.setName("t2"); t1.start(); t2.start(); } p 阅读全文

posted @ 2012-05-05 15:26 Yours风之恋 阅读(174) 评论(0) 推荐(0)

java例程练习(多线程[线程的优先级等等])
摘要://设置线程的优先级public class TestThread1 { public static void main(String[] args) { Thread t1 = new Thread(new T1()); Thread t2 = new Thread(new T2()); t1.setPriority(Thread.NORM_PRIORITY + 3); t1.start(); t2.start(); }}class T1 implements Runnable { public void run() { for(int i = 0; i 0) { Sys... 阅读全文

posted @ 2012-05-05 14:34 Yours风之恋 阅读(155) 评论(0) 推荐(0)

java例程练习(多线程[yield()方法])
摘要:public class Test { public static void main(String[] args) { MyThread m1 = new MyThread("m1"); MyThread m2 = new MyThread("m2"); m1.start(); m2.start(); }}class MyThread extends Thread { MyThread(String s) { super(s); } public void run() { for(int i = 1; i <= 100; i++) { Syste 阅读全文

posted @ 2012-05-04 23:26 Yours风之恋 阅读(168) 评论(0) 推荐(0)

java例程练习(多线程[join()方法])
摘要:public class Test { public static void main(String[] args) { MyThread myThread = new MyThread("m1"); myThread.start(); //产生分支,子线程开始执行 try{ myThread.join();//------等待合并myThread子线程,主线程才开始执行 } catch(InterruptedException e) {} for(int i = 1; i <= 10; i++) { System.out.println("I am mai 阅读全文

posted @ 2012-05-04 23:15 Yours风之恋 阅读(146) 评论(0) 推荐(0)

java例程练习(多线程[sleep()方法])
摘要:import java.util.*;public class Test { public static void main(String[] args) { MyThread thread = new MyThread(); thread.start(); try { Thread.sleep(10000);//主线程睡眠 } catch(InterruptedException e) { } thread.interrupt(); //-----------不是最好的方法 //thread.flag = false; //------... 阅读全文

posted @ 2012-05-04 23:01 Yours风之恋 阅读(173) 评论(0) 推荐(0)

java例程练习(多线程的两种创建方式)
摘要://接口------推荐public class Test { public static void main(String[] args) { Runner1 r = new Runner1(); //r.run();------->不是多线程,只是方法调用 Thread t = new Thread(r); t.start();//必须调用线程类的start()方法 //也可以这样: //new Thread(new Runner1()).start(); for(int i = 0; i < 100; i++) { System.out.pri... 阅读全文

posted @ 2012-05-04 22:26 Yours风之恋 阅读(183) 评论(0) 推荐(0)

java例程练习(对象流)
摘要:import java.io.*;// transient 关键字// serializable 接口// externalizable 接口public class Test { public static void main(String[] args) throws Exception{ T t = new T(); t.k = 8; FileOutputStream fos = new FileOutputStream("C:/java/testobjectio.txt"); ObjectOutputStream oos = new ObjectOutputStre 阅读全文

posted @ 2012-05-04 17:31 Yours风之恋 阅读(136) 评论(0) 推荐(0)

java例程练习(打印流)
摘要:import java.util.*;import java.io.*;//简单的日志功能public class Test { public static void main(String[] args) { String s = null; BufferedReader br = new BufferedReader ( new InputStreamReader(System.in));//标准输入 try { FileWriter fw = new FileWriter("C:/java/logfile.txt",true); PrintWr... 阅读全文

posted @ 2012-05-03 22:17 Yours风之恋 阅读(156) 评论(0) 推荐(0)

java例程练习(数据流)
摘要:import java.io.*;public class Test { public static void main(String[] args) { // 字节数组(内存)--------baos----===>==dos===>===程序 ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); System.out.println(bais.available());//可以读的字节数 DataInputStream dis = new DataInp... 阅读全文

posted @ 2012-05-03 21:01 Yours风之恋 阅读(171) 评论(0) 推荐(0)

java例程练习(转换流)
摘要:import java.io.*;public class Test { public static void main(String[] args) { try { OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("C:/java/char.txt")); osw.write("microsoftibssunapplehp"); System.out.println(osw.getEncoding());//文本编码 osw.close(); //加了true 可 阅读全文

posted @ 2012-05-03 20:24 Yours风之恋 阅读(162) 评论(0) 推荐(0)

java例程练习(东软笔试题[n阶平面魔方])
摘要:import java.util.Scanner;public class MoFang { public static void main(String[] args) { System.out.println("输入行(列)数:"); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] a = new int[n][n]; int i = 0; int j = n / 2; //算法精要 for (int k = 1; k <= n * n; k++) { a[i][j] = k; 阅读全文

posted @ 2012-05-03 19:52 Yours风之恋 阅读(198) 评论(1) 推荐(0)

java例程练习(缓冲流)
摘要:import java.io.*;public class Test { public static void main(String[] args) { try { FileInputStream fis = new FileInputStream("C:/java/Test.java"); BufferedInputStream bis = new BufferedInputStream(fis); int c = 0; System.out.println(bis.read()); System.out.println(bis.read()); ... 阅读全文

posted @ 2012-05-02 16:59 Yours风之恋 阅读(138) 评论(0) 推荐(0)

java例程练习(字符流)
摘要:import java.io.*;public class TestFileReader { public static void main(String[] args) { FileReader fr = null; int c = 0; try { fr = new FileReader("C:/java/Test.java"); while((c = fr.read()) != -1) { System.out.print((char)c); } fr.close(); } catch (FileNotFoundException e) { Sys... 阅读全文

posted @ 2012-05-01 22:18 Yours风之恋 阅读(139) 评论(0) 推荐(0)

Java例程练习(字节流)
摘要:import java.io.*;public class Test { public static void main(String[] args) { int b = 0; FileInputStream in = null; try { in = new FileInputStream("C:/java/Test.java"); } catch (FileNotFoundException e) { System.out.println("找不到指定文件"); System.exit(-1); } try { long num = 0... 阅读全文

posted @ 2012-05-01 21:37 Yours风之恋 阅读(155) 评论(0) 推荐(0)

java例程练习(泛型和自动打包、解包)
摘要://TestArsgWords.javaimport java.util.*;public class TestArgsWords { public static void main(String[] args) { Map m = new HashMap(); for(int i = 0; i c = new ArrayList(); c.add("aaa"); c.add("bbb"); c.add("ccc"); for(int i = 0; i c2 = new HashSet (); c2.add("aaa&quo 阅读全文

posted @ 2012-05-01 15:06 Yours风之恋 阅读(221) 评论(0) 推荐(0)

java例程练习(用HashMap记录控制台输入)
摘要:import java.util.*;public class TestArgsWords { public static void main(String[] args) { Map m = new HashMap(); for(int i = 0; i < args.length; i++) { int freq = ((Integer) m.get(args[i]) == null ? 0 : (Integer) m.get(args[i])); m.put(args[i], (freq == 0 ? 1 : freq + 1)); } System.o... 阅读全文

posted @ 2012-05-01 14:41 Yours风之恋 阅读(214) 评论(0) 推荐(0)

java例程练习(Map接口及自动打包、解包)
摘要:import java.util.*;public class Test { public static void main(String[] args) { Map m1 = new HashMap(); Map m2 = new HashMap(); m1.put("one", 1); //m1.put("one",new Integer(1)); m1.put("two", 2); //m1.put("two",new Integer(2)); m1.put("three", 3); // 阅读全文

posted @ 2012-05-01 14:21 Yours风之恋 阅读(213) 评论(0) 推荐(0)

java例程练习(Comparable接口)
摘要:import java.lang.Comparable;import java.util.List;import java.util.LinkedList;import java.util.Collections;public class TestCompareTo { public static void main(String[] args) { List l1 = new LinkedList(); l1.add(new Name("Karl", "M")); l1.add(new Name("Stever", "Le 阅读全文

posted @ 2012-05-01 13:40 Yours风之恋 阅读(162) 评论(0) 推荐(0)

java例程练习(List常用算法)
摘要:import java.util.*;public class TestCollection { public static void main(String[] args) { List l1 = new LinkedList(); for(int i = 0; i list1 = new LinkedList(); List list2 = new LinkedList(); for(int i = 0; i <= 9; i++) { list1.add("a" + i); } System.out.println(list1); Collections.shuf 阅读全文

posted @ 2012-05-01 13:11 Yours风之恋 阅读(281) 评论(0) 推荐(0)

java例程练习(增强的for循环)
摘要:import java.util.ArrayList;import java.util.Collection;public class Test { public static void main(String[] args) { int [] arr = {1, 2, 3, 4, 5}; for(int i : arr) { System.out.print(i + " "); } System.out.println(); Collection c = new ArrayList(); c.add(new String("AAA")); c.add( 阅读全文

posted @ 2012-05-01 10:36 Yours风之恋 阅读(151) 评论(0) 推荐(0)

java例程练习(Iterator)
摘要:import java.util.Collection;import java.util.HashSet;import java.util.Iterator;public class Test { public static void main(String[] args) { Collection c = new HashSet(); c.add(new Name("f1", "l1")); c.add(new Name("f2", "l2")); c.add(new Name("f3", & 阅读全文

posted @ 2012-05-01 10:27 Yours风之恋 阅读(196) 评论(0) 推荐(0)