JAVA小程序的英文名字叫JAVA APPLET,是相对于JAVA APPLICATION而言的,它的运行不是独立的,要依靠HTML也就是必须嵌入网页里借助浏览器运行。除此之外,它也可以在DOS命令状态下用APPLETVIWER命令来运行。
总之,JAVA小程序就是一种依靠浏览器来运行的一种JAVA小程序。
分类: 电脑/网络 >> 程序设计 >> 其他编程语言
问题描述:
我们修的汇编语言是JAVA,怎奈自己学术不精现在此象高手请教小程序是期末做课程设计用的题目有日历记事本,学籍管理系统,计算器,画图程序其他的也可以现需要两个程序,谢谢大家!
解析:
import javaio;
import javautilCalendar;
import javaawt;
import javaawtevent;
import javaxswing;
public class NoteBook extends JFrame implements ActionListener,ItemListener,WindowListener,MouseListener{
Container c = thisgetContentPane();
JMenuBar jmb = new JMenuBar();
JColorChooser jcc = new JColorChooser();
JMenu jm1 = new JMenu("文件(F)");
JMenu jm2 = new JMenu("编辑(E)");
JMenu jm3 = new JMenu("格式(O)");
JMenu jm4 = new JMenu("查看(V)");
JMenu jm5 = new JMenu("帮助(H)");
JMenuItem jmi1 = new JMenuItem("新建(N)");
JMenuItem jmi2 = new JMenuItem("打开(O)");
JMenuItem jmi3 = new JMenuItem("保存(S)");
JMenuItem jmi4 = new JMenuItem("退出(X)");
JMenuItem jmi5 = new JMenuItem("撤消(U)");
JMenuItem jmi6 = new JMenuItem("复制(C)");
JMenuItem jmi7 = new JMenuItem("粘贴(P)");
JMenuItem jmi8 = new JMenuItem("剪切(T)");
JMenuItem jmi12 = new JMenuItem("日期和时间");
JMenuItem jmi9 = new JMenuItem("字体(E)");
JCheckBoxMenuItem jcbmi = new JCheckBoxMenuItem("自动换行(W)");
JMenuItem jmi10 = new JMenuItem("删除(S)");
JMenuItem jmi11 = new JMenuItem("背景颜色(H)");
JTextArea jta = new JTextArea(15,15);
JScrollPane jsp = new JScrollPane(jta);
PupolMenu pm = new Pupolmenu();
NoteBook(){
thisaddWindowListener(this);
csetLayout(new BorderLayout());
cadd(jmb,BorderLayoutNORTH);
thissetTitle("新建 文本文档");
jmbadd(jm1);
jm1setMnemonic('f');
jm1addActionListener(this);
jmbadd(jm2);
jm2setMnemonic('e');
jmbadd(jm3);
jm3setMnemonic('o');
jmbadd(jm4);
jm4setMnemonic('v');
jmbadd(jm5);
jm5setMnemonic('h');
jm1add(jmi1);
jmi1addActionListener(this);
jmi1setAccelerator(KeyStrokegetKeyStroke('N',EventCTRL_MASK,false));
jm1addSeparator();
jm1add(jmi2);
jmi2setAccelerator(KeyStrokegetKeyStroke('O',EventCTRL_MASK,false));
jmi2addActionListener(this);
jm1addSeparator();
jm1add(jmi3);
jmi3setAccelerator(KeyStrokegetKeyStroke('S',EventCTRL_MASK,false));
jmi3addActionListener(this);
jm1addSeparator();
jm1add(jmi4);
jmi1setMnemonic('n');
jmi2setMnemonic('o');
jmi3setMnemonic('s');
jmi4setMnemonic('x');
jmi4addActionListener(this);
jm2add(jmi5);
jm2addSeparator();
jm2add(jmi6);
jm2addSeparator();
jm2add(jmi7);
jm2addSeparator();
jm2add(jmi8);
jm2add(jmi12);
jmi12addActionListener(this);
jm3add(jcbmi);
jcbmiaddItemListener(this);
jm3addSeparator();
jm3add(jmi9);
jm4add(jmi10);
jmi10addActionListener(this);
jm5add(jmi11);
jmi11addActionListener(this);
cadd(jsp);
thissetDefaultCloseOperation(JFrameDISPOSE_ON_CLOSE);
thissetSize(500,500);
thissetVisible(true);
}
public void actionPerformed(ActionEvent e){
if(egetSource()==jmi1){
jtasetText("");
thissetTitle("无标题 - 记事本");
}
if(egetSource()==jmi2){
File f1;
JFileChooser jfc1 = new JFileChooser();
int num1 = jfc1showOpenDialog(this);
if(num1==JFileChooserAPPROVE_OPTION){
try{
f1 = jfc1getSelectedFile();
thissetTitle(f1getName());
FileReader fr = new FileReader(f1);
BufferedReader br = new BufferedReader(fr);
String str;
while((str = brreadLine())!=null){
jtasetText(str);
}
frclose();
brclose();
}catch(FileNotFoundException e1){
e1printStackTrace();
}catch(IOException e2){
e2printStackTrace();
}
}
}
if(egetSource()==jmi3){
File f2 = null;
JFileChooser jfc2 = new JFileChooser();
int num2 = jfc2showSaveDialog(this);
if(num2==JFileChooserAPPROVE_OPTION){
f2=jfc2getSelectedFile();
thissetTitle(f2getName());
try{
FileWriter fw = new FileWriter(f2);
BufferedWriter bw = new BufferedWriter(fw);
bwwrite(jtagetText());
bwclose();
fwclose();
}catch(IOException e2){
e2printStackTrace();
}
}
}
if(egetSource()==jmi4){
int a = JOptionPaneshowConfirmDialog(this,"文件已被改变,是否要保存?","提示",JOptionPaneYES_NO_CANCEL_OPTION);
if(a==1){
thisdispose();
}else if(a==0){
File f2 = null;
JFileChooser jfc2 = new JFileChooser();
int num2 = jfc2showSaveDialog(this);
if(num2==JFileChooserAPPROVE_OPTION){
f2=jfc2getSelectedFile();
thissetTitle(f2getName());
try{
FileWriter fw = new FileWriter(f2);
BufferedWriter bw = new BufferedWriter(fw);
bwwrite(jtagetText());
bwclose();
fwclose();
}catch(IOException e2){
e2printStackTrace();
}
thisdispose();
}
}
}
if(egetSource()==jmi12){
Calendar c1 =CalendargetInstance();
int y = c1get(CalendarYEAR);
int m = c1get(CalendarMONTH);
int d = c1get(CalendarDATE);
int h = c1get(CalendarHOUR);
int m1 = c1get(CalendarMINUTE);
int m2 = m+1;
jtasetText(y+"年"+m2+"月"+d+"日"+h+":"+m1);
}
if(egetSource()==jmi11){
Color ccc = JColorChoosershowDialog(this,"color",ColorBLACK);
jtasetSelectedTextColor(ccc);
jtasetBackground(ccc);
}
if(egetSource()==jmi10){
jtareplaceRange("",jtagetSelectionStart(),jtagetSelectionEnd());
}
}
public void itemStateChanged(ItemEvent e2){
if(e2getItemSelectable()==jcbmi){
jtasetLineWrap(true);
}else
jtasetLineWrap(false);
}
public static void main(String[] args){
new NoteBook();
}
public void windowOpened(WindowEvent arg0) {
}
public void windowClosing(WindowEvent arg0) {
int a = JOptionPaneshowConfirmDialog(this,"文件已被改变,是否要保存?","提示",JOptionPaneYES_NO_CANCEL_OPTION);
if(a==1){
thisdispose();
}else if(a==0){
File f2 = null;
JFileChooser jfc2 = new JFileChooser();
int num2 = jfc2showSaveDialog(this);
if(num2==JFileChooserAPPROVE_OPTION){
f2=jfc2getSelectedFile();
thissetTitle(f2getName());
try{
FileWriter fw = new FileWriter(f2);
BufferedWriter bw = new BufferedWriter(fw);
bwwrite(jtagetText());
bwclose();
fwclose();
}catch(IOException e2){
e2printStackTrace();
}
}
if(a==2){
/
}
}
}
public void windowClosed(WindowEvent arg0) {
}
public void windowIconified(WindowEvent arg0) {
TODO Auto-generated method stub
}
public void windowDeiconified(WindowEvent arg0) {
TODO Auto-generated method stub
}
public void windowActivated(WindowEvent arg0) {
TODO Auto-generated method stub
}
public void windowDeactivated(WindowEvent arg0) {
TODO Auto-generated method stub
}
public void mouseClicked(MouseEvent arg0) {
TODO Auto-generated method stub
}
public void mousePressed(MouseEvent arg0) {
TODO Auto-generated method stub
}
public void mouseReleased(MouseEvent arg0) {
TODO Auto-generated method stub
}
public void mouseEntered(MouseEvent arg0) {
TODO Auto-generated method stub
}
public void mouseExited(MouseEvent arg0) {
TODO Auto-generated method stub
}
}
可以用任何语言或平台(比如JSP、PHP、ASP等)来写后台,只要能接收小程序发送的请求,并按小程序要求的格式返回数据即可。也可以利用腾讯云提供的小程序解决方案很方便地建立一个后台数据处理系统(目前支持Nodejs和PHP方式)。
如果你的小程序无需后台提供数据,也可以完全不用后台,直接在小程序内部解决。总之一切看需要。
密过程微信服务器完成,解密过程在小程序和自身服务器完成,即由 encryptData 得到如下数据:
{
"openId": "OPENID",
"nickName": "NICKNAME",
"gender": GENDER,
"city": "CITY",
"province": "PROVINCE",
"country": "COUNTRY",
"avatarUrl": "AVATARURL",
"unionId": "UNIONID",
"watermark":
{
"appid":"APPID",
"timestamp":TIMESTAMP
public test_03(){
init();
}
public void init(){
JLabel jl_1=new JLabel("用户名");
JLabel jl_2=new JLabel("密码");
JTextField jtf=new JTextField();
JPasswordField jpf=new JPasswordField();
JButton button_1=new JButton("确定");
JPanel panel=new JPanel();
panelsetLayout(null);
jl_1setBounds(30, 50, 50, 30);
jl_2setBounds(30,90,50,30);
jtfsetBounds(100, 50, 100, 30);
jpfsetBounds(100, 90, 100, 30);
button_1setBounds(110, 130, 80, 30);
paneladd(jl_1);
paneladd(jl_2);
paneladd(jtf);
paneladd(jpf);
paneladd(button_1);
thisadd(panel);
thissetSize(300, 250);
thissetLocation(400, 300);
thissetVisible(true);
}
public static void main(String[] args) {
new test_03();
}
以上就是关于JAVA小程序是什么全部的内容,包括:JAVA小程序是什么、求助:JAVA小程序、微信小程序需要用java写后台么等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)