导航:首页 > 编程语言 > 简单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论坛源码相关的资料

热点内容
联想手机解锁工具 浏览: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
word删除尾注分隔符 浏览:773
公告质疑需要哪些文件 浏览:608
数据库模型是干什么的 浏览:404

友情链接