السلام عليكم :)
بغيت مساعده بسيطه في كتابة التعليقات على الكود بشكل مفهوم،،
فرضاً لو ابغى اكتب تعليق على هذا القسم من الكود،،،
/**
*If we want to write a new text, first we want to know if the text area is empty or not,
*second we want to kwnow if the text was saved or not.
*If the text area isn't empty & the text wasn't saved befor this time, then the program display
*for the user an option for saving the text in a new file or not...
*/
public void neW(){
if(!n.getTextArea().getText().equals("") && !n.getTextArea().getText().equals(fileContent)){
if(fileName == null){
option = JOptionPane.showConfirmDialog(null,"Do you want to save the changes ??");
if(option == 0){
//to save the text into the file
saveAs();
//to create new getTextArea() after saving the old getTextArea()
n.getTextArea().setText("");
}
if(option == 1){
//to create new getTextArea() without saving the old getTextArea()
n.getTextArea().setText("");
}
}
else{
option = JOptionPane.showConfirmDialog(null,"Do you want to save the changes ??");
if(option == 0){
save();
//to create new getTextArea() after saving the old getTextArea()
n.getTextArea().setText("");
}
else{
if(option == 1){
//to create new getTextArea() without saving the old getTextArea()
n.getTextArea().setText("");
}
}
}
}
else{
n.getTextArea().setText("");
}
}ابغى اعرف احسن طريقة لكتابة التعليق بشكل مفهوم و بسيط ..