boolean reloadIfNecessary() {
		if( !file.isFile() ) {
			if( textArea.isDirty() ) {
				if( JOptionPane.showOptionDialog( this,
					"The file '" + textArea.getFileName()
					+ "' has been deleted. Replace the editor contents with these changes?",
					getWindowTitle(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
					null, new Object[] { "Save", "Close" }, "Save" ) == JOptionPane.YES_OPTION )
				{
					saveIfDirty();
					return true;
				}
			}

			return false;
		}

		if( textArea.isModifiedOutsideEditor() ) {
			if( textArea.isDirty() ) {
				if( JOptionPane.showConfirmDialog( this,
					"The file '" + textArea.getFileName()
					+ "' has been changed. Replace the editor contents with these changes?",
					getWindowTitle(), JOptionPane.YES_NO_OPTION ) != JOptionPane.YES_OPTION )
				{
					textArea.syncLastSaveOrLoadTimeToActualFile();
					return true;
				}
			}

			try {
				int selectionStart = textArea.getSelectionStart();
				int selectionEnd = textArea.getSelectionEnd();

				textArea.reload();

				textArea.select( selectionStart, selectionEnd );

				if( findReplaceBar != null && findReplaceBar.isShowing() )
					findReplaceBar.markAll();
			} catch( IOException ex ) {
				JOptionPane.showMessageDialog( this,
					"Failed to reload '" + textArea.getFileName() + "'\n\nReason: " + ex.getMessage(),
					getWindowTitle(), JOptionPane.WARNING_MESSAGE );
			}
		}

		return true;
	}
A pane that supports editing FlatLaf themes.

@author Karl Tauber
flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java