欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

java刪除窗體的代碼,java中刪除

java程序關(guān)閉窗口代碼

import?java.applet.*;

成都創(chuàng)新互聯(lián)成立與2013年,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目成都做網(wǎng)站、成都網(wǎng)站設(shè)計(jì)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元奎文做網(wǎng)站,已為上家服務(wù),為奎文各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:028-86922220

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的關(guān)閉窗口代碼

//fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//繼承Frame的

fr.addWindowListener(new?WindowAdapter()?{????

public?void?windowClosing(WindowEvent?e)?{????????

System.exit(0);//退出系統(tǒng)???

}

});

fr.setVisible(true);

}

public?FirstFrame(String?str)?{

super(str);

}

}

Java怎樣銷毀控制和窗口

方式一

import java.io.IOException;

public class Test {

public static void main(String[] args){

//執(zhí)行批處理文件

String strcmd="cmd /c start D:\\antrelease.bat";

Runtime rt = Runtime.getRuntime();

Process ps = null;

try {

ps = rt.exec(strcmd);

} catch (IOException e1) {

e1.printStackTrace();

}

try {

ps.waitFor();

} catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

int i = ps.exitValue();

if (i == 0) {

System.out.println("執(zhí)行完成.") ;

} else {

System.out.println("執(zhí)行失敗.") ;

}

ps.destroy();

ps = null;

new Test().killProcess();

}

public void killProcess(){

Runtime rt = Runtime.getRuntime();

Process p = null;

try {

rt.exec("cmd.exe /C start wmic process where name='cmd.exe' call terminate");

} catch (IOException e) {

e.printStackTrace();

}

}

}

方式二

process.destroy();

cmd /c dir 是執(zhí)行完dir命令后封閉命令窗口。

cmd /k dir 是執(zhí)行完dir命令后不封閉命令窗口。

cmd /c start dir 會(huì)打開(kāi)一個(gè)新窗口后執(zhí)行dir指令,原窗口會(huì)封閉。

cmd /k start dir 會(huì)打開(kāi)一個(gè)新窗口后執(zhí)行dir指令,原窗口不會(huì)封閉。

JAVA.如何通過(guò)一個(gè)事件,將整個(gè)窗體內(nèi)已有的控鍵清除掉…

你需要添加一個(gè)Listener,例如是對(duì)按下按鈕(Button)作響應(yīng),則需要添加ActionListener。

下面的代碼只是說(shuō)明一個(gè)意思而已。

public class AnExample {

public static void main(String[] argc) {

.......

JButton myButton = new JButton("Click Me");

myWindow.add(myButton);

myButton.addActionListener(new MyActionListener(myWindow));

........

}

class MyActionListener implements ActionListener {

private JPanel aWindow;

public MyActionListener(JPanel theWindow) {

aWindow = theWindow;

}

void actionPerformed(ActionEvent e) {

aWindow.removeAll();

}

}

java中關(guān)閉當(dāng)前窗口用什么代碼

setDefaultCloseOperation(JFrame.EXIT_ON_CLOES)會(huì)讓整個(gè)程序都退出

JFrame.DISPOSE_ON_CLOSE只讓當(dāng)前的窗口關(guān)閉而已

本文題目:java刪除窗體的代碼,java中刪除
本文URL:http://chinadenli.net/article39/dsgepsh.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信公眾號(hào)商城網(wǎng)站小程序開(kāi)發(fā)面包屑導(dǎo)航網(wǎng)站改版網(wǎng)站設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

小程序開(kāi)發(fā)