物流问答

各位大神 Java课程设计急需1500行以上代码 最好是数独 可是办理体系物流体系这类的的也能够 谢谢啦

2022/9/28 10:28:25 来源:货代软件公司
内容摘要:importxa0java.awt.*;xa0importxa0java.awt.event.*;xa0importxa0javax.swing.*;xa0publicxa0classxa0Calculatorxa0extendsxa0JFramexa0{xa0privatexa0Containerxa0container;xa0privatexa0GridBagLayoutxa0layout;xa0privatexa0GridBagConstraintsxa0constraints;xa0private
importxa0java.awt.*;xa0
importxa0java.awt.event.*;xa0
importxa0javax.swing.*;xa0

publicxa0classxa0Calculatorxa0extendsxa0JFramexa0{xa0

privatexa0Containerxa0container;xa0
privatexa0GridBagLayoutxa0layout;xa0
privatexa0GridBagConstraintsxa0constraints;xa0
privatexa0JTextFieldxa0displayField;
privatexa0Stringxa0lastCommand;
privatexa0doublexa0result;
privatexa0booleanxa0start;

publicxa0Calculator()xa0{xa0

super(“Calculator”);xa0
container=getContentPane();xa0
layout=newxa0GridBagLayout();xa0
container.setLayout(layout);xa0
constraints=newxa0GridBagConstraints();xa0
start=true;xa0
result=0;xa0
lastCommandxa0=xa0″=”;xa0
displayField=newxa0JTextField(20);xa0
displayField.setHorizontalAlignment(JTextField.RIGHT);xa0
constraints.gridx=0;xa0
constraints.gridy=0;xa0
constraints.gridwidth=4;xa0
constraints.gridheight=1;xa0
constraints.fill=GridBagConstraints.BOTH;xa0
constraints.weightx=100;xa0
constraints.weighty=100;xa0
layout.setConstraints(displayField,constraints);xa0
container.add(displayField);xa0
ActionListenerxa0insertxa0=xa0newxa0InsertAction();xa0
ActionListenerxa0commandxa0=xa0newxa0CommandAction();xa0
addButton(“Backspace”,0,1,2,1,insert);xa0
addButton(“CE”,2,1,1,1,insert);xa0
addButton(“C”,3,1,1,1,insert);xa0
addButton(“7”,0,2,1,1,insert);xa0
addButton(“8”,1,2,1,1,insert);xa0
addButton(“9”,2,2,1,1,insert);xa0
addButton(“/”,3,2,1,1,command);xa0
addButton(“4”,0,3,1,1,insert);xa0
addButton(“5”,1,3,1,1,insert);xa0
addButton(“6”,2,3,1,1,insert);xa0
addButton(“*”,3,3,1,1,command);xa0
addButton(“1”,0,4,1,1,insert);xa0
addButton(“2”,1,4,1,1,insert);xa0
addButton(“3”,2,4,1,1,insert);xa0
addButton(“-“,3,4,1,1,command);xa0
addButton(“0”,0,5,1,1,insert);xa0
addButton(“+/-“,1,5,1,1,insert);
addButton(“.”,2,5,1,1,insert);xa0
addButton(“+”,3,5,1,1,command);xa0
addButton(“=”,0,6,4,1,command);xa0
setSize(300,300);xa0
setVisible(true);xa0

}xa0

privatexa0voidxa0addButton(Stringxa0label,intxa0row,intxa0column,intxa0with,intxa0height,ActionListenerxa0listener)xa0{xa0

JButtonxa0button=newxa0JButton(label);xa0
constraints.gridx=row;xa0
constraints.gridy=column;xa0
constraints.gridwidth=with;xa0
constraints.gridheight=height;xa0
constraints.fill=GridBagConstraints.BOTH;xa0
button.addActionListener(listener);xa0
layout.setConstraints(button,constraints);xa0
container.add(button);xa0
}xa0

privatexa0classxa0InsertActionxa0implementsxa0ActionListenerxa0{xa0

publicxa0voidxa0actionPerformed(ActionEventxa0event)xa0{xa0

Stringxa0input=event.getActionCommand();xa0
ifxa0(start)xa0{xa0
displayField.setText(“”);xa0
start=false;xa0
if(input.equals(“+/-“))xa0
displayField.setText(displayField.getText()+”-“);xa0
}xa0

if(!e68a84e8a2ade799bee5baa631333337383963input.equals(“+/-“))xa0{xa0
if(input.equals(“Backspace”))xa0{xa0
Stringxa0str=displayField.getText();xa0
if(str.length()>0)xa0
displayField.setText(str.substring(0,str.length()-1));xa0
}elsexa0if(input.equals(“CE”)||input.equals(“C”))xa0{xa0
displayField.setText(“0”);xa0
start=true;xa0
}elsexa0
displayField.setText(displayField.getText()+input);xa0
}xa0
}xa0
}xa0

privatexa0classxa0CommandActionxa0implementsxa0ActionListenerxa0{xa0

publicxa0voidxa0actionPerformed(ActionEventxa0evt)xa0{xa0
Stringxa0command=evt.getActionCommand();xa0
if(start)xa0{xa0
lastCommand=command;xa0
}elsexa0{xa0
calculate(Double.parseDouble(displayField.getText()));xa0
lastCommand=command;xa0
start=true;xa0
}xa0
}xa0
}xa0

publicxa0voidxa0calculate(doublexa0x)xa0{xa0
ifxa0(lastCommand.equals(“+”))xa0result+=xa0x;xa0
elsexa0ifxa0(lastCommand.equals(“-“))xa0result-=x;xa0
elsexa0ifxa0(lastCommand.equals(“*”))xa0result*=x;xa0
elsexa0ifxa0(lastCommand.equals(“/”))xa0result/=x;xa0
elsexa0ifxa0(lastCommand.equals(“=”))xa0result=x;xa0
displayField.setText(“”+xa0result);xa0
}xa0

publicxa0staticxa0voidxa0main(Stringxa0args)xa0{xa0
Calculatorxa0calculator=newxa0Calculator();xa0
calculator.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);xa0
}xa0

}

http://www.yuntisoft.com/wuliuwenda/23715.html 各位大神 Java课程设计急需1500行以上代码 最好是数独 可是办理体系物流体系这类的的也能够 谢谢啦

免责声明:本文章部分图片素材和内容素材来源于网络,仅供学习与参考,不代表本站立场,如果损害了您的权利,请联系网站客服,我们核实后会立即删除。

标签:

物流体系
在线咨询
QQ咨询
微信咨询
微信咨询
电话咨询
周一至周五 9:00-18:00
135-1055-3738
回顶部