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

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

11232341_989710904381968_201499468_o  
 
 
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);
}
}

ljes88c18 發表在 痞客邦 留言(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();

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

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

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

逢甲大學
應用數學系四年甲班
呂彥苓

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

  • Apr 24 Fri 2015 14:46
  • 150417

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

public class Calculator extends JFrame implements ActionListener{


public static void main(String[]args){

new Calculator();
}


public Calculator()
{
String s;
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=Integer.toString(1);
s=String.valueOf(1);
//System.out.println(s);
//s="1";

for (int i = 1; i <= 9; i++)
{
button[i] = new JButton();

button[i].setActionCommand(s);
button[i].addActionListener(this);
button[i].setSize(50,50);
button[i].setText(Integer.toString(i));

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);
        if (cmd == "1") {
           
            System.out.println("Yes....");
        }
    }

}

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

1
 
 
 
 

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

1
 
 
 
 

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

未命名
 1.為何why要選修這門課?(動機)
 
因為需要學分

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

  • Dec 26 Fri 2014 16:09
  • 141226

未命名
 
 
 
 

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

1
 
 
 
 

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

  • Dec 12 Fri 2014 16:08
  • 141212

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

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

1 2
Blog Stats
⚠️

成人內容提醒

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

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