xxxxxxxxxx
// Listen for changes in the text
textField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
warn();
}
public void removeUpdate(DocumentEvent e) {
warn();
}
public void insertUpdate(DocumentEvent e) {
warn();
}
public void warn() {
if (Integer.parseInt(textField.getText())<=0){
JOptionPane.showMessageDialog(null,
"Error: Please enter number bigger than 0", "Error Message",
JOptionPane.ERROR_MESSAGE);
}
}
});
xxxxxxxxxx
# You might want to add nvim to the editor list first:
sudo update-alternatives --install /usr/bin/editor editor $(which nvim) 21
# Then you can simply choose neovim to be your default editor
sudo update-alternatives --config editor