博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

随笔分类 -  Java

摘要:public class TestThread implements Runnable{ public TestThread() { } public static void main(String[] args) { Thread[] t = new Thread[10]; TestThread r = new TestThread(); ... 阅读全文

posted @ 2012-08-09 17:33 紫冰龙 阅读(142) 评论(0) 推荐(0)

摘要:import javax.swing.*;import java.applet.Applet;import java.awt.*;import java.awt.event.*;public class TestPen extends JFrame { Graphics redPen ; public TestPen(){ setSize(500,500); ... 阅读全文

posted @ 2012-08-09 16:16 紫冰龙 阅读(2545) 评论(0) 推荐(0)

摘要:import java.awt.Color;import java.awt.Dimension;import java.awt.Font;import javax.swing.*;public class TestBonds extends JFrame { public TestBonds() { setTitle("TestBonds"); setLayou... 阅读全文

posted @ 2012-08-09 15:18 紫冰龙 阅读(184) 评论(0) 推荐(0)

摘要:import javax.swing.*;import java.applet.Applet;import java.awt.event.*;import java.awt.*;import java.util.Vector;public class Exec76 extends Applet { Graphics2D g2 ; Vector<Point> points = new V... 阅读全文

posted @ 2012-08-09 13:42 紫冰龙 阅读(262) 评论(0) 推荐(0)

摘要:怎么用swing绘图 绘画系统的演变 当最初的、为JDK1.0使用的AWT API发布时,只有重量级(heavyweight)部件("重量级" 的意思是说该部件有它自己的、遮光(opaque)的、与生俱来的窗体)。这样就使得AWT在很大程度上依赖于本地平台的绘画系统。这样的安排需要开发人员写代码的时候要考虑到很多细节问题,象重画检测(damage detection)、剪切(clip)计算、以... 阅读全文

posted @ 2012-08-09 13:36 紫冰龙 阅读(741) 评论(0) 推荐(0)

摘要:import java.applet.*;import java.awt.*;import javax.swing.JFrame;public class Example7_3 extends Applet { int i = 1; public void init(){ setBackground(Color.YELLOW); } public void p... 阅读全文

posted @ 2012-08-09 11:11 紫冰龙 阅读(291) 评论(0) 推荐(0)

摘要:import javax.swing.*;import java.applet.Applet;import java.awt.*;import java.awt.geom.Point2D;import java.util.Vector;public class DrawStar extends Applet { Vector<Point2D.Double> points = new Vect... 阅读全文

posted @ 2012-08-08 16:54 紫冰龙 阅读(219) 评论(0) 推荐(0)

摘要:import javax.swing.*;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;public class DrawDemo extends JPanel{ /*public void paintComponent(Graphics g) { ... 阅读全文

posted @ 2012-08-08 14:37 紫冰龙 阅读(488) 评论(0) 推荐(0)

摘要:import javax.swing.*;import java.awt.event.*;import java.awt.*;public class Exec69 extends JFrame{ JTextField text; JTextArea re; JLabel label; public Exec69() { setSize(400,400); ... 阅读全文

posted @ 2012-08-08 12:38 紫冰龙 阅读(336) 评论(0) 推荐(0)

摘要:import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Exec68 extends JFrame{ JTextField text; Boolean flag1,flag2; public Exec68() { setSize(400,500); setD... 阅读全文

posted @ 2012-08-08 11:41 紫冰龙 阅读(143) 评论(0) 推荐(0)

摘要:import javax.swing.*;import java.awt.event.*;import java.awt.*;public class Exec66 extends JFrame implements ActionListener{ JTextField text; static int i=0; public Exec66() { this.set... 阅读全文

posted @ 2012-08-08 09:25 紫冰龙 阅读(436) 评论(0) 推荐(0)

摘要:import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Exec65 extends JFrame implements ItemListener{ JComboBox box; JTextField text; static String[] lessons = {"语文","数学"... 阅读全文

posted @ 2012-08-08 09:07 紫冰龙 阅读(134) 评论(0) 推荐(0)

摘要:import javax.swing.*;import java.awt.FlowLayout;import java.awt.event.*;public class Exec73 extends JFrame implements ActionListener{ /** * @param args */ public static void main(Stri... 阅读全文

posted @ 2012-08-07 21:34 紫冰龙 阅读(143) 评论(0) 推荐(0)

摘要:import javax.swing.*;import java.awt.FlowLayout;import java.awt.event.*;public class Exec61 extends JFrame implements ActionListener{ JTextField text; JCheckBox jc1,jc2,jc3; Exec61(){ ... 阅读全文

posted @ 2012-08-07 18:18 紫冰龙 阅读(161) 评论(0) 推荐(0)

摘要:import javax.swing.*;import java.awt.BorderLayout;import java.awt.event.*;public class JComponentDemo extends JFrame{ JComponentDemo(){ setTitle("JComponentDemo Test"); setSize(500,50... 阅读全文

posted @ 2012-08-07 18:03 紫冰龙 阅读(212) 评论(0) 推荐(0)

摘要:import javax.swing.*;import java.awt.BorderLayout;import java.awt.Color;import java.awt.Dimension;import java.awt.Graphics;import java.awt.event.*;public class MouseMoveDemo extends JPanel implements ... 阅读全文

posted @ 2012-08-07 17:44 紫冰龙 阅读(203) 评论(0) 推荐(0)

摘要:import java.awt.BorderLayout;import java.awt.Dimension;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;public class GridLayoutDem... 阅读全文

posted @ 2012-08-01 16:28 紫冰龙 阅读(201) 评论(0) 推荐(0)

摘要:import java.awt.BorderLayout;import java.awt.CardLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;class MyPanel extends JPanel { MyPanel(int n) { add(new JLabel(" "+n+" ")); }}class MainFrame extends JFrame implements ActionListe. 阅读全文

posted @ 2012-07-31 14:36 紫冰龙 阅读(172) 评论(0) 推荐(0)

摘要://找出两个字符串中最长的相同子字符串public class Stringdemo { public static void main(String[] args) { String str1 = new String("eeabcde"); String str2 = new String("bcdefabcabcdedegg"); by... 阅读全文

posted @ 2012-07-31 12:22 紫冰龙 阅读(2096) 评论(0) 推荐(0)

摘要://改目录下文件名的扩展名import java.io.File;public class re { public static void main(String[] args){ File file = new File("D:\\tmep"); String pre = new String("sql"); String aft = new String("txt"); run(file,pre,aft); } public static void run(File f,String from,String to) { if (f 阅读全文

posted @ 2012-07-26 12:57 紫冰龙 阅读(172) 评论(0) 推荐(0)