2015年3月31日 星期二

Button

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class mathew
{
   public static void main(String[]args)
{
  JFrame   jtfMainFrame = new JFrame("Which Button Demo");
   jtfMainFrame.setSize(450, 150);

  JButton   jbnButton1 = new JButton("Button 1");
   JButton  jbnButton2 = new JButton("Button 2");
   JTextField    jtfInput = new JTextField(20);
 

 JPanel    jplPanel = new JPanel();
jplPanel.add(jtfInput);
jplPanel.add(jbnButton1);
jplPanel.add(jbnButton2);
jtfMainFrame.getContentPane().add(jplPanel, BorderLayout.CENTER);
jtfMainFrame.setVisible(true);
System.out.print("林承漢");
   
 
}

}




2015年3月19日 星期四

(二)電腦IP位址

例1(JavaScript)

1.複製以下程式碼 貼在一個新WordPad檔

<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>

2.儲存檔命名為"IPAdress.htm"
3.執行如以下圖即成功

hello word!!

1.複製以下程式碼 貼在一個新WordPad檔

/**
 * 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.
    }
}

2.儲存檔名命為"HelloWorldApp.java"
3.使用命令提示字元作Java編譯如下圖即成功