一、打開兩個(gè)窗口
網(wǎng)站制作、網(wǎng)站建設(shè),成都做網(wǎng)站公司-成都創(chuàng)新互聯(lián)公司已向上1000家企業(yè)提供了,網(wǎng)站設(shè)計(jì),網(wǎng)站制作,網(wǎng)絡(luò)營(yíng)銷等服務(wù)!設(shè)計(jì)與技術(shù)結(jié)合,多年網(wǎng)站推廣經(jīng)驗(yàn),合理的價(jià)格為您打造企業(yè)品質(zhì)網(wǎng)站。
在WPS中打開的文件都是以標(biāo)簽的形式排列在窗口中
可以通過下面的方法,在兩個(gè)WPS窗口中打開兩份文檔。(WPS表格的操作方法與之一樣)
1、打開第一個(gè)文檔
可以用任意的方式,打開第一個(gè)WPS文檔;
2、打開第二個(gè)文檔
打開第二份文檔的時(shí)候就不要雙擊了,要從程序中打開。
單擊電腦左下角【開始】----【程序】----【W(wǎng)PSOffice】----【W(wǎng)PS 文字】;
3、這個(gè)打開第二個(gè)文檔,這兩個(gè)文檔就是兩個(gè)窗口了。
4、在新的窗口中,打開需要的文檔
定義一個(gè)按鈕的OnClick事件
里面用寫方法調(diào)用彈出窗口
代碼
import java.awt.*;
import javax.swing.*;
import java.awt.Rectangle;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Frame1 extends JFrame
{
private JButton jButton1=new JButton();
public Frame1 ()
{
try {
jbInit();
}
catch(Exception exception) {
exception.printStackTrace();
}
this.setVisible(true);
}
private void jbInit () throws Exception
{
this.setBounds(300,180,400,300);
getContentPane().setLayout(null);
jButton1.setBounds(new Rectangle(127, 120, 139, 36));
jButton1.setMnemonic('C');
jButton1.setText("點(diǎn)我(C)");
jButton1.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent e)
{
jButton1_actionPerformed(e);
}
});
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.getContentPane().add(jButton1);
}
public static void main (String[] args)
{
Frame1 frame1=new Frame1();
}
public void jButton1_actionPerformed (ActionEvent e)
{
this.setVisible(false);
JFrame jf1=new JFrame("子窗口");
jf1.setBounds(100,50,800,600);
jf1.setDefaultCloseOperation(jf1.EXIT_ON_CLOSE);
jf1.setVisible(true);
}
}
/**
* 打開打印窗口
* url:鏈接頁面或action動(dòng)作
* Banglu
*/
function printWindow(url){
var sURL = url;
var sFeatures = "toolbar=no, menubar=no, scrollbars=no,resizable=yes, "
+ "location=no, status=no, titlebar=no, width=800, height=600, top=100, left=100";
window.open(sURL,'notoolbar',sFeatures);
}function exportWindow(url){
var sURL = url;
var sFeatures = "toolbar=no, menubar=no, scrollbars=no,resizable=yes, "
+ "location=no, status=no, titlebar=no, width=800, height=600, top=50, left=50";
var objwin=window.open(sURL,'export'+randomNum(),sFeatures);
objwin.close();
}
/**
* 打開模態(tài)窗口
* url:鏈接頁面或action動(dòng)作
* width:打開模態(tài)窗口的寬度
* height:打開模態(tài)窗口的高度
* 注意:打開模態(tài)窗口的頁面中要在head后面加上
* meta http-equiv="Pragma" content="no-cache":禁止模態(tài)窗口緩存
* base target="_self"/:模態(tài)窗口中的表單在本窗口中提交
* a onClick='window.location = "view-source:" + window.location.href'b源文件/b/a 可以查看模態(tài)窗口的源文件
* Banglu
*/
function modalWindow(url, width, height){
var sURL = url;
var sFeatures = "dialogWidth:" + width + "px; dialogHeight:" + height + "px; "
+ "help:no; scroll:yes; center:yes; status:no;resizable:yes";
window.showModalDialog(sURL, window, sFeatures);
}/**
* 打開普通窗口
* url:鏈接頁面或action動(dòng)作
* width:寬度
* height:高度
* Banglu
*/
function openWindow(url, width, height){
var sURL=url;
var sFeatures = "scrollbars=yes, status=yes, resizable=yes,"
+ "toolbar=yes, menubar=yes, location=yes, titlebar=yes"
if(width!=null){
sFeatures+=", width="+width;
}
if(height!=null){
sFeatures+=", height="+height;
}
window.open(sURL, 'open'+randomNum(), sFeatures);
}/**
* 打開窗口
* url:鏈接頁面或action動(dòng)作
* width:寬度
* height:高度
Banglu
*/
function openNoBarWindow(url, width, height){
var sURL=url;
var sFeatures = "scrollbars=no, status=no, resizable=no,"
+ "toolbar=no, menubar=no, location=no, titlebar=no"
if(width!=null){
sFeatures+=", width="+width;
sFeatures+=", left="+(screen.width-width)/2;
}
if(height!=null){
sFeatures+=", height="+height;
sFeatures+=", top="+(screen.height-height-100)/2;
}
window.open(sURL, 'openNoBar'+randomNum(), sFeatures);
}
/**
* 打開全屏窗口
* url:鏈接頁面或action動(dòng)作
* Banglu
*/
function openFullWindow(url){
var sURL=url;
var sFeatures = "toolbar=no, menubar=no, scrollbars=no, resizable=yes, "
+ "location=no, status=no, titlebar=no, width="+(screen.width-10)+", "
+ "height="+(screen.height-60)+", top=0, left=0";
window.open(sURL, 'full'+randomNum(), sFeatures);
}/**
* 打開主窗口
* url:鏈接頁面或action動(dòng)作
* Banglu
*/
function openMainWindow(url){
var sURL=url;
var sFeatures = "toolbar=no, menubar=no, scrollbars=no, resizable=yes, "
+ "location=no, status=no,titlebar=no, width="+(screen.width-10)+", "
+ "height="+(screen.height-60)+", top=0, left=0";
window.open(sURL, 'main', sFeatures);
}
/**
* 設(shè)置鏈接
* url:連接的jsp頁面或action動(dòng)作
* Banglu
*/
function link(url, frameID){
if(frameID==null){
window.location.href = url;
}
else{
window.frames[frameID].location = url
}
}/**
* 回車代替tab
* Banglu
*/
function handleKey(){
var gk = window.event.keyCode;
if (gk==13) {
if(window.event.srcElement.tagName!='TEXTAREA'){
window.event.keyCode=9;
return;
}
}
}/**
* 全屏顯示
* Banglu
*/
function fullScreen(){
window.dialogHeight=window.screen.availHeight;
window.dialogWidth=window.screen.availWidth;
}
function Resize_dialog(t,l,w,h) {
window.dialogTop = t+"px";
window.dialogLeft = l+"px";
window.dialogHeight = h+"px";
window.dialogWidth = w+"px";
}
import?java.io.BufferedReader;
import?java.io.BufferedWriter;
import?java.io.IOException;
import?java.io.InputStream;
import?java.io.InputStreamReader;
import?java.io.OutputStream;
import?java.io.OutputStreamWriter;
import?java.util.LinkedList;
public?class?Command?{
private?java.lang.Process?p;?
private?InputStream?is;
private?OutputStream?os;
private?BufferedWriter?bw;
private?BufferedReader?br;
private?ProcessBuilder?pb;
private?InputStream?stdErr;
public?Command()?{
}
//獲取Process的輸入,輸出流
public?void?setCmd(String?cmd)?{
try?{
p?=?Runtime.getRuntime().exec(cmd);
os?=?p.getOutputStream();
is?=?p.getInputStream();
stdErr?=?p.getErrorStream();
}?catch?(IOException?e)?{
System.err.println(e.getMessage());
}
}
//向Process輸出命令
public?void?writeCmd(String?cmd)?{
try?{
bw?=?new?BufferedWriter(new?OutputStreamWriter(os));
bw.write(cmd);
bw.newLine();
bw.flush();
bw.close();
}?catch?(Exception?e)?{
e.printStackTrace();
}
}
//讀出Process執(zhí)行的結(jié)果
public?String?readCmd()?{
StringBuffer?sb?=?new?StringBuffer();
br?=?new?BufferedReader(new?InputStreamReader(is));
String?buffer?=?null;
try?{
while?((buffer?=?br.readLine())?!=?null)?{
sb.append(buffer?+?"\n");
}
System.out.println(p.waitFor());
}?catch?(Exception?e)?{
e.printStackTrace();
}
return?sb.toString();
}
//將命令一股腦塞入list中
public?LinkedListString?doCmd(LinkedListString?lists)?{
LinkedListString?list?=?new?LinkedListString();
for?(String?s?:?lists)?{
writeCmd(s);
list.add(readCmd());
}
return?list;
}
public?static?void?main(String[]?args)?{
Command?cmd?=?new?Command();
cmd.setCmd("cmd");
cmd.writeCmd("copy?d:\\stock.xml?d:\\backStock.xml");
System.out.println(cmd.readCmd());
//LinkedListString?list?=?new?LinkedListString();
//list.add("dir/b");
//list?=?cmd.doCmd(list);
//?for(String?s:list){
//?System.out.print(s);
//?}
}
}
新手建議要么下載個(gè)editplus編輯。。懶人的做法就是:新建一個(gè)文本文檔寫java代碼,寫完后,另存為 【XXX.java】后綴名為java類型的文件、、記得是后綴名,而不是后面有.java就行了、、、然后Win+R - cmd - 回車。打開cmd命令窗口。。。然后加入你那個(gè)java文件的文件夾路徑。。(右擊java文件復(fù)制屬性就有了,然后在cmd命令窗口中輸入: cd +路徑 記得cd與路徑間有空格的)要是你的文件時(shí)房在C盤的,輸入【C:】回車就OK了,D盤輸入【D:】,以此類推、、然后輸入:javac XXX.java (回車)編譯成功就會(huì)產(chǎn)生一個(gè)class文件在當(dāng)前目錄。然后再輸入:java XXX (回車)結(jié)果就出來了、、、、我是學(xué)java編程的,不會(huì)的可以找我。。純手打。望采納、、、、、、
本文標(biāo)題:java打開窗口代碼 java簡(jiǎn)單窗口代碼
鏈接地址:http://jinyejixie.com/article36/hpchpg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、域名注冊(cè)、關(guān)鍵詞優(yōu)化、網(wǎng)站收錄、自適應(yīng)網(wǎng)站、靜態(tài)網(wǎng)站
聲明:本網(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í)需注明來源: 創(chuàng)新互聯(lián)