java代码

java

1,

    Properties prop= new Properties();

try {

InputStream is = this.getClass().getResourceAsStream ("/data.properties");

prop.load(is);

}catch(Exception e) {

// fatal error!

System.err.println("FATAL ERROR: application root configuration not found: data.properties");

System.exit(0);

}

String coreRootRelative = prop.getProperty("COREROOT");

Class c = this.getClass();

URL u = c.getProtectionDomain().getCodeSource().getLocation();

String fileUri = "";

try

{

fileUri = URLDecoder.decode(u.getFile(), "UTF-8") ;

}

catch(UnsupportedEncodingException e)

{

// TODO Auto-generated catch block

e.printStackTrace();

}

File f = new File(fileUri);

String coreRootBeforeChanges = f.getParent();

 2.

    protected void processWindowEvent(WindowEvent e) {

super.processWindowEvent(e);

int defaultCloseOperation = getDefaultCloseOperation();

if (e.getID() == WindowEvent.WINDOW_CLOSING ){

if(defaultCloseOperation != DO_NOTHING_ON_CLOSE){

this.closeCancel();

}

// processActionEvent(new ActionEvent(this,

// ActionEvent.ACTION_PERFORMED, CANCEL_COMMAND));

}else if (e.getID() == WindowEvent.WINDOW_OPENED) {

// simulate tab from last to wrap around to first & properly set

// initial focus

if (getComponentCount() > 0)

getComponent(getComponentCount() - 1).transferFocus();

}

}

以上是 java代码 的全部内容, 来源链接: utcz.com/z/394469.html

回到顶部