I often rely on the JDK source code to understand how I should implement an interface, and I often find some very strange indentation style at use. For instance, in DefaultCellEditor.java
:
public DefaultCellEditor(final JTextField textField) {
editorComponent = textField;
this.clickCountToStart = 2;
delegate = new EditorDelegate() {
public void setValue(Object value) {
textField.setText((value != null) ? value.toString() : "");
}
public Object getCellEditorValue() {
return textField.getText();
}
};
textField.addActionListener(delegate);
}
I'm wondering if this is due to my IDE or not, since I find this kind of indentation quite strange and difficult to read.
An intent is to perform an action on the screen. It is mostly used to start activity, send broadcast receiver,start services and send message between two activities. There are two intents available in android as Implicit Intents and Explicit Intents. Here is a sample example to start new activity with old activity.
Indentation. Perhaps the most important style rule you can learn is to indent properly. The compiler cares nothing about indentation, but if you indent well, you make your code so much easier to read, which means you'll make it easier to debug.
Sounds like a tab vs spaces issue. Try setting the tab width to 4 spaces (or 8 if it is 4).
Here is what I see when browsing the OpenJDK code for DefaultCellEditor online.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With