private void saveFile(){
        // Create a file chooser
        
        final JFileChooser fileChooser = new JFileChooser();
        JPanel pnlTab = (JPanel)some.tabs.getTabComponentAt(some.tabs.getSelectedIndex());
        String s1 = ((JButton)pnlTab.getComponent(2)).getActionCommand();
        boolean flag = false;
        int selection = -1;
        String pathFile = null;
        fileChooser.setFileFilter(new FileNameExtensionFilter("NesC Files (*.nc)","nc"));
        // Response to button click
        if(((Triplet)hmAreas.get(Integer.parseInt(s1))).get1() != null){
            flag = true;
            pathFile = (String) ((Triplet)hmAreas.get(Integer.parseInt(s1))).get1();
        }
        else{
            selection = fileChooser.showSaveDialog(this);
        }
        if (selection == JFileChooser.APPROVE_OPTION || flag)
        {
            File file;
            if (selection == JFileChooser.APPROVE_OPTION)
                file = fileChooser.getSelectedFile();
            else
                file = new File(pathFile);
            try {
                fileManagement.saveFile(file.getPath(), ((JTextArea)((Triplet)hmAreas.get(Integer.parseInt(s1))).get3()).getText());
                ((Triplet)hmAreas.get(Integer.parseInt(s1))).set1(file.getPath());
                ((Triplet)hmAreas.get(Integer.parseInt(s1))).set2(true);
                ImageIcon iconjl = null;
                try {
                    iconjl = iconjl = createImageIcon("images/saved.png");
                } catch (IOException ex) {
                    Logger.getLogger(TabPanel.class.getName()).log(Level.SEVERE, null, ex);
                }
                JPanel pnl = new JPanel();
                pnl.setOpaque(false);
                pnlTab.remove(0);
                pnlTab.remove(0);
                pnl.add(new JLabel(iconjl));
                pnl.add(new JLabel(file.getName()));
                pnl.add(pnlTab.getComponent(0));
                some.tabs.setTabComponentAt(some.tabs.getSelectedIndex(), pnl);
                                        
            } catch (IOException ex) {
                Logger.getLogger(TabPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }