2015年3月27日 星期五

2015.03.27-3 顯示名字

顯示chia

1.     cmd
2.     建立myjava資料夾
3.     wordpad 空白存檔為Test.txt
4.     更改附檔名為Test.javacd myjava
5.     dir
6.     javac Test.java (過)
7.     java Test(出錯)
8.     class Test
9.     javac Test.java(出錯)
10. class { }
11. javac Test.java(過)
12. java Test(出錯)
13. class Test
{
Public static void main(string[]args );
#記憶有關 #不回傳資料 #方法 #字串 #陣列

{
;
}
System.out.print(chia)
}
14. javac Test.java

15. java Test

2015.03.27-2 EXCEL+JAVA 按鈕與文字方格

EXCEL+JAVA 兩個按鈕與文字方格


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(150, 150);
JButton jbnButton1 = new JButton("Button 1");
JButton jbnButton2 = new JButton("Button 2");
JPanel jplPanel = new JPanel();
JTextField jtfInput = new JTextField(20);
jplPanel.add(jbnButton1);
jplPanel.add(jbnButton2);
jplPanel.add(jtfInput);

jtfMainFrame.getContentPane().add(jplPanel, BorderLayout.CENTER);
jtfMainFrame.setVisible(true);

System.out.print("hi");
}


}


2015.03.27-1 顯示字串

顯示字串


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");
JButton jbnButton1 = new JButton("Button 1");

JPanel jplPanel = new JPanel();
jplPanel.add(jbnButton1);
jtfMainFrame.getContentPane().add(jplPanel, BorderLayout.CENTER);
System.out.print("chia ning");
}

}


2015年3月20日 星期五

2015.3.20 -4 Java 寫99乘法表



Java 寫99乘法表

public class dowhile99
{  
    public static void main(String args[])  
    {  
        int i=1,k;  
        do{  
            k=1;  
            do  
            {  
                System.out.print(i+"*"+k+"="+(i*k)+"\t");  
                k++;  
            }while (k<=9);  
 
            System.out.println();  
            i++;  
        }while(i<=9);  
    }  
}  



2015.3.20 -3 javascript 做99乘法表 (附檔名改htm)



javascript 做99乘法表 (附檔名改htm)

<table border="1">
<script>
for(var i=0;i<3;i++)
{
    document.write("<tr>");
    for(var j=1;j<10;j++)
    {
        for(var k=3*i+1;k<=3*i+3;k++)
        {
        document.write("<td>"+k+"*"+j+"="+k*j+"</td>");
        }
        document.write("<tr>");
    }
    document.write("<tr>");
}
</script>
</table>




2015.3.20 -2 JAVA 1~10


JAVA 1~10

/**
 * The HelloWorldApp class implements an application that
 * simply prints "Hello World!" to standard output.
 */
class HelloWorldApp {
    public static void main(String[] args) {
System.out.println("1"); // Display the string.
System.out.println("2"); // Display the string.
System.out.println("3"); // Display the string.
System.out.println("4"); // Display the string.
System.out.println("5"); // Display the string.
System.out.println("6"); // Display the string.
System.out.println("7"); // Display the string.
System.out.println("8"); // Display the string.
System.out.println("9"); // Display the string.
System.out.println("10"); // Display the string.
    }
}


2015.3.20 -1 Excel巨集

2015.3.20 -1

Excel

1.點選錄製巨集
2.輸入1~10
3.取消錄製 清除儲存格
4.檢視巨集 點選編輯
5.在 模組 裡選 插入表單
6.製作按鈕
7.在 表單 裡選 檢視程式碼
(上面選項要選common)
8.執行!!!


2015年3月13日 星期五

2015.03.13-4 查IP位置(html)



<script language="JavaScript">
VIH_BackColor = "palegreen";
VIH_ForeColor = "navy";
VIH_FontPix = "16";
VIH_DisplayFormat = "You are visiting from:<br>IP Address: %%IP%%<br>Host: %%HOST%%";
VIH_DisplayOnPage = "yes";
</script>
<script language="JavaScript" src="http://scripts.hashemian.com/js/visitorIPHOST.js.php"></script>

副檔名改htm 即可

2015.03.13-3 TestInet1(Java)



import java.net.*;

public class TestInet1 {
  public static void main(String argv[]) 
  {
    try {
      InetAddress myip = InetAddress.getLocalHost();

      System.out.println(myip.getHostName());
      System.out.println(myip.getHostAddress());
    } catch (UnknownHostException e) {
      System.out.println("Error: unable to resolve localhost");
    }
  }
}

來源:http://xml-nchu.blogspot.tw/2012/12/java.html

步驟依舊
輸入javac 貼上檔案名+副檔名
輸入java 貼上檔案名




2015.03.13-2 HelloWorldApp



/**
 * The HelloWorldApp class implements an application that
 * simply prints "Hello World!" to standard output.
 */
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Display the string.
    }
}


來源:http://docs.oracle.com/javase/tutorial/getStarted/cupojava/win32.html


步驟:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
選擇Tutorials
第一個geting start
在wordpad貼上程式碼
儲存檔名改為java

開啟cmd
輸入cd 貼上目標位置C:\ning
輸入dir
輸入javac 貼上檔案名+副檔名
輸入java 貼上檔案名








2015.03.13-1 html


<html>
<head>
<title> The First Example: Hello, World </title>
</head>
<body>
<h2> This line is HTML </h2>

<script language="JavaScript">

<!--
document.write("Hello, World.This sentence is written using JavaScript.");
// Text on the right of 2 slashes is comment
/* This is comment
that occur more than 1 line
*/
//-->
</script>
<noscript>
Sorry, but your browser doesn't run JavaScript.
</noscript>

<h2> This line is HTML </h2>
</body>
</html>



file:///C:/Users/student/Desktop/index%20.htm

步驟1.開啟wordpad
步驟2.貼上程式碼
步驟3.更改姓名
步驟4.儲存檔案index 選擇txt副檔名
步驟5.更改副檔名為htm


參考來源: http://taiwantc.com/js/js_tut_a1.htm

2015年3月6日 星期五

聖誕樹

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("_____*_____");
}

}

2015.03.06 Q&A

2015.03.06
1.為何why要選修這門課?(動機)
已經大四,剩一學期就要畢業了,想在畢業前,除了自己在系上學過的之外,
多充實自己程式語言的能力,所以選了JAVA這門課

2.希望從這門課獲得那些知識?(目標)
我希望我可以從這門課學習到基本JAVA的編寫以及運用

3.我要如何修習這一門課?(態度與方法)
who, when, where 
除了上課聽講以外,
上課回家後,複習當日所上之內容,
課餘時間透過網路上資料自行在家練習




安裝JAVA



選電腦 按右鍵
進階系統設定 選環境變數
變數path編輯 變數值後加/;
貼上JAVA所在資料夾C:\Program Files \Java\jdk1.8.0_31\bin 即可

搜尋cmd 打 java 打javac