導航:首頁 > 編程語言 > 簡單java論壇源碼

簡單java論壇源碼

發布時間:2023-02-12 04:45:05

java程序代碼,簡單點的,100多行,誰有啊

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

㈡ 求編寫一個超級簡單的Java的程序源代碼

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

import javax.swing.*;

class ConstructFrame extends JFrame
{

private static final long serialVersionUID = 1L;
String value1="",result,value2="";
int flag=0,fix=0,sum=1;
Boolean happy;
JTextField text=new JTextField(30);
int flagsum=0;
Container c=getContentPane();
JButton buttonx;
ConstructFrame()
{ super("計算器");
c.setLayout(null);
c.setBackground(Color.blue);
this.setSize(400, 400);
c.add(text);
text.setHorizontalAlignment(JTextField.RIGHT);
final JButton buttonx=new JButton("BackSpace");
c.add(buttonx);
buttonx.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
int count=0;
String temp;
if(flag==0)
{
count=value1.length();
if(count!=1)
temp=value1.substring(0, count-1);
else
temp="0";
value1=temp;

}
else
{
count=value2.length();
if(count!=1)
temp=value2.substring(0, count-1);
else
temp="0";
value2=temp;
}
text.setText(temp);
}
});
final JButton buttony=new JButton("CE");
c.add(buttony);
buttony.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
value1="";
value2="";
flag=0;
text.setText("0");
}
});

final JButton button1=new JButton("1");
c.add(button1);
button1.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
String temp;
if(flag==0)
{
value1=value1+1;
temp=value1;
}
else
{
value2=value2+1;
temp=value2;
}
text.setText(temp);
}
});

final JButton button2=new JButton(" 2 ");
c.add(button2);
button2.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
String temp;
if(flag==0)
{
value1=value1+2;
temp=value1;
}
else
{
value2=value2+2;
temp=value2;
}
text.setText(temp);
}
});

final JButton button3=new JButton("3");
c.add(button3);
button3.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
String temp;
if(flag==0)
{
value1=value1+3;
temp=value1;
}
else
{
value2=value2+3;
temp=value2;
}
text.setText(temp);
}
});
final JButton button4=new JButton("4");
c.add(button4);
button4.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
String temp;
if(flag==0)
{
value1=value1+4;
temp=value1;
}
else
{
value2=value2+4;
temp=value2;
}
text.setText(temp);
}
});
final JButton button5=new JButton("5");
c.add(button5);
button5.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
String temp;
if(flag==0)
{
value1=value1+5;
temp=value1;
}
else
{
value2=value2+5;
temp=value2;
}
text.setText(temp);
}
});
final JButton button6=new JButton("6");
c.add(button6);
button6.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
String temp;
if(flag==0)
{
value1=value1+6;
temp=value1;
}
else
{
value2=value2+6;
temp=value2;
}
text.setText(temp);
}
});
final JButton button7=new JButton("7");
c.add(button7);
button7.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
String temp;
if(flag==0)
{
value1=value1+7;
temp=value1;
}
else
{
value2=value2+7;
temp=value2;
}
text.setText(temp);
}
});
final JButton button8=new JButton("8");
c.add(button8);
button8.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
String temp;
if(flag==0)
{
value1=value1+8;
temp=value1;
}
else
{
value2=value2+8;
temp=value2;
}
text.setText(temp);
}
});
final JButton button9=new JButton("9");
c.add(button9);
button9.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
String temp;
if(flag==0)
{
value1=value1+9;
temp=value1;
}
else
{
value2=value2+9;
temp=value2;
}
text.setText(temp);
}
});
final JButton button0=new JButton("0");
c.add(button0);
button0.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
String temp;
if(flag==0)
{
value1=value1+0;
temp=value1;
}
else
{
value2=value2+0;
temp=value2;
}
text.setText(temp);
}
});

final JButton buttonadd=new JButton(" + ");
c.add(buttonadd);
buttonadd.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
flag=1;
fix=1;
flagsum=0;
}
});

final JButton buttonsubtract=new JButton(" - ");
c.add(buttonsubtract);
buttonsubtract.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
flag=1;
fix=2;
flagsum=0;
}
});
final JButton buttoncheng=new JButton(" * ");
c.add(buttoncheng);
buttoncheng.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
flag=1;
fix=3;
flagsum=0;
}
});

