2015年3月27日 星期五

3/27 簡單按鈕 JAVA

class test
{
public static void main(String[] args)
{
;
}
}
45456456  


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JButtonDemo2 {
JFrame jtfMainFrame;
JButton jbnButton1, jbnButton2;
JTextField jtfInput;
JPanel jplPanel;
public JButtonDemo2() {
jtfMainFrame = new JFrame("Frame1");
jtfMainFrame.setSize(50, 50);
jbnButton1 = new JButton("Button 1");
jbnButton2 = new JButton("Button 2");
jtfInput = new JTextField(20);
jplPanel = new JPanel();
jbnButton1.setMnemonic(KeyEvent.VK_I);
jbnButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jtfInput.setText("Hello!");
}
});
jbnButton2.setMnemonic(KeyEvent.VK_I);
jbnButton2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jtfInput.setText("Hey!");
}
});
jplPanel.setLayout(new FlowLayout());
jplPanel.add(jtfInput);
jplPanel.add(jbnButton1);
jplPanel.add(jbnButton2);
jtfMainFrame.getContentPane().add(jplPanel, BorderLayout.CENTER);
jtfMainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jtfMainFrame.pack();
jtfMainFrame.setVisible(true);
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager
.getCrossPlatformLookAndFeelClassName());
} catch (Exception e) {
}
JButtonDemo2 application = new JButtonDemo2();
}
}
7879897456

2015年3月19日 星期四

3/20 JAVA 迴圈



----------------------------------------------------------------------------------------------------


class Test
{
public static void main(String[] args)
{
for (int i = 10; i > 0; i--) {
    System.out.println(i);
}
}
}

2015年3月13日 星期五

3/13 第二週

<html>
<head>
<title> The First Example: Hello, World </title>
</head>
<body>
<h2> This line is HTML </h2>
<script language="JavaScript">
<!--
document.write("Hello, 仁豪.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>
java hello  

JAVA第二周
/**
 * 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.
    }
}
hw2
IP
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");
}
}
}
hw3  
html
<html>
<head>
<title> The First Example: Hello, World </title>
</head>
<body>
<h2> This line is ID </h2>
<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>
<h2> This line is ID </h2>
</body>
</html>

2015年3月5日 星期四

JAVA

-------------------------------------------------------------------------------------------

1.為何修這堂課:激勵人心
2.希望從這們課得到什麼知識:JAVA
3.我要如何修習這門課:上課聽課