资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

java退出代码 java退出程序运行

实现 界面登陆 退出 功能的java代码杂写

CS结构系统的退出如下:public void init() {

专注于为中小企业提供成都网站设计、网站建设、外贸网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业新荣免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了上千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。

this.setTitle("用户登录界面");

this.add(createCenterPane());

this.setDefaultCloseOperation(this.DO_NOTHING_ON_CLOSE);

this.setSize(new Dimension(450, 335));

this.setLocationRelativeTo(null);

// this.setVisible(true);

this.addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent e) {

int choose = JOptionPane.showConfirmDialog(null, "是否要退出登录界面?",

"系统提示:", JOptionPane.YES_NO_OPTION);

if (choose == JOptionPane.YES_OPTION) {

System.exit(1);

}

}

});

}其中this为JFrame对象。BS结构的退出直接用windows.close()方法就行了!

JAVA 中 按回车键退出的 程序代码怎么写?

import java.io.IOException;

public class TestEnter {

public static void main(String[] args) throws IOException{

while(true){

if(System.in.read() == '\n')

System.exit(0);

}

}

}

java程序关闭窗口代码

import java.applet.*;

import java.awt.Color;

import java.awt.Frame;

import javax.swing.JFrame;

import java.awt.event.*;

public class FirstFrame extends Frame {

public static void main(String args[]) {

FirstFrame fr = new FirstFrame("First contianer!");

fr.setSize(240, 240);

//继承JFrame的关闭窗口代码

//fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//继承Frame的

fr.addWindowListener(new WindowAdapter() {    

public void windowClosing(WindowEvent e) {        

System.exit(0);//退出系统   

}

});

fr.setVisible(true);

}

public FirstFrame(String str) {

super(str);

}

}

实现界面登陆,退出功能的java代码怎么写?

CS结构系统的退出如下:public void init() {

this.setTitle("用户登录界面");

this.add(createCenterPane());

this.setDefaultCloseOperation(this.DO_NOTHING_ON_CLOSE);

this.setSize(new Dimension(450, 335));

this.setLocationRelativeTo(null);

// this.setVisible(true);

this.addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent e) {

int choose = JOptionPane.showConfirmDialog(null, "是否要退出登录界面?",

"系统提示:", JOptionPane.YES_NO_OPTION);

if (choose == JOptionPane.YES_OPTION) {

System.exit(1);

}

}

});

}其中this为JFrame对象。BS结构的退出直接用windows.close()方法就行了!


文章标题:java退出代码 java退出程序运行
分享URL:http://cdkjz.cn/article/doipohi.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220