程式設計工藝大師(Master of Computer Programming)
許老師結合數學與電腦程式的教學網 課程包含 程式設計 數值分析 -------------------------------------- Prof. Hsu teaches computer programming and numerical analysis to help those who wants to be a computer programming master and focus on controlling computers to benefit people more than only on making money.
關於我自己
- 許志宇(Chih-Yu Hsu)
- Welcome to discuss about : Chinese Traditional Medicine and Acupuncture Please send me the email: tccnchsu@gmail.com Chih-Yu Hsu
2019年5月24日 星期五
2018年2月7日 星期三
最新消息News
Predicting Earthquakes
A team from Los Alamos National Laboratory have run with this general theory and has used Machine Learning to predict when an earthquake will occur, albeit in a lab environment, all from the sounds emitted by the earth under strain.
2016年9月22日 星期四
2016逢甲應數物件導向C#
KISSr 讓 Dropbox 化身免費網頁空間,自架小型網站免租主機 https://free.com.tw/kissr/
水果盤小遊戲 圖
http://myweb.fcu.edu.tw/~d0353486/
http://140.134.4.223/~d0250875/
http://myweb.fcu.edu.tw/~d0214021/
期中考 (11月7日-11日)
期末考 (1月4日-12日)
網路吉峰國小
2016/12/9
透過DropPage快速打造個人網站,首先必須要有個Dropbox帳號
Download Connector/Net
How to Connect to MySQL Using C#
Connecting to MySQL from Visual C#Creating A Simple Solution
【Unity】- 獲取 Facebook 資料、大頭貼
amazon blogs
下週(星期五) 11/25 調課至2017年1月6日(星期五)
跑一圈
http://qwert123451410113.blogspot.tw/
http://d0214021.blogspot.tw/
Tinkercad
演講
Unity每次開啟一個新的場景都會有一台Main Camrea(主相機)
使用者可以調整視窗的大小與位置。 Toolbar 工具列. Unity 編輯器的最上方是工具列的Layout
【Unity】Animator教學-以Mecanim Example Scenes為例- 【
子午
Unity 外包
Google VR SDK for Unity
10/21 不上課, 調課至11月11日(星期五)
theTime = System.DateTime.Now.ToString("hh:mm:ss"); theDate = System.DateTime.Now.ToString("MM/dd/yyyy"); theMonth = System.DateTime.Now.get_Month(); theDay = System.DateTime.Now.get_Day();
http://answers.unity3d.com/questions/9862/read-time-and-date.html
Unity 倒數計時
[C#] 用Timer和DateTime 作時間倒數
DateTime dt;
TimeSpan ts="XXX";
//We can covnert 'ts' to 'dt' like this:
dt= Convert.ToDateTime(ts.ToString());
http://stackoverflow.com/questions/10276228/timespan-to-datetime-conversion[日期時間][C#]使用TimeSpan計算兩個時間的差值
網頁製作:
1. 部落格網頁 請加入 程式設計工藝大師 的超連結
2. 將部落格網址放在: 2015逢甲應數物件導向C#學號同學姓名與網址
http://54.224.50.178/
http://54.146.135.92/
3D 動作擷取
Download Motion Capture Area
木偶人 (2:綁定)
http://tccnchsu.blogspot.tw/2015/09/blog-post.html
unity 專題製作
http://fcumathunity.weebly.com/
2016年2月18日 星期四
2016 逢甲大學 物件導向程式設計_JAVA
網站 程序開發 (2016-02-18刊登) | |
案件預算 | 80萬~100萬 |
PHP 程式設計師
資料庫:MySQL
網頁排版:HTML、CSS
其他技術:jQuery、Ajax、OOP、Lavarel
- 職務類別:
- 軟體設計工程師、Internet程式設計師
- 工作待遇:
- 月薪 3萬5仟元 至 8萬元
5. 第六週 (2016年3月25日)
你是否跟上了世界?
========================================================================
JavaScript小程式:不重覆的random亂數
[JavaScript]如何使用JavaScript
a. 寫出演算法
3. 部落格 (期中考之後的部分) 40
========================================================================
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
var a,b,c;
a=0;
function add() {
b=3;
c=3;
var radio1 = document.getElementsByName("v1");
var radio2 = document.getElementsByName("v2");
for(var i=0;i
{
if(radio1.item(i).checked==true)
{
i = i+1
alert(i);
if (i==1)
{
a=a+1;
}
document.getElementById('c1').value=a;
break;
}
}
for(var i=0;i
{
if(radio2.item(i).checked==true)
{
i = i+1
alert(i);
if (i==1)
{
a=a+1;
}
document.getElementById('c1').value=a;
break;
}
}
drawChart();
}
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', a],
['Eat', b],
['Commute', c],
]);
var options = {
title: 'My Daily Activities'
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
你選了什麼?
300年400年
1000年
你選了什麼?
300年400年
1000年
你選了什麼?
300年400年
1000年
c1:
c2:
c3:
你選了什麼?
PHP MYSQL資料庫程式開發
安裝Android Studio 開發工具
第七週 (2016年4月15日)
一打開會顯示Hello world!的字串
改成自己的學號與姓名
==================================================================
安裝Android Studio 開發工具
Download the new Windows installer package.
4. 第五週 (2016年3月18日)
下載eclipse
Java SE Development Kit 7u79
Eclipse設定JDBC連接MySQL資料庫
Example (MySQLi Object-oriented)
==================================================================
4. 第四週 (2016年3月11日)
sql phploging
3. 第三週 (2016年3月4日)
[教學] PHP & MySQL
認識 MySQL 資料庫 (phpMyAdmin)
php---mysql-教學
2. 第二週 (2016年2月26日)
如何利用phpMyAdmin建立MySQL資料庫與設計?
Excel匯入MySQL
以下介紹兩種Excel資料放到MySQL的方式,但不管那一種方式,最重要的都是要注意Excel資料的編碼,與MySQL資料表的編碼,避免轉到資料庫後,變成亂碼。
========================================================
https://www.cyut.edu.tw/~recruit/graduate/105201.pdf
java課程
考試
1.
回答下列問題
1.為何why要選修這門課?(動機)
參考網址
java 下載 與 安裝 執行 hellow
http://tccnchsu.blogspot.com/2010/02/java.html
google blog css
java button array event e
java 整數轉字串
=================================================================
ActionListener on array of JButtons
JAVA 如何取/產生亂數 (大學程式設計 第三課)
Action Listener for an Array of Buttons. Help
網站參考
=======================================================================
第十四週
App Inventor 2 環境建置
http://beta.appinventor.mit.edu/
第一個App
範例教學 - App Inventor 中文學習網 20
[Android] Android Studio 安裝模擬器的小問題
第十二週
import java.awt.*;
import java.awt.event.*;
import java.util.Random;
import javax.swing.*;
public class Calculator extends JFrame implements
ActionListener{
JButton button[]=new JButton[10];
public static void main(String[]args){
new Calculator();
}
public Calculator()
{
String s;
int myrand;
int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int[] aresult;
int temp;
Random ran = new Random();
for (int i = 0; i < 9; i++)
{
System.out.println(a[i]);
}
for (int i = 0; i < 9; i++)
{
myrand=ran.nextInt(9-i);
temp=a[8-i];
a[8-i]=a[myrand];
a[myrand]=temp;
}
for (int i = 0; i < 9; i++)
{
System.out.println(a[i]);
}
JFrame window=new JFrame("Calculator");
window.setDefaultLookAndFeelDecorated(true);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setLayout(new GridLayout(3,3));
JPanel jplPanel = new JPanel();
jplPanel.setLayout(new GridLayout(3,3));
//s=Integer.toString(1);
s=String.valueOf(1);
//System.out.println(s);
//s="1";
for (int i = 0; i < 9; i++)
{
button[i] = new JButton();
button[i].setActionCommand(s);
button[i].addActionListener(this);
button[i].setSize(50,50);
button[i].setText(Integer.toString(a[i]));
jplPanel.add(button[i]);
}
window.getContentPane().add(jplPanel, BorderLayout.CENTER);
window.setSize(500,500);
window.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
for(int i=1; i <= 9; i++)
{
if(e.getSource() == button[i]){
System.out.println(i);
}
}
}
}
import java.awt.*;
import java.awt.event.*;
import java.util.Random;
import javax.swing.*;
public class Calculator extends JFrame implements
ActionListener{
JButton button[]=new JButton[10];
public static void main(String[]args){
new Calculator();
}
public Calculator()
{
String s;
JFrame window=new JFrame("Calculator");
window.setDefaultLookAndFeelDecorated(true);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setLayout(new GridLayout(3,3));
JPanel jplPanel = new JPanel();
jplPanel.setLayout(new GridLayout(3,3));
//s=Integer.toString(1);
s=String.valueOf(1);
//System.out.println(s);
//s="1";
int myrand;
for (int i = 1; i <= 9; i++)
{
button[i] = new JButton();
Random ran = new Random();
myrand=ran.nextInt(9)+1;
button[i].setActionCommand(s);
button[i].addActionListener(this);
button[i].setSize(50,50);
button[i].setText(Integer.toString(myrand));
jplPanel.add(button[i]);
}
window.getContentPane().add(jplPanel, BorderLayout.CENTER);
window.setSize(500,500);
window.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
for(int i=1; i <= 9; i++)
{
if(e.getSource() == button[i]){
System.out.println(i);
}
}
}
}
=======================================================================
import java.awt.event.*;
import java.util.Random;
import javax.swing.*;
public class Calculator extends JFrame implements ActionListener{
JButton button[]=new JButton[10];
public static void main(String[]args){
new Calculator();
}
public Calculator()
{
String s;
JFrame window=new JFrame("Calculator");
window.setDefaultLookAndFeelDecorated(true);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setLayout(new GridLayout(3,3));
JPanel jplPanel = new JPanel();
jplPanel.setLayout(new GridLayout(3,3));
//s=Integer.toString(1);
s=String.valueOf(1);
//System.out.println(s);
//s="1";
int myrand;
for (int i = 1; i <= 9; i++)
{
button[i] = new JButton();
Random ran = new Random();
myrand=ran.nextInt(9)+1;
button[i].setActionCommand(s);
button[i].addActionListener(this);
button[i].setSize(50,50);
button[i].setText(Integer.toString(myrand));
jplPanel.add(button[i]);
}
window.getContentPane().add(jplPanel, BorderLayout.CENTER);
window.setSize(500,500);
window.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
for(int i=1; i
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Calculator extends JFrame{
public static void main(String[]args){
JFrame window=new JFrame("Calculator");
JPanel jplPanel = new JPanel();
JButton button[]=new JButton[10];
for (i =
1
; i <= 9
; i++)
button[i] = new JButton();
button[i].setSize(50,50);button[i].setText(Integer.toString(i+1));
jplPanel.add(button[i]);
}
window.getContentPane().add(jplPanel, BorderLayout.CENTER);
window.setSize(500,500);
window.setVisible(true);
}}
======================================================================
多個按鈕
How to create objects (JButton) array?
JButton Source Code
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Test
{
public static void main(String[] args)
{
JFrame jtfMainFrame = new JFrame("Which Button Demo");
jtfMainFrame.setSize(450, 150);
JButton jbnButton1 = new JButton("Button 1");
JPanel jplPanel = new JPanel();
jplPanel.add(jbnButton1);
jtfMainFrame.getContentPane().add(jplPanel, BorderLayout.CENTER);
jtfMainFrame.setVisible(true);
System.out.print("chih-yu hsu");
}
}
============================================================
作業
http://socket.io/demos/chat/
A simple chat demo for socket.io
Two way communication between server and client on socket.io node.js
1.
製作自己的學習部落格blog並
1.為何why要選修這門課?(動機)
實作
class Test
{
public static void main(String[] args)
{
System.out.println("_____*_____");
System.out.println("____***____");
System.out.println("___*****___");
System.out.println("__*******__");
System.out.println("_____*_____");
System.out.println("_____*_____");
}
}
參考網址
java 下載 與 安裝 執行 hellow
http://tccnchsu.blogspot.com/2010/02/java.html
google blog css
同學的部落格
學號 姓名 網址
D9735878 劉哲宇 http://nicejava-java.blogspot.com/
D9785801 張鶴櫪 http://d9785801.blogspot.com/
D9735780 劉華瑋 http://alan5820.blogspot.com/
D9735851 彭凱頎 http://bleakmirage.blogspot.com/
D9735818 蕭銘宏 http://sean80221123.blogspot.com/
D9735937 汪筠捷 http://tony11206.blogspot.com/
D9785934李虹毅http://responsible10.blogspot.com/
D9785862王志明 http://j12345741258.blogspot.com/
D9790384吳育全 http://gary1424.blogspot.com/
D9785760莊桂軒http://www.wretch.cc/blog/onlyyazu
D9785917 謝翰嶔 http://jack10169.blogspot.com/
D9785790 詹宏茂 http://rfdg8546.blogspot.com/
D9726464 吳昱鋒 http://www.wretch.cc/blog/jk15478
D9642313 黃俊隆http://loganlearninglog.blogspot.com/
D9785578 汪聖凱http://www.wretch.cc/blog/bho2980112sa
D9726481 黃建志 http://s10024157.blogspot.com/
D9681524 郭政霖 http://www.wretch.cc/blog/charlie0525
d9643522 林哲瑜 http://www.wretch.cc/blog/warbobobo
d9726327 陳政瑜 http://www.wretch.cc/blog/jc1113
D9681200 廖崇閔http://www.wretch.cc/blog/kobe770201
D9681483 孫子策http://www.wretch.cc/blog/qoopooguy
D9681609劉駿賢http://www.wretch.cc/blog/chi2980119nn
D9735970顏三峻http://www.wretch.cc/blog/ysj78113
D9681139林俊德http://www.wretch.cc/blog/YFU385
D9786107郭榮浩http://swsy10301.blogspot.com/
D9681452吳智閔http://tw.myblog.yahoo.com/jw!zJVuSkGFBQBrxXRQDPohWf1w5209
D9681231劉晏君http://www.wretch.cc/blog/postre
D9642433柯志陽http://www.wretch.cc/blog/s2463715s
D9681316郭宗賢http://kuohome123.blogspot.com/
INTERACTIVE HTML5 MATH WEB APPS FOR MOBILE LEARNING
Google Web Designer
C程式語言2010
程式MATLAB設計
If you need detail notes, please refer to the fallowing blogs.
勵志文章 Article to encourage you!
醫生的反省
不要佔人便宜
弟子規 全文
我們的未來 你知道嗎?
創意與感動
以專注力度過2012
Be passion of focusing on life to fly over 2012.
程式設計就如同作文一樣,唯有感動才能創作。老師所能帶領同學分享地就是如何體驗感動,產生創作的熱情!
As a teacher I am, what I can do is only to lead students to fell surprise with full passion to be creative!
The Secret 每日自我激勵短片
震撼全人類的視頻,看完這個你們有什 感受
心中的小星星
三個傻瓜
3 Idiots - Official Trailer |
最能抓住財富創造方式的人,是很會製造東西的人,常被稱作工匠、師傅。他們的手工藝品成為商店的手工商品,隨著工業化的程度增加,工匠日漸消失,遺留下來的最大族群,叫做電腦程式設計師。
-------------------------------------------
經濟學的角度,"創新"可以視為將人的一生經歷壓縮至短短數年中,與其庸庸碌碌地工作40年,還不如盡全力工作4年。科技產業中,這份衝勁將帶來豐厚的回報,快速工作帶來額外報酬。
--------------------------------------------
要賺到100萬必須忍受100萬價值的痛苦。在郵局工作一輩子,存下的每一分錢最後可以得壹百萬,但必須承受在郵局待 50年所承受壓力。創業家是把50年份的壓力濃縮於數年間體驗,承受與經濟價值相等的痛苦後,通常能取得報酬,這是基本定律。
書名:駭客與畫家 O'Reilly
類神經網路的數學模式在分類問題之應用
http://tccnchsuneuralnetwork.blogspot.com/2008/11/blog-post.html
公告
報名4/15(五)、16、17在朝陽科大2011 TiC100 中區TTT創造力教育探索營
逢甲大學與台中市政府共同舉辦「2011國際綠色生活創意競賽」已正式起跑,報名時間自即日起至4月30日
2011年全球設計大賽Electrolux Design Lab
http://www.electrolux.com/designlab
100年04月14日四9 期中考試(14-20日)
機器人
http://tiltedtwister.com/
http://www.youtube.com/watch?v=3QOvEG27Gt4
LEGO Mindstorms Sudoku Solver
雲淡風輕: 使用NXC撰寫NXT程式---第一章Hello NXC
LEGO NXT-G 教學 - 登入- Yahoo!奇摩
Secret
Java 系列電子書
http://cooking-java.blogspot.com/search/label/Android
期末考
1. Run 現有的Android 程式 50%
2. 自己的程式 50%
==============================================================
ClientAndroid中的ip用10.0.2.2是本機模擬器的ip
http://www.javaworld.com.tw/jute/post/view?bid=26&id=283396
參考
http://developer.android.com/guide/developing/tools/emulator.html#networkaddresses
ServerClientAndroid.rar (85.68k)
==============================================================
模擬器不支援Camera
架Server用Socket送圖檔過去
可以參考
http://www.tomgibara.com/android/camera-source
版本是android比較舊的版本
需做一點修改
在android 2.1的版本有跑過是OK的
==============================================================
imageview
Resize and Rotate Image - Example
=================================================================
package edu.cyut.chsu;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
public class Mybitmaptest extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
LinearLayout linLayout = new LinearLayout(this);
// load the origial BitMap (500 x 500 px)
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),
R.drawable.android);
int width = bitmapOrg.getWidth();
int height = bitmapOrg.getHeight();
int newWidth = 200;
int newHeight = 200;
// calculate the scale - in this case = 0.4f
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;
// createa matrix for the manipulation
Matrix matrix = new Matrix();
// resize the bit map
matrix.postScale(scaleWidth, scaleHeight);
// rotate the Bitmap
matrix.postRotate(45);
// recreate the new Bitmap
Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0,
width, height, matrix, true);
// make a Drawable from Bitmap to allow to set the BitMap
// to the ImageView, ImageButton or what ever
BitmapDrawable bmd = new BitmapDrawable(resizedBitmap);
ImageView imageView = new ImageView(this);
// set the Drawable on the ImageView
imageView.setImageDrawable(bmd);
// center the Image
imageView.setScaleType(ScaleType.CENTER);
// add ImageView to the Layout
linLayout.addView(imageView,
new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT
)
);
// set LinearLayout as ContentView
setContentView(linLayout);
}
}
===============================================================
Index of /ij/download/examples/DicomViewer
作業
=================================================
rem Compiles and runs the DicomViewer example program
rem assumes ij.dir is in the current folder
rem SET PATH=C:\jdk1.2\bin;%PATH%
set CLASSPATH=ij.jar;.
javac -deprecation DicomViewer.java
java DicomViewer 000006.dcm
===========================================================
import ij.*;
import java.applet.*;
import java.awt.*;
import ij.process.*;
/**Simple applet that demonstrates how to use ImageJ's ImageProcessor class.*/
public class IPDemo extends Applet {
String name;
Image img;
ImageProcessor ip = null;
public void init() {
setLayout(new BorderLayout());
Panel p = new Panel();
p.setLayout(new GridLayout(5, 3));
/*
p.add(new Button("Reset"));
p.add(new Button("Flip"));
p.add(new Button("Invert"));
p.add(new Button("Lighten"));
p.add(new Button("Darken"));
p.add(new Button("Rotate"));
p.add(new Button("Zoom In"));
p.add(new Button("Zoom Out"));
p.add(new Button("Threshsold"));
p.add(new Button("Smooth"));
p.add(new Button("Sharpen"));
p.add(new Button("Find Edges"));
p.add(new Button("Macro 1"));
p.add(new Button("Macro 2"));
p.add(new Button("Add Noise"));
*/
add("South", p);
name = getParameter("img");
img = getImage(getDocumentBase(), name);
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(img, 0);
try {tracker.waitForID(0);}
catch (InterruptedException e){}
if (name.endsWith("jpg"))
ip = new ColorProcessor(img);
else
ip = new ByteProcessor(img);
ip.snapshot();
ip.noise(20);
img = ip.createImage();
repaint();
}
public void update(Graphics g) {
paint(g);
}
public void paint(Graphics g) {
g.drawImage(img, 0, 0, this);
}
public boolean action(Event e, Object arg) {
if (e.target instanceof Button) {
String label = (String)arg;
if (label.equals("Reset"))
ip.reset();
else if (label.equals("Flip"))
ip.flipVertical();
else if (label.equals("Invert"))
ip.invert();
else if (label.equals("Lighten"))
ip.multiply(1.1);
else if (label.equals("Darken"))
ip.multiply(0.9);
else if (label.equals("Rotate"))
ip.rotate(30);
else if (label.equals("Zoom In"))
ip.scale(1.2, 1.2);
else if (label.equals("Zoom Out"))
ip.scale(0.8, 0.8);
else if (label.equals("Threshsold"))
ip.autoThreshold();
else if (label.equals("Smooth"))
ip.smooth();
else if (label.equals("Sharpen"))
ip.sharpen();
else if (label.equals("Find Edges"))
ip.findEdges();
else if (label.equals("Macro 1"))
macro1();
else if (label.equals("Macro 2"))
macro2();
else if (label.equals("Add Noise"))
ip.noise(20);
img = ip.createImage();
repaint();
return true;
}
return false;
}
void updateAndDraw() {
img.flush();
img = ip.createImage();
getGraphics().drawImage(img, 0, 0, this);
}
void macro1() {
for (int i=10; i<=360; i+=10) {
ip.reset();
ip.rotate(i);
updateAndDraw();
}
}
void macro2() {
double scale = 1, m = 1.2;
for (int i=0; i<20; i++) {
ip.reset();
scale *= m;
ip.scale(scale, scale);
updateAndDraw();
}
for (int i=0; i <20; i++) {
ip.reset();
scale /= m;
ip.scale(scale, scale);
updateAndDraw();
}
}
}
=====================================================
ImageJ
http://rsb.info.nih.gov/ij/download/examples/
java classpath
java appletviewer
Fiji is easy to install
For running ImageJ you need the ImageJ class and configuration files, a Java Runtime Environment
(JRE) and—for compiling your own plugins—a Java compiler with the required
libraries, as for example included in the Java 2 SDK Standard Edition (J2SE) from Sun
Microsystems. Depending on the ImageJ distribution you are using, some or all of this may
already be included.
1.3.1 Installing ImageJ
The latest distribution of ImageJ can be downloaded from http://rsb.info.nih.gov/ij/download.
html.
In the following the installation of ImageJ will be described briefly for different operating
systems. More detailed and up-to-date installation instructions can be found at http://rsb/.
info.nih.gov/ij/docs/install.
If you already have a JRE (and a Java compiler) installed on your computer and you are
familiar with Java, you just need to download the ImageJ class and configuration files which
are available as a ZIP archive. To run ImageJ, add ij.jar to your classpath and execute class
ij.ImageJ. This also works for all operating systems for which there is no specific ImageJ
distribution but for which a Java runtime environment is available.
Windows
The Windows version is available with installer, both with and without a Java Runtime
Environment (JRE).
Chromosomes
java 繼承
例: extends Applet
java applet tutorial
====================================================================
import ij.*;
import java.applet.*;
import java.awt.*;
import ij.process.*;
/**Simple applet that demonstrates how to use ImageJ's ImageProcessor class.*/
public class IPDemo extends Applet {
String name;
Image img;
ImageProcessor ip = null;
public void init() {
setLayout(new BorderLayout());
Panel p = new Panel();
p.setLayout(new GridLayout(5, 3));
p.add(new Button("Reset"));
p.add(new Button("Flip"));
p.add(new Button("Invert"));
p.add(new Button("Lighten"));
p.add(new Button("Darken"));
p.add(new Button("Rotate"));
p.add(new Button("Zoom In"));
p.add(new Button("Zoom Out"));
p.add(new Button("Threshsold"));
p.add(new Button("Smooth"));
p.add(new Button("Sharpen"));
p.add(new Button("Find Edges"));
p.add(new Button("Macro 1"));
p.add(new Button("Macro 2"));
p.add(new Button("Add Noise"));
add("South", p);
name = getParameter("img");
img = getImage(getDocumentBase(), name);
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(img, 0);
try {tracker.waitForID(0);}
catch (InterruptedException e){}
if (name.endsWith("jpg"))
ip = new ColorProcessor(img);
else
ip = new ByteProcessor(img);
ip.snapshot();
}
public void update(Graphics g) {
paint(g);
}
public void paint(Graphics g) {
g.drawImage(img, 0, 0, this);
}
public boolean action(Event e, Object arg) {
if (e.target instanceof Button) {
String label = (String)arg;
if (label.equals("Reset"))
ip.reset();
else if (label.equals("Flip"))
ip.flipVertical();
else if (label.equals("Invert"))
ip.invert();
else if (label.equals("Lighten"))
ip.multiply(1.1);
else if (label.equals("Darken"))
ip.multiply(0.9);
else if (label.equals("Rotate"))
ip.rotate(30);
else if (label.equals("Zoom In"))
ip.scale(1.2, 1.2);
else if (label.equals("Zoom Out"))
ip.scale(0.8, 0.8);
else if (label.equals("Threshsold"))
ip.autoThreshold();
else if (label.equals("Smooth"))
ip.smooth();
else if (label.equals("Sharpen"))
ip.sharpen();
else if (label.equals("Find Edges"))
ip.findEdges();
else if (label.equals("Macro 1"))
macro1();
else if (label.equals("Macro 2"))
macro2();
else if (label.equals("Add Noise"))
ip.noise(20);
img = ip.createImage();
repaint();
return true;
}
return false;
}
void updateAndDraw() {
img.flush();
img = ip.createImage();
getGraphics().drawImage(img, 0, 0, this);
}
void macro1() {
for (int i=10; i<=360; i+=10) {
ip.reset();
ip.rotate(i);
updateAndDraw();
}
}
void macro2() {
double scale = 1, m = 1.2;
for (int i=0; i<20; i++) {
ip.reset();
scale *= m;
ip.scale(scale, scale);
updateAndDraw();
}
for (int i=0; i <20; i++) {
ip.reset();
scale /= m;
ip.scale(scale, scale);
updateAndDraw();
}
}
}
====================================================================
例: extends JFrame
====================================================================
import javax.swing.Timer;
import java.awt.event.*;
import java.util.*;
import java.awt.*;
import javax.swing.*;
public class TimerDemo extends JFrame implements ActionListener {
static JTextField tbx1=new JTextField(10); // 建立1文字方塊物件
Timer t = new Timer(1000,this);
TimerDemo() {
t.start();
}
public static void main(String args[]) {
TimerDemo td = new TimerDemo();
GridLayout grid33= new GridLayout(3,3);
td.setLayout(grid33);
td.setSize(450,450);
JPanel p1 = new JPanel(grid33); //實作 panel 1
p1.add(tbx1);
td.add(p1); // 在視窗myfrm 內加入 panel 1
td.setVisible(true);
// create a dummy frame to keep the JVM running
// (for demonstation purpose)
// java.awt.Frame dummy = new java.awt.Frame();
// dummy.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == t) {
//System.out.println
// ("Being ticked " + Calendar.getInstance().getTime());
// Date mydate=Calendar.getInstance().getTime();
// tbx1.setText(mydate.toString());
tbx1.setText(" "+Calendar.getInstance().getTime());
}
}
}
==================================================================
第十一週 (2011年4月29日)
作業
Create a Timer object
參考
java class timer
封裝, 建構子
==================================================================
//主檔案
class Object1 {
public static void main(String args[]) {
Person1 p1 = new Person1("大雄", 50);
Person1 p2 = new Person1("胖虎", 80);
Person1 p3 = new Person1();
p1.checkWeight();
p2.checkWeight();
p2.weight = 68;
p1.checkWeight();
p2.checkWeight();
p3.checkWeight();
}
}
===================================================================//另一類別檔
class Person1 {
String name;
int weight;
//建構子
Person1(String pName, int pWeight) {
name = pName;
weight = pWeight;
}
Person1() {
name = "0";
weight = 1;
}
void checkWeight() {
System.out.print(name+"體重 "+weight+" 公斤,");
if (weight < 70)
System.out.println("很苗條!");
else
System.out.println("很穩重!");
}
}
====================================================================
// with event
//Swing, JButton類別 有ActionListener
//Swing, JButton類別
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SwingEightPuzzleEvent extends JFrame implements ActionListener
{
//static JFrame myfrm=new JFrame("JButton class"); // Java Class JFrame
//static AwtTestEvent myfrm=new AwtTestEvent("JFrame 1 "); // Java Class JFrame
static JTextField tbx1=new JTextField(2); // 建立1文字方塊物件
static JButton buttons[]=new JButton[10];
static JLabel labels[]=new JLabel [10];
public SwingEightPuzzleEvent()
{
}
public static void main(String args[])
{
SwingEightPuzzleEvent myfrm=new SwingEightPuzzleEvent();
String numbers[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8"};
FlowLayout flow=new FlowLayout();
GridLayout grid12= new GridLayout(1,2);
GridLayout grid33= new GridLayout(3,3);
myfrm.setLayout(grid12);
myfrm.setSize(450,450);
JPanel p1 = new JPanel(grid33); //實作 panel 1
for (int i = 0; i < numbers.length; i++)
{
buttons[i] = new JButton(numbers[i]); // create buttons
p1.add(buttons[i], grid33); // 在 panel 1內加入按鈕陣列
}
myfrm.add(p1); // 在視窗myfrm 內加入 panel 1
JPanel p3 = new JPanel(grid33); //實作 panel 3
for (int i = 0; i < numbers.length; i++)
{
labels[i] = new JLabel(); // create labels
p3.add(labels[i], grid33); // 在 panel 1內加入按鈕陣列
}
myfrm.add(p3); // 在視窗myfrm 內加入 panel 3
JPanel p2 = new JPanel(flow); //實作 panel 2
JButton btn1=new JButton("JButton 1"); // 建立按鈕物件 btn1
btn1.addActionListener(myfrm);
p2.add(tbx1); // 在 panel 2內加入文字方塊
p2.add(btn1); // 在 panel 2內加入按鈕
myfrm.add(p2); // 在視窗myfrm 內加入 panel 2
myfrm.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
String numbers[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8"};
//int rndno;
//String stringValue;
//stringValue=tbx1.getText();
//int intValue = Integer.parseInt(stringValue);
//System.out.println(intValue);
//labels[intValue].setText(stringValue);
/*
for (int j = 0; j < 9; j++)
{
//rndno=(int) (Math.random()*9);
//System.out.println(rndno);
//numbers[i]=String.valueOf(rndno);
//buttons[i].setLabel(numbers[i]);
}
*/
//tbx1.setText(numbers[0]);
//buttons[rndno].setBackground(Color.blue);
//labels[rndno].setText(numbers[0]);
}
}
第十週 (2011年4月22日)
What is 8 puzzle?
=========================================================================// with event//Swing, JButton類別 有ActionListener
//Swing, JButton類別
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SwingTestEvent extends JFrame implements ActionListener
{
//static JFrame myfrm=new JFrame("JButton class"); // Java Class JFrame
//static AwtTestEvent myfrm=new AwtTestEvent("JFrame 1 "); // Java Class JFrame
static JTextField tbx1=new JTextField(2); // 建立1文字方塊物件
static JButton buttons[]=new JButton[10];
static JLabel labels[]=new JLabel [10];
public static void main(String args[])
{
SwingTestEvent myfrm=new SwingTestEvent();
String numbers[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8"};
FlowLayout flow=new FlowLayout();
GridLayout grid12= new GridLayout(1,2);
GridLayout grid33= new GridLayout(3,3);
myfrm.setLayout(grid12);
myfrm.setSize(450,450);
JPanel p1 = new JPanel(grid33); //實作 panel 1
for (int i = 0; i < numbers.length; i++)
{
buttons[i] = new JButton(numbers[i]); // create buttons
p1.add(buttons[i], grid33); // 在 panel 1內加入按鈕陣列
}
myfrm.add(p1); // 在視窗myfrm 內加入 panel 1
JPanel p3 = new JPanel(grid33); //實作 panel 3
for (int i = 0; i < numbers.length; i++)
{
labels[i] = new JLabel(); // create labels
p3.add(labels[i], grid33); // 在 panel 1內加入按鈕陣列
}
myfrm.add(p3); // 在視窗myfrm 內加入 panel 3
JPanel p2 = new JPanel(flow); //實作 panel 2
JButton btn1=new JButton("JButton 1"); // 建立按鈕物件 btn1
btn1.addActionListener(myfrm);
p2.add(tbx1); // 在 panel 2內加入文字方塊
p2.add(btn1); // 在 panel 2內加入按鈕
myfrm.add(p2); // 在視窗myfrm 內加入 panel 2
myfrm.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
//String numbers[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8"};
String numbers[]=new String[101];
for (int i = 0; i <100; i++)
{
numbers[i]=String.valueOf(i);
}
int rndno;
String stringValue;
String tmp;
//stringValue=tbx1.getText();
//int intValue = Integer.parseInt(stringValue);
//System.out.println(intValue);
//labels[intValue].setText(stringValue);
for (int i = 0; i < 9; i++)
{
int j=8-i;
rndno=(int) (Math.random()*(j+1));
System.out.println(rndno);
tmp=numbers[j];
numbers[j]=numbers[rndno];
numbers[rndno]=tmp;
}
for (int i = 0; i < 9; i++)
{
System.out.println(numbers[i]);
buttons[i].setLabel(numbers[i]);
}
//tbx1.setText(numbers[0]);
//buttons[rndno].setBackground(Color.blue);
//labels[rndno].setText(numbers[0]);
}
}
作業 bingo card
第八週 (2011年4月8日)
====================================================================
// with event
//Swing, JButton類別 有ActionListener
//Swing, JButton類別
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SwingTestEvent extends JFrame implements ActionListener
{
//static JFrame myfrm=new JFrame("JButton class"); // Java Class JFrame
//static AwtTestEvent myfrm=new AwtTestEvent("JFrame 1 "); // Java Class JFrame
static JTextField tbx1=new JTextField(2); // 建立1文字方塊物件
static JButton buttons[]=new JButton[10];
static JLabel labels[]=new JLabel [10];
public static void main(String args[])
{
SwingTestEvent myfrm=new SwingTestEvent();
String numbers[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8"};
FlowLayout flow=new FlowLayout();
GridLayout grid12= new GridLayout(1,2);
GridLayout grid33= new GridLayout(3,3);
myfrm.setLayout(grid12);
myfrm.setSize(450,450);
JPanel p1 = new JPanel(grid33); //實作 panel 1
for (int i = 0; i < numbers.length; i++)
{
buttons[i] = new JButton(numbers[i]); // create buttons
p1.add(buttons[i], grid33); // 在 panel 1內加入按鈕陣列
}
myfrm.add(p1); // 在視窗myfrm 內加入 panel 1
JPanel p3 = new JPanel(grid33); //實作 panel 3
for (int i = 0; i < numbers.length; i++)
{
labels[i] = new JLabel(); // create labels
p3.add(labels[i], grid33); // 在 panel 1內加入按鈕陣列
}
myfrm.add(p3); // 在視窗myfrm 內加入 panel 3
JPanel p2 = new JPanel(flow); //實作 panel 2
JButton btn1=new JButton("JButton 1"); // 建立按鈕物件 btn1
btn1.addActionListener(myfrm);
p2.add(tbx1); // 在 panel 2內加入文字方塊
p2.add(btn1); // 在 panel 2內加入按鈕
myfrm.add(p2); // 在視窗myfrm 內加入 panel 2
myfrm.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
String stringValue;
stringValue=tbx1.getText();
int intValue = Integer.parseInt(stringValue);
System.out.println(intValue);
buttons[intValue].setBackground(Color.blue);
labels[intValue].setText(stringValue);
}
}
=====================================================================
http://www.idevelopment.info/data/Programming/java/swing/AWTExample.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ButtonText extends JFrame implements ActionListener {
public static void main(String[] args) {
ButtonText test = new ButtonText();
}
ButtonText( )
{
JButton mybutton1 = new JButton("Submit");
JButton mybutton2 = new JButton("Submit");
mybutton1.addActionListener(this);
//Container contentPane = frame.getContentPane();
//contentPane.add(mybutton1);
//contentPane.add(mybutton2);
getContentPane().add(mybutton1);
getContentPane().add(mybutton2);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new FlowLayout());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(200,100);
setVisible(true);
// System.out.println("wait");
//System.exit(0);
}
public void actionPerformed(ActionEvent e)
{
int rn;
rn=(int) (Math.random()*49) ;
System.out.println(rn );
}
}
=====================================================================
java layout
=============================================================
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ButtonText extends JFrame implements ActionListener {
public static void main(String[] args) {
ButtonText test = new ButtonText();
}
ButtonText( )
{
// JButton mybutton1 = new JButton("Submit");
// JButton mybutton2 = new JButton("Submit");
//mybutton1.addActionListener(this);
//getContentPane().add(mybutton1);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
/*
myframe.add(mybutton1);
myframe.add(mybutton2);
myframe.setLayout(new FlowLayout());
myframe.setSize(200,100);
myframe.setVisible(true);
// System.out.println("wait");
//System.exit(0);
*/
}
public void actionPerformed(ActionEvent e)
{
}
}
=============================================================
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ButtonText{
public static void main(String[] args) {
ButtonText test = new ButtonText();
}
ButtonText( )
{
Frame myframe=new Frame("Button Frame");
Button mybutton1 = new Button("Submit");
Button mybutton2 = new Button("Submit");
mybutton1.addActionListener(this);
myframe.add(mybutton1);
myframe.add(mybutton2);
myframe.setLayout(new FlowLayout());
myframe.setSize(200,100);
myframe.setVisible(true);
/*
// System.out.println("wait");
//System.exit(0);
*/
}
}
import java.awt.*;
import java.awt.event.*;
public class ButtonText {
public static void main(String[] args) {
Frame frame=new Frame("Button Frame");
Button button = new Button("Submit");
frame.add(button);
frame.setLayout(new FlowLayout());
frame.setSize(200,100);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
}
第四週 (2011年3月11日)
java button
An example to show how to use textboxs.
Please google the keywords VB event and Java event.
第四週 (2011年3月4日)
Vb button
It is easy to put a button on a VB form.
java button
Why it is so diffcult to put a button on a JAVA frame?
Java Class button is easy to be extended to make your own button class, but VB is not so open for you to do your own buton.
Java double to int and Other Conversions
Please google keywords "Java Button" to find another example!
To know how to put a button on a frame!
The most important commands are as follows.
import java.awt.*;
Frame frame=new Frame("Button Frame");
Button button = new Button("Submit");
frame.add(button);
frame.setVisible(true);
How to Create Button on Frame,Create a Button in Java,Code to ...
The comment "import java.awt.*;" is related to the file src.zip.
How to Use Buttons, Check Boxes, and Radio Buttons
java class button
隨堂練習
放上一個 Check Boxes
第三週 (2011年3月4日)
隨堂練習
輸入四個數字,前兩個數字代表列向量,後兩個數字代表行向量,
輸出矩陣相乘計算的結果
Java String int
Java String
java return type required
2. 第二週 (2011年2月25日)
課堂作業
1. 第一週 (2011年2月18日)
考試
1.
回答下列問題
1.為何why要選修這門課?(動機)
參考網址
java 下載 與 安裝 執行 hellow
http://tccnchsu.blogspot.com/2010/02/java.html
google blog css
====================================================================
奉獻與感動
富爸爸富小孩 為什麼我要學系這些課程
激勵演講
"我什麼都會" .......這傢伙當服務員太可惜了......超強模仿秀
90后CEO余佳文如何獲得馬云千萬美元風投 下 看后必轉
Speech: Never Give Up on Your Dreams 董丽娜《别把梦想逼上绝路》
【就是創意】朱學恒:關於夢想
永不放棄(繁體版)
夢想.激勵人心的演說
服務學習課程
《愛的真諦》 北京儿童合唱团 (1 Corinthians 13:4-8) Tippi
最強激勵影片8分鐘
08年奧運舉重冠軍施泰納令人感動的故事
尼克 Nick Vujicic(life without limbs)_為生命喝采
讓整個世界都沉默了的激勵演講
====================================================================
同學的部落格
學號 姓名 網址
D9735878 劉哲宇 http://nicejava-java.blogspot.com/
D9785801 張鶴櫪 http://d9785801.blogspot.com/
D9735780 劉華瑋 http://alan5820.blogspot.com/
D9735851 彭凱頎 http://bleakmirage.blogspot.com/
D9735818 蕭銘宏 http://sean80221123.blogspot.com/
D9735937 汪筠捷 http://tony11206.blogspot.com/
D9785934李虹毅http://responsible10.blogspot.com/
D9785862王志明 http://j12345741258.blogspot.com/
D9790384吳育全 http://gary1424.blogspot.com/
D9785760莊桂軒http://www.wretch.cc/blog/onlyyazu
D9785917 謝翰嶔 http://jack10169.blogspot.com/
D9785790 詹宏茂 http://rfdg8546.blogspot.com/
D9726464 吳昱鋒 http://www.wretch.cc/blog/jk15478
D9642313 黃俊隆http://loganlearninglog.blogspot.com/
D9785578 汪聖凱http://www.wretch.cc/blog/bho2980112sa
D9726481 黃建志 http://s10024157.blogspot.com/
D9681524 郭政霖 http://www.wretch.cc/blog/charlie0525
d9643522 林哲瑜 http://www.wretch.cc/blog/warbobobo
d9726327 陳政瑜 http://www.wretch.cc/blog/jc1113
D9681200 廖崇閔http://www.wretch.cc/blog/kobe770201
D9681483 孫子策http://www.wretch.cc/blog/qoopooguy
D9681609劉駿賢http://www.wretch.cc/blog/chi2980119nn
D9735970顏三峻http://www.wretch.cc/blog/ysj78113
D9681139林俊德http://www.wretch.cc/blog/YFU385
D9786107郭榮浩http://swsy10301.blogspot.com/
D9681452吳智閔http://tw.myblog.yahoo.com/jw!zJVuSkGFBQBrxXRQDPohWf1w5209
D9681231劉晏君http://www.wretch.cc/blog/postre
D9642433柯志陽http://www.wretch.cc/blog/s2463715s
D9681316郭宗賢http://kuohome123.blogspot.com/