final JButton buttonchu=new JButton(" / ");
c.add(buttonchu);
buttonchu.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
flag=1;
flagsum=0;
fix=4;
}
});
final JButton buttonequal=new JButton(" = ");
c.add(buttonequal);
buttonequal.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
double temp1,temp2;
double temp=0;
flagsum=0;
temp1=Double.parseDouble(value1);
temp2=Double.parseDouble(value2);
flag=0;
switch(fix)
{
case 1: temp=temp1+temp2;break;
case 2: temp=temp1-temp2;break;
case 3: temp=temp1*temp2;break;
case 4: temp=temp1/temp2;break;
}
result=Double.valueOf(temp).toString();
value1=result;
value2="";
flag=1;
text.setText(result);
}
});
final JButton buttonpoint=new JButton(".");
c.add(buttonpoint);
buttonpoint.addMouseListener(new MouseAdapter()
{

public void mousePressed(MouseEvent e)
{ if(flagsum==0)
{
String temp;

if(flag==0 )
{
value1=value1+".";
temp=value1;
}
else
{
value2=value2+".";
temp=value2;
}

flagsum=1;
text.setText(temp);
}
}

});
JButton buttonz=new JButton("Start");
c.add(buttonz);
buttonz.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{ if(sum%2==1)
{
happy=true;
text.setText("0.");
flag=0;

}
else
{
happy=false;
value1="";
value2="";
text.setText("");
}
text.setEnabled(happy);
button1.setEnabled(happy);
button2.setEnabled(happy);
button3.setEnabled(happy);
button4.setEnabled(happy);
button5.setEnabled(happy);
button6.setEnabled(happy);
button7.setEnabled(happy);
button8.setEnabled(happy);
button9.setEnabled(happy);
button0.setEnabled(happy);
buttonx.setEnabled(happy);
buttony.setEnabled(happy);
buttonadd.setEnabled(happy);
buttonsubtract.setEnabled(happy);
buttonpoint.setEnabled(happy);
buttonequal.setEnabled(happy);
buttoncheng.setEnabled(happy);
buttonchu.setEnabled(happy);
sum++;
}
});
button1.setEnabled(false);
button2.setEnabled(false);
button3.setEnabled(false);
button4.setEnabled(false);
button5.setEnabled(false);
button6.setEnabled(false);
button7.setEnabled(false);
button8.setEnabled(false);
button9.setEnabled(false);
button0.setEnabled(false);
buttonx.setEnabled(false);
buttony.setEnabled(false);
buttonadd.setEnabled(false);
buttonsubtract.setEnabled(false);
buttonpoint.setEnabled(false);
buttonequal.setEnabled(false);
buttoncheng.setEnabled(false);
buttonchu.setEnabled(false);
text.setEnabled(false);
text.setBounds(20, 20, 200, 40);
buttonx.setBounds(20, 60,100, 40);
buttony.setBounds(140, 60,100, 40);
buttonz.setBounds(260, 60,80, 40);
button1.setBounds(20, 120,60, 40);
button2.setBounds(100, 120,60, 40);
button3.setBounds(180, 120,60, 40);
buttonadd.setBounds(260, 120,60, 40);
button4.setBounds(20, 180,60, 40);
button5.setBounds(100, 180,60, 40);
button6.setBounds(180, 180,60, 40);
buttonsubtract.setBounds(260, 180,60, 40);
button7.setBounds(20, 240,60, 40);
button8.setBounds(100, 240,60, 40);
button9.setBounds(180, 240,60, 40);
buttoncheng.setBounds(260,240,60,40);
button0.setBounds(20, 300,60, 40);
buttonpoint.setBounds(100, 300, 60, 40);
buttonequal.setBounds(180,300,60, 40);
buttonchu.setBounds(260, 300,60, 40);
setVisible(true);

}
class MYMouseEvent extends MouseAdapter
{
public void mousePressed(MouseEvent e)
{
value1=e.toString();
text.setText(value1);
}
}
}
class Calutator
{
public static void main(String[] args)
{
new ConstructFrame();
}
}
你自己慢慢的看吧!

㈢ GitHub上面有哪些經典的java框架源碼

㈣ 誰有java開發的簡單網站源碼,要求簡單的增刪改除,不用框架,最好是servlet+jsp +mysql實現,畢設要用

JSP沒有免費的,不然你也不在這里來問別人了吧。JSP資源很少,不是ASP.PHP,源碼很多,什麼樣的都有。可以定做,速度快。

㈤ 高分求兩個簡單的JAVA設計源代碼

