public void getParam(){
frameX = Integer.parseInt(props.getProperty("top"));
frameY = Integer.parseInt(props.getProperty("left"));
frameWidth = Integer.parseInt(props.getProperty("width"));
frameHeight = Integer.parseInt(props.getProperty("height"));
}
public void setParam(){
props.setProperty("top", frameX + "");
props.setProperty("left", frameY + "");
props.setProperty("width", frameWidth + "");
props.setProperty("height", frameHeight + "");
}
public void doClosing(){
if(change == true){
int result = JOptionPane.showConfirmDialog(null, "文件被改动了,请注意保存文件!",
"注意", JOptionPane.OK_CANCEL_OPTION);
if(result == JOptionPane.OK_OPTION){
if(fileName != null)
writeFile(fileName);
saveAsFileDialog.show();
fileName = saveAsFileDialog.getDirectory()+saveAsFileDialog.getFile();
if (fileName!= null)
writeFile(fileName);
}
}
frameX = getX();
frameY = getY();
frameWidth = getWidth();
frameHeight = getHeight();
setParam();
try{
savaConfig();
}catch(Exception ex){
ex.printStackTrace();
}
System.exit(1);
}
public void doOpening(){
try{
loadConfig();
getParam();
}catch(Exception ex){
ex.printStackTrace();
}
setLocation(frameX, frameY);
setSize(frameWidth, frameHeight);
}
public void readFile(String fileName){
try{
textArea.setText("");
File file = new File(fileName);
BufferedReader breader = new BufferedReader(new FileReader(file));
while(true){
str = breader.readLine();
if(str == null)
break;
textArea.append(str + "\n");
change = false;
}
}catch(IOException e){
System.out.println("不能打开文件");
}
}
public void writeFile(String fileName){
try{
File file = new File (fileName);
FileWriter writeOut = new FileWriter(file);
writeOut.write(textArea.getText());
writeOut.close();
change = false;
}catch(IOException e){
System.out.println("存储文件错误");
}
}
public void setLookAndFeel(int index){
try {
UIManager.setLookAndFeel(lafArray[index]);
} catch (Exception exc) {
System.err.println("Error loading " + lafArray[index] + ": " + exc);
}
}
private void theSetToolTipText(){
newItem.setToolTipText("新建一个文件");
}
}
frameX = Integer.parseInt(props.getProperty("top"));
frameY = Integer.parseInt(props.getProperty("left"));
frameWidth = Integer.parseInt(props.getProperty("width"));
frameHeight = Integer.parseInt(props.getProperty("height"));
}
public void setParam(){
props.setProperty("top", frameX + "");
props.setProperty("left", frameY + "");
props.setProperty("width", frameWidth + "");
props.setProperty("height", frameHeight + "");
}
public void doClosing(){
if(change == true){
int result = JOptionPane.showConfirmDialog(null, "文件被改动了,请注意保存文件!",
"注意", JOptionPane.OK_CANCEL_OPTION);
if(result == JOptionPane.OK_OPTION){
if(fileName != null)
writeFile(fileName);
saveAsFileDialog.show();
fileName = saveAsFileDialog.getDirectory()+saveAsFileDialog.getFile();
if (fileName!= null)
writeFile(fileName);
}
}
frameX = getX();
frameY = getY();
frameWidth = getWidth();
frameHeight = getHeight();
setParam();
try{
savaConfig();
}catch(Exception ex){
ex.printStackTrace();
}
System.exit(1);
}
public void doOpening(){
try{
loadConfig();
getParam();
}catch(Exception ex){
ex.printStackTrace();
}
setLocation(frameX, frameY);
setSize(frameWidth, frameHeight);
}
public void readFile(String fileName){
try{
textArea.setText("");
File file = new File(fileName);
BufferedReader breader = new BufferedReader(new FileReader(file));
while(true){
str = breader.readLine();
if(str == null)
break;
textArea.append(str + "\n");
change = false;
}
}catch(IOException e){
System.out.println("不能打开文件");
}
}
public void writeFile(String fileName){
try{
File file = new File (fileName);
FileWriter writeOut = new FileWriter(file);
writeOut.write(textArea.getText());
writeOut.close();
change = false;
}catch(IOException e){
System.out.println("存储文件错误");
}
}
public void setLookAndFeel(int index){
try {
UIManager.setLookAndFeel(lafArray[index]);
} catch (Exception exc) {
System.err.println("Error loading " + lafArray[index] + ": " + exc);
}
}
private void theSetToolTipText(){
newItem.setToolTipText("新建一个文件");
}
}
解决方案 »
- spring 事务管理的问题
- 不显示删除回复显示所有回复显示星级回复显示得分回复 关于批量上传数据的问题
- 送给java爱好者的一个帮助文件(全中文的)
- 为什么论坛的一些不错的贴子的网页保存不了呢?就是保存到24%的时候说无法保存网页.
- 如何把java转成exe?
- java有科学计算的类库吗?比如解个常微分方程什么的?谢谢
- 怎样清空控制台信息?
- 程序找不到错误!
- java为什么不能编译
- 我不太清楚java 里面的包的概念,那位高手帮助解释一下。
- 怎么用JAVA开发一个简单应用程序?
- ***** 800分 求教: 我不想通过页面 context.lookup("java:/OracleDS"), UP有分 *****
[email protected]
JTextArea myArea = ??;
myArea.getDocument().addDocumentListener(myListener);
第三个问题,你要监听鼠标右键,相应单击动作
获取鼠标坐标,然后根据坐标new frame()就好了我只知道这些,可能有更好的方法
第二个问题,需要加一句话!
SwingUtilities.updateComponentTreeUI(this);但是我郁闷的就是,我遇到这样的问题的时候,我怎么找才能知道要加这句话,我根本不可能想到,也不可能轻易的找到是需要加这一句话,郁闷!