if(num2==JFileChooser.APPROVE_OPTION){
f2=jfc2.getSelectedFile();
this.setTitle(f2.getName());
try{
FileWriter fw = new FileWriter(f2);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(jta.getText());
bw.close();
fw.close();
}catch(IOException e2){
e2.printStackTrace();
}
}
}
if(e.getSource()==jmi4){
int a = JOptionPane.showConfirmDialog(this,"文件已被改变,是否要保存?","提示",JOptionPane.YES_NO_CANCEL_OPTION);
if(a==1){
this.dispose();
}else if(a==0){
File f2 = null;
JFileChooser jfc2 = new JFileChooser();
int num2 = jfc2.showSaveDialog(this);
if(num2==JFileChooser.APPROVE_OPTION){
f2=jfc2.getSelectedFile();
this.setTitle(f2.getName());
try{
FileWriter fw = new FileWriter(f2);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(jta.getText());
bw.close();
fw.close();
}catch(IOException e2){
e2.printStackTrace();
}
this.dispose();
}
}
}
if(e.getSource()==jmi12){
Calendar c1 =Calendar.getInstance();
int y = c1.get(Calendar.YEAR);
int m = c1.get(Calendar.MONTH);
int d = c1.get(Calendar.DATE);
int h = c1.get(Calendar.HOUR);
int m1 = c1.get(Calendar.MINUTE);
int m2 = m+1;
jta.setText(y+"年"+m2+"月"+d+"日"+h+":"+m1);
}
if(e.getSource()==jmi11){
Color ccc = JColorChooser.showDialog(this,"color",Color.BLACK);
jta.setSelectedTextColor(ccc);
jta.setBackground(ccc);
}
if(e.getSource()==jmi10){
jta.replaceRange("",jta.getSelectionStart(),jta.getSelectionEnd());
}
}
public void itemStateChanged(ItemEvent e2){
if(e2.getItemSelectable()==jcbmi){
jta.setLineWrap(true);
}else
jta.setLineWrap(false);
}
public static void main(String[] args){
new NoteBook();
}
public void windowOpened(WindowEvent arg0) {
}
public void windowClosing(WindowEvent arg0) {
int a = JOptionPane.showConfirmDialog(this,"文件已被改变,是否要保存?","提示",JOptionPane.YES_NO_CANCEL_OPTION);
if(a==1){
this.dispose();
}else if(a==0){
File f2 = null;
JFileChooser jfc2 = new JFileChooser();
int num2 = jfc2.showSaveDialog(this);
if(num2==JFileChooser.APPROVE_OPTION){
f2=jfc2.getSelectedFile();
this.setTitle(f2.getName());
try{
FileWriter fw = new FileWriter(f2);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(jta.getText());
bw.close();
fw.close();
}catch(IOException e2){
e2.printStackTrace();
}
}
if(a==2){
////????/????????????????????????????????????????????????????????????????//
}
}
}
public void windowClosed(WindowEvent arg0) {
}
public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void mouseClicked(MouseEvent arg0) {
// TODO Auto-generated method stub
}
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
}
public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub
}
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
}
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
}
}
帮我看一下,我的java代码 。为什么运行结果不对!如图:请详解,为什么其他组件没有显示?看注释:
推荐阅读
- 微信没有视频号功能咋办,2021微信没有视频号怎么办
- 包含jsspan标签循环的词条
- 模拟积木碰撞的游戏下载,模拟积木拼装的游戏
- 淘宝直播间被主播屏蔽了,被淘宝直播间屏蔽了怎么办
- python函数变量定位 python函数内的变量
- redis缓存的java代码,java怎么使用redis缓存代码
- 包含postgresqlworkbench的词条
- ios单机mud武侠游戏,苹果单机武侠手游
- vb.net股票代码 vba获取股票实时数据