當前位置:首頁 » 操作系統 » java旅遊源碼

java旅遊源碼

發布時間: 2024-04-30 06:53:47

『壹』 java小程序源代碼,簡單點的,100多行,誰有啊

java小程序只是把java語言嵌套在html中,只要你會html那麼你就按照html的寫法標准寫就行了啊!

『貳』 什麼是java源代碼 怎麼查看

不知道你說的是瀏覽器的還是什麼的,
如果是瀏覽器的那麼簡單找到工具-查看源代碼,你就能看見代碼了,
還有一個就是被編譯成class文件的java用反編譯工具可以看到源代碼,
如果以上都不是你想要的答案,那麼你所說的代碼就是程序員寫好的代碼文件

『叄』 java課程設計源代碼(急!!!!)

import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.border.LineBorder;

public class game21 extends JFrame {
private JLabel label_2;
private int number;
private int sum;
final JLabel label = new JLabel();
final JLabel label_1 = new JLabel();

public static void main(String[] args) {
new game21();
}

public game21() {
super("21點?!");
getContentPane().setLayout(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JButton button = new JButton();
button.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent arg0) {
onClick();
}
});
button.setText("出牌");
button.setBounds(170, 350, 106, 28);
getContentPane().add(button);
label.setBorder(new LineBorder(Color.black, 1, false));
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setFont(new Font("", Font.BOLD, 26));
label.setText("背面");
label.setBounds(158, 81, 137, 153);
getContentPane().add(label);

label_1.setText("你已經擁有的牌:");
label_1.setBounds(109, 22, 270, 45);
getContentPane().add(label_1);
this.setBounds(200, 300, 501, 528);
this.setVisible(true);
getContentPane().add(getLabel_2());
}

public int randNumber() {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
return (int) (Math.random() * 10 + 1);
}

public void onClick() {
number = this.randNumber();
this.sum += number;
label.setText("" + number);
String strTemp = this.label_1.getText();
strTemp += "" + number + " ";
label_1.setText(strTemp);
String temp = "合計:" + sum;
label_2.setText(temp);
isWin();
}

public void isWin() {
if (sum > 21) {
JOptionPane.showMessageDialog(this, "你輸了");
clear();
return;
} else if (sum == 21) {
JOptionPane.showMessageDialog(this, "你贏了");
clear();
return;
} else {
int i = JOptionPane.showOptionDialog(this, "是否繼續?", "提示",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, null, null, null);
if (i == JOptionPane.OK_OPTION) {
onClick();
} else
return;
}
}

private void clear() {
label_2.setText("合計:");
sum = 0;
number = 0;
label_1.setText("你已經擁有的牌:");
}

/**
* @return
*/
protected JLabel getLabel_2() {
if (label_2 == null) {
label_2 = new JLabel();
label_2.setText("合計:");
label_2.setBounds(313, 35, 66, 18);
}
return label_2;
}

}
真好無聊中。。

熱點內容
社保計算編程 發布:2024-05-21 08:52:49 瀏覽:529
船用空氣壓縮機 發布:2024-05-21 08:49:11 瀏覽:185
oppo怎麼查密碼是多少 發布:2024-05-21 08:48:28 瀏覽:139
我的世界伺服器怎麼禁用傳送 發布:2024-05-21 08:35:51 瀏覽:106
python程序設計基礎 發布:2024-05-21 08:34:06 瀏覽:302
csql類 發布:2024-05-21 08:19:38 瀏覽:413
高通晶元代碼編譯 發布:2024-05-21 08:06:46 瀏覽:480
預編譯cpp 發布:2024-05-21 08:01:12 瀏覽:91
我的世界伺服器如何挖 發布:2024-05-21 07:39:12 瀏覽:794
路游器怎麼改密碼 發布:2024-05-21 07:36:10 瀏覽:27