程式設計工藝大師 http://tccnchsu.blogspot.tw/

mgboy03517 發表在 痞客邦 留言(0) 人氣()

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Random;
public class Calculator extends JFrame implements ActionListener{
public static void main(String[]args){
new Calculator();

}
public Calculator()
{
String s;
Random ran = new Random();
int myran=ran.nextInt(9);

int temp;
 int[] a1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9};
 int[] re;
for (int i = 0; i < 9; i++)
{
temp=a1[i];
a1[i]=a1[myran];
a1[myran]=temp;
}
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));
JButton button[]=new JButton[10];
s=String.valueOf(1);

for (int i = 0; i < 9; i++)
{
button[i] = new JButton();
button[i].setSize(50,50);

button[i].setText(Integer.toString(a1[i]));

//button[i].setActionCommand("此按鈕為:"+i);
button[i].addActionListener(this);
jplPanel.add(button[i]);
}
window.getContentPane().add(jplPanel, BorderLayout.CENTER);
window.setSize(500,500);
window.setVisible(true);
}
 public void actionPerformed(ActionEvent e ) {
        //String cmd = e.getActionCommand();
//System.out.println(cmd);
}
}

mgboy03517 發表在 痞客邦 留言(0) 人氣()

1.為何why要選修這門課?(動機)
ANS;  主要原因是缺學分加上有一點小興趣 想看看學什麼
 
2.希忘從這門課獲得那些知識?(目標)

mgboy03517 發表在 痞客邦 留言(0) 人氣()

 
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

mgboy03517 發表在 痞客邦 留言(0) 人氣()

  • Apr 10 Fri 2015 14:55
  • 1~9

1~9
 
 
 
 

mgboy03517 發表在 痞客邦 留言(0) 人氣()

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

mgboy03517 發表在 痞客邦 留言(0) 人氣()

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

mgboy03517 發表在 痞客邦 留言(0) 人氣()

10912331_920951701257889_1961080861_o
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication12
{
public partial class Form1 : Form
{
public System.Windows.Forms.Button Button1;
public System.Windows.Forms.Button Button2;
Random rand = new Random();
Button[,] buttons = new Button[5, 5];
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Button1 = new System.Windows.Forms.Button();
Button1.Location = new Point(300, 30);
Button1.Size = new Size(100, 30);
Button1.Click += new EventHandler(Button1_Click);
Button1.Text = "change";
this.Controls.Add(Button1);
/*Button2 = new System.Windows.Forms.Button();
Button2.Location = new Point(200, 50);
Button2.Size = new Size(100, 30);
Button2.Text = "Change";
Button2.Click += new EventHandler(Button2_Click);
this.Controls.Add(Button2);
*/
for (int j = 1; j < 5; j++)
{
for (int i = 1; i < 5; i++)
{
buttons[i, j] = new Button();
buttons[i, j].Location = new Point( i * 50, j * 50);
buttons[i, j].Size = new Size(50, 50);
this.Controls.Add(buttons[i, j]);
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
int x, y, a;
int[] myarray = { 0, 1, 2, 3, 4, 5, 6, 7, 8,9,10,11,12,13,14,15 };
for (int i = 15; i > 1; i--)
{
x = rand.Next(0, i);
y = myarray[x];
myarray[x] = myarray[i];
myarray[i] = y;
}
for (int j = 1; j < 5; j++)
{
for (int i = 1; i < 5; i++)
{
a = myarray[(j - 1) * 4 + (i - 1)];
buttons[i, j].Text = Convert.ToString(a);
this.Controls.Add(buttons[i, j]);
}
}
}
protected void Button2_Click(object sender, EventArgs e)
{

}
}
}

mgboy03517 發表在 痞客邦 留言(0) 人氣()

未命名.png5
   

mgboy03517 發表在 痞客邦 留言(0) 人氣()

亂數不重複
 

mgboy03517 發表在 痞客邦 留言(0) 人氣()

看完這個影片
內心激盪出許多火花
還好我還只是不知道 而不是不相信
這代表我還有救

mgboy03517 發表在 痞客邦 留言(0) 人氣()

9x9乘法表
 
====================================================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

mgboy03517 發表在 痞客邦 留言(0) 人氣()

1 2
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。