private void hideFile() {		
		if (stegoImg == null) {
			((StegoHide)getTopLevelAncestor()).showErrorMessage("Please select a cover image!");
			return;
		}
		
		int seedValue;
		try {
			seedValue = Integer.parseInt(seed.getText());
		} catch(NumberFormatException ex) {
			((StegoHide)getTopLevelAncestor()).showErrorMessage("Please enter a valid number in the seed field!");
			return;
		}
		
		if (embedFile == null) {
			((StegoHide)getTopLevelAncestor()).showErrorMessage("Please select the desired file to be hidden!");
			return;
		}
				
		try {
			byte[] fileBytes = Files.readAllBytes(embedFile.toPath());
			String ext = embedFile.getName().substring(embedFile.getName().lastIndexOf('.') + 1);
			byte[] extBytes = String.format("%-5s", ext).substring(0, 5).getBytes();
			byte[] bytes = new byte[fileBytes.length + extBytes.length];
			System.arraycopy(extBytes, 0, bytes, 0, extBytes.length);
			System.arraycopy(fileBytes, 0, bytes, extBytes.length, fileBytes.length);
			
			BufferedImage newImg = stegoImg.hide(bytes, seedValue);
			String newName = imgName.getText().substring(0, imgName.getText().lastIndexOf('.'));
			newName += "Stego." + imgFormat;
			
			JFileChooser jfc = new JFileChooser();
			jfc.setAcceptAllFileFilterUsed(false);
			jfc.addChoosableFileFilter(new FileNameExtensionFilter(imgFormat.toUpperCase() + " files", imgFormat));
			jfc.setSelectedFile(new File(newName));

			int result = jfc.showSaveDialog(this);
			if (result != JFileChooser.APPROVE_OPTION)
				return;

			ImageIO.write(newImg, imgFormat, jfc.getSelectedFile());
			((StegoHide)getTopLevelAncestor()).showInformationMessage("The embedding process is successful!");
		} catch(IllegalArgumentException ex) {
			((StegoHide)getTopLevelAncestor()).showErrorMessage("The selected file's size exceeds the image's hide capacity!");
		} catch(IOException ex) {
			((StegoHide)getTopLevelAncestor()).showErrorMessage("Could not save the image file!");
		} catch(Exception ex) {
			((StegoHide)getTopLevelAncestor()).showErrorMessage("Could not embed the text in the image!");
		}
	}