http://aiur3908.blogspot.tw/2015/02/android-android-studio.html
目前分類:未分類文章 (25)
- Jun 12 Fri 2015 16:09
(尚未設定標題)
- Jun 05 Fri 2015 14:24
安卓系統APP
加減乘除app
- Jun 05 Fri 2015 14:23
亂數不重複
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];
- May 08 Fri 2015 14:25
亂數重複
import java.awt.*;
import java.awt.event.*;
import java.util.Random;
import javax.swing.*;
class test
{
public static void main(String[] args)
{
JFrame jtfMainFrame = new JFrame("Which Button Demo");
jtfMainFrame.setSize(600, 200);
JPanel jplPanel = new JPanel();
int i;
int j=1;
int num1 , num2;
JButton jbnButton[] = new JButton[16];
JButton changeButton[] = new JButton[3];
jplPanel.setLayout (new GridLayout(4, 4));
for(i = 0;i<=15;i++){
Random ran = new Random();
jbnButton[i]=new JButton("Button"+(ran.nextInt(16)+1));
jplPanel.add(jbnButton[i]);
String s = Integer.toString(i+1);
jbnButton[i].addActionListener(new ActionListener() {
- Apr 24 Fri 2015 15:14
產生9個按鈕 按鈕可以按 會產生訊息(簡化)
- Apr 10 Fri 2015 15:12
按鈕可以按 產生9個按鈕
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");
JButton jbnButton2 = new JButton("Button 2");
JButton jbnButton3 = new JButton("Button 3");
JButton jbnButton4 = new JButton("Button 4");
JButton jbnButton5 = new JButton("Button 5");
JButton jbnButton6 = new JButton("Button 6");
JButton jbnButton7 = new JButton("Button 7");
JButton jbnButton8 = new JButton("Button 8");
JButton jbnButton9 = new JButton("Button 9");
jbnButton1.addActionListener(new ActionListener() {
- Mar 27 Fri 2015 16:00
JAVA SE 按鈕和文字方塊
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Test
{
public static void main(String[] args)
{
JButton jbnButton1, jbnButton2;
JPanel jplPanel;
JTextField jtfInput;
JFrame jtfMainFrame;
jtfInput = new JTextField(20);
jtfMainFrame = new JFrame("Which Button Demo");
jbnButton1 = new JButton("Button 1");
jbnButton2 = new JButton("Button 2");
jtfMainFrame.setSize(450,450);
jplPanel = new JPanel();
jtfMainFrame.getContentPane().add(jplPanel, BorderLayout.CENTER);
jplPanel.add(jtfInput);
jplPanel.add(jbnButton1);
jplPanel.add(jbnButton2);
System.out.print("侯綉穎");
jtfMainFrame.setVisible(true);
}
}
- Mar 20 Fri 2015 15:59
JAVA SE 產生1到10
class Test
{
public static void main(String[] args)
{
int i=1;
for(i=1;i<=10;i++)
{
System.out.println(i);
}
}
}
- Mar 13 Fri 2015 15:58
EXECEL
Private Sub CommandButton1_Click()
Cells(1, 1) = 1
Cells(1, 2) = 2
Cells(1, 3) = 3
Cells(1, 4) = 4
Cells(1, 5) = 5
Cells(1, 6) = 6
Cells(1, 7) = 7
Cells(1, 8) = 8
Cells(1, 9) = 9
Cells(1, 10) = 10
End Sub
- Mar 13 Fri 2015 15:57
JAVA Script查IP
<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>
- Mar 13 Fri 2015 15:55
JAVA SE 查IP
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"); } } }
- Mar 13 Fri 2015 15:48
hello word
/**
* 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.
}
}
- Mar 13 Fri 2015 15:46
JAVA網頁
<html>
<head>
<title> The First Example: Hello, World </title>
</head>
<body>
<h2> This line is HTML </h2>
<script language="JavaScript">
<!--
document.write("Hello, my name is 郭盈成 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>
- Mar 06 Fri 2015 15:12
java
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("_____*_____");
}
}
- Dec 05 Fri 2014 13:50
陣列隨機產生亂數
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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
Button[,] buttons = new Button[4, 4];
Random irand = new Random();
int rd = 0;
public Form1()
{
InitializeComponent();
}
- Dec 05 Fri 2014 13:48
陣列排序產生數字C#
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 WindowsFormsApplication3
{
public partial class Form1 : Form
{
Button[,] buttons = new Button[5, 5];
public Form1()
{
InitializeComponent();
}
- Nov 21 Fri 2014 13:44
自動產生不重複的亂數C#
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 WindowsFormsApplication3
{
public partial class Form1 : Form
{
Random rand = new Random();
Button[,] buttons = new Button[5, 5];
public Form1()
{
InitializeComponent();
}
- Nov 14 Fri 2014 15:23
excel99乘法表與c#99格
- Oct 31 Fri 2014 15:22
c#JUDGE判斷井字遊戲的勝利
判斷三格連線及勝利BOX跳出
int c=0, r;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
button1.Text = "";
button2.Text = "";
button3.Text = "";
button4.Text = "";
button5.Text = "";
button6.Text = "";
button7.Text = "";
button8.Text = "";
button9.Text = "";
}
private void button1_Click(object sender, EventArgs e)
{
c = c + 1;
r = c % 2;
textBox1.Text = Convert.ToString(r);
if (r == 0)
{
button1.Text = "O";
}
else
{
button1.Text = "X";
}
button1.Enabled = false;
}
private void button2_Click(object sender, EventArgs e)
{
c = c + 1;
r = c % 2;
textBox1.Text = Convert.ToString(r);
if (r == 0)
{
button2.Text = "O";
}
else
{
button2.Text = "X";
}
button2.Enabled = false;
judge();
}
private void judge()
{
if( (button1.Text == "X" && button2.Text == "X" && button3.Text == "X")||
(button1.Text == "X" && button5.Text == "X" && button9.Text == "X") ||
(button1.Text == "X" && button4.Text == "X" && button7.Text == "X") ||
(button4.Text == "X" && button5.Text == "X" && button6.Text == "X") ||
(button7.Text == "X" && button8.Text == "X" && button9.Text == "X") ||
(button2.Text == "X" && button5.Text == "X" && button8.Text == "X") ||
(button3.Text == "X" && button6.Text == "X" && button9.Text == "X") ||
(button3.Text == "X" && button5.Text == "X" && button7.Text == "X"))
MessageBox.Show("X贏了");
}
private void button3_Click(object sender, EventArgs e)
{
c = c + 1;
r = c % 2;
textBox1.Text = Convert.ToString(r);
if (r == 0)
{
button3.Text = "O";
}
else
{
button3.Text = "X";
}
button3.Enabled = false;
judge();
}
private void button4_Click(object sender, EventArgs e)
{
c = c + 1;
r = c % 2;
textBox1.Text = Convert.ToString(r);
if (r == 0)
{
button4.Text = "O";
}
else
{
button4.Text = "X";
}
button4.Enabled = false;
judge();
}
private void button5_Click(object sender, EventArgs e)
{
c = c + 1;
r = c % 2;
textBox1.Text = Convert.ToString(r);
if (r == 0)
{
button5.Text = "O";
}
else
{
button5.Text = "X";
}
button5.Enabled = false;
judge();
}
private void button6_Click(object sender, EventArgs e)
{
c = c + 1;
r = c % 2;
textBox1.Text = Convert.ToString(r);
if (r == 0)
{
button6.Text = "O";
}
else
{
button6.Text = "X";
}
button6.Enabled = false;
judge();
}
private void button7_Click(object sender, EventArgs e)
{
c = c + 1;
r = c % 2;
textBox1.Text = Convert.ToString(r);
if (r == 0)
{
button7.Text = "O";
}
else
{
button7.Text = "X";
}
button7.Enabled = false;
judge();
}
private void button8_Click(object sender, EventArgs e)
{
c = c + 1;
r = c % 2;
textBox1.Text = Convert.ToString(r);
if (r == 0)
{
button8.Text = "O";
}
else
{
button8.Text = "X";
}
button8.Enabled = false;
judge();
}
private void button9_Click(object sender, EventArgs e)
{
c = c + 1;
r = c % 2;
textBox1.Text = Convert.ToString(r);
if (r == 0)
{
button9.Text = "O";
}
else
{
button9.Text = "X";
}
button9.Enabled = false;
judge();
}
}
}
- Oct 24 Fri 2014 15:21
c#井字遊戲(未能判斷輸贏)