我寫的是第一題,不知道行不行。
代碼寫在一個Java文件中:

import java.util.*;

public class Student implements Comparator
{
private String stuNo; //學號
private String name; //姓名
private double engScore; //英語成績
private double mathScore; //數學成績
private double comScore; //計算機成績
private double sum; //總成績

//計算評測成績
public double testScore(){
return (this.getEngScore()+this.getMathScore()+this.getComScore())/3;
}
//計算總成績
public double sum(){
return this.getEngScore()+this.getMathScore()+this.getComScore();
}
//實現compare方法
public int compare(Object object1,Object object2){
Student student1 = (Student)object1;
Student student2 = (Student)object2;

return student1.getSum() > student2.getSum() ? 1 : student1.getSum() < student2.getSum() ? -1 : 0 ;
}
//重寫toString方法
public String toString(){
return "學號:"+this.getStuNo()+" 姓名:"+this.getName()+" 英語成績:"+this.getEngScore()+" 數學成績:"+this.getMathScore()+" 計算機成績:"+this.getComScore()+" 總成績:"+this.getSum();
}

//重寫equals方法
public boolean equals(Object object){
if(object == null){
return false;
}
if(!(object instanceof Student)){
return false;
}
Student student = (Student)object;
if(student.getStuNo().equals(this.getStuNo()) && student.getName().equals(this.getName()) && student.getEngScore() == this.getEngScore() && student.getMathScore() == this.getMathScore() && student.getComScore() == this.getComScore() && student.getSum() == this.getSum()){
return true;
}
return true;
}
//getter和setter方法
public void setStuNo(String stuNo){
this.stuNo = stuNo;
}
public void setName(String name){
this.name = name;
}
public void setEngScore(double engScore){
this.engScore = engScore;
this.sum = this.sum();
}
public void setMathScore(double mathScore){
this.mathScore = mathScore;
this.sum = this.sum();
}
public void setComScore(double comScore){
this.comScore = comScore;
this.sum = this.sum();
}
public void setSum(double sum){
this.sum = sum;
}

public String getStuNo(){
return stuNo;
}
public String getName(){
return name;
}
public double getEngScore(){
return engScore;
}
public double getMathScore(){
return mathScore;
}
public double getComScore(){
return comScore;
}
public double getSum(){
return sum;
}

//無參構造方法
public Student(){}
//有參構造方法
public Student(String stuNo,String name,double engScore,double mathScore,double comScore){
this.stuNo = stuNo;
this.name = name;
this.engScore = engScore;
this.mathScore = mathScore;
this.comScore = comScore;
}
public Student(String stuNo,String name,double engScore,double mathScore,double comScore,double sum){
this(stuNo,name,engScore,mathScore,comScore);
this.sum = sum;
}
}

//班長子類
class StudentBZ extends Student
{
private String ty;//責任

public StudentBZ(){}
public StudentBZ(String stuNo,String name,double engScore,double mathScore,double comScore){
super(stuNo,name,engScore,mathScore,comScore);
}
public StudentBZ(String stuNo,String name,double engScore,double mathScore,double comScore,double sum){
super(stuNo,name,engScore,mathScore,comScore,sum);
}

public String getDuty(){
return ty;
}
public void setDuty(String ty){
this.ty = ty;
}
//重寫testScore方法
public double testScore(){
return (this.getEngScore()+this.getMathScore()+this.getComScore())/3 + 5;
}
}

//學委子類
class StudentXW extends Student
{
private String ty;//責任

public String getDuty(){
return ty;
}
public void setDuty(String ty){
this.ty = ty;
}

public StudentXW(String stuNo,String name,double engScore,double mathScore,double comScore){
super(stuNo,name,engScore,mathScore,comScore);
}
public StudentXW(String stuNo,String name,double engScore,double mathScore,double comScore,double sum){
super(stuNo,name,engScore,mathScore,comScore,sum);
}
//重寫testScore方法
public double testScore(){
return (this.getEngScore()+this.getMathScore()+this.getComScore())/3 + 3;
}
}

//測試類
class Test
{
public static void main(String[] args){
//Student(String stuNo,String name,double engScore,double mathScore,double comScore,double sum)
//生成若干個student類、StudentXW類、StudentBZ類
Student student1 = new Student("s001","張三",70.5,50,88.5);
Student student2 = new Student("s002","李四",88,65,88.5);
Student student3 = new Student("s003","王五",67,77,90);
StudentXW student4 = new StudentXW("s004","李六",99,88,99.5);
StudentBZ student5 = new StudentBZ("s005","朱漆",56,65.6,43.5);

Student[] students = {student1,student2,student3,student4,student5};

for(int i = 0 ; i<students.length; i++){
double avgScore = students[i].testScore();
System.out.println("第"+(i+1)+"個學生的評測成績為:"+ avgScore+"分");
}
}
}

㈥ 求幾個JAVA小項目源代碼,供自己學習參考

package com.test01;
import java.util.Scanner;
public class oop5 { public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// int x = 9;
// int y = 1;
int x = sc.nextInt();
int y = sc.nextInt();
int z;
z = add(x, y);
System.out.println("x的值為:" + x);
System.out.println("y的值為:" + y);
System.out.println("二者之和為:" + z);
}

/** 四種小演算法 */
// 加法運算
public static int add(int a, int b) {
int c;
c = a + b;
return c;
}

// 減法運算
public static int jian(int d, int v) {
int m;
m = d - v;
return m;
}

// 乘積運算
public static int addAdd(int q, int w) {
int e;
e = q * w;
return e;
}

// 除法運算
public static int chu(int p, int k) {
int f;
f = p / k;
return f;
}
}

㈦ java論壇

CSDN吧,那裡是大牛聚集的地方,有不懂的都可以在那提問。

CSDN是中國軟體開發聯盟(Chinese software develop net)的縮寫,是中國最大的開發者技術社區。它是集新聞、論壇、群組、Blog、文檔、下載、讀書、Tag、網摘、搜索、.NET、Java、游戲、視頻、人才、外包、第二書店、《程序員》等多種項目於一體的大型綜合性IT門戶網站,有很強的專業性,其會員囊括了中國地區百分之九十以上的優秀程序員,在IT技術交流及其周邊國內中是第一位的網站。

滿意請採納,謝謝啦。

㈧ java論壇源碼哪裡可以下載提供幾個好的源碼下載站!謝謝

樓上的那個javaEye 論壇是不錯,不過比較適合學到了Java EE再去。

建議你去www.csdn.net,比較適合很多編程語言初級應用的網站,資源也超級豐富。

㈨ 正在學習java, 有哪些比較好的java源代碼論壇或者開源項目網站(...

w3school、http://www.runoob.com/jsref/dom-obj-document.html

㈩ 求一個簡單java程序代碼,謝謝

public class TestStar {
public static void main(String[] args) {
String star = "*";
for (int i = 0; i < 5; i++) {
if (i == 0) {
System.out.print(" " + star);
System.out.println();
}
if (i == 1) {
for (int z = 0; z < 4; z++) {
System.out.print(" " + star);
}
System.out.println();
}
if (i == 2) {
System.out.print(" ");
for (int x = 0; x < 3; x++) {
System.out.print(" " + star);
}
System.out.println();
}
if (i == 3) {
for (int y = 0; y < 2; y++) {
System.out.print(" " + star + " ");
}
}
}
}
}

是好使的 但是我沒找到畫五角星有什麼規律(五角星好象不是正規圖形吧?)如果還有什麼要求的話 補充問題(如果是用*填充所有的東西 不包括 「 」的話 我可以重新再給你寫一個)

閱讀全文

與簡單java論壇源碼相關的資料

熱點內容
245倒角編程怎麼計算 瀏覽:599
可以買生活用品的app有哪些 瀏覽:175
cad在c盤產生的文件夾 瀏覽:541
聯想手機解鎖工具 瀏覽:696
瑞銀3887win10 瀏覽:833
學網路編程哪個好 瀏覽:805
手機vmos導入的文件在哪裡 瀏覽:115
蘋果手機可以把文件傳到華為嗎 瀏覽:63
海川化工下載的文件默認到哪裡 瀏覽:343
學唱粵語歌app 瀏覽:975
qq游戲生死狙擊玩不了 瀏覽:120
win10郵件不顯示圖片 瀏覽:922
口袋妖怪所有版本下載 瀏覽:504
我們身邊都有哪些大數據例子 瀏覽:25
震旦adc307掃描的文件在哪裡 瀏覽:999
圖片打開變成文件 瀏覽:194
松下微單電腦傳文件軟體 瀏覽:574
蘋果藍牙鍵盤surface 瀏覽:170
mindmaplinux 瀏覽:733
oppo手機怎麼連接電腦傳輸數據 瀏覽:624

友情鏈接