Some Java 8 code cleanup

This commit is contained in:
Fabian Becker 2015-12-13 13:02:09 +01:00
parent dedfb39eb4
commit cc09ce9381
3 changed files with 10 additions and 26 deletions

View File

@ -100,14 +100,10 @@ public class DoubleArrayEditor extends JPanel implements PropertyEditor {
this.normalizeButton.addActionListener(this.normalizeAction); this.normalizeButton.addActionListener(this.normalizeAction);
this.okButton = new JButton("OK"); this.okButton = new JButton("OK");
this.okButton.setEnabled(true); this.okButton.setEnabled(true);
this.okButton.addActionListener(new ActionListener() { this.okButton.addActionListener(e -> {
@Override if ((customEditor.getTopLevelAncestor() != null) && (customEditor.getTopLevelAncestor() instanceof Window)) {
public void actionPerformed(ActionEvent e) { Window w = (Window) customEditor.getTopLevelAncestor();
//backupObject = copyObject(object); w.dispose();
if ((customEditor.getTopLevelAncestor() != null) && (customEditor.getTopLevelAncestor() instanceof Window)) {
Window w = (Window) customEditor.getTopLevelAncestor();
w.dispose();
}
} }
}); });
this.buttonPanel.add(this.addButton); this.buttonPanel.add(this.addButton);
@ -124,7 +120,7 @@ public class DoubleArrayEditor extends JPanel implements PropertyEditor {
ActionListener addAction = new ActionListener() { ActionListener addAction = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
doubleArray.addRowCopy(lastFocussedRow); // copy the last focussed row doubleArray.addRowCopy(lastFocussedRow); // copy the last focused row
updateEditor(); updateEditor();
} }
}; };
@ -145,7 +141,7 @@ public class DoubleArrayEditor extends JPanel implements PropertyEditor {
}; };
/** /**
* This action listener nomalizes each columng of the values of the DoubleArray. * This action listener normalizes each column of the values of the DoubleArray.
*/ */
ActionListener normalizeAction = new ActionListener() { ActionListener normalizeAction = new ActionListener() {
@Override @Override
@ -183,7 +179,6 @@ public class DoubleArrayEditor extends JPanel implements PropertyEditor {
} }
doubleArray.setDoubleArray(tmpDD); doubleArray.setDoubleArray(tmpDD);
//updateEditor();
} }
}; };
@ -223,9 +218,7 @@ public class DoubleArrayEditor extends JPanel implements PropertyEditor {
} }
public void notifyFocusID(int id) { public void notifyFocusID(int id) {
// notification of which column has the focus
lastFocussedRow = id; lastFocussedRow = id;
// System.out.println("Focus now on " + id);
} }
/** /**

View File

@ -4,7 +4,6 @@ import eva2.gui.PropertyIntArray;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
@ -55,14 +54,10 @@ public class IntArrayEditor extends JPanel implements PropertyEditor {
this.buttonPanel = new JPanel(); this.buttonPanel = new JPanel();
this.okButton = new JButton("OK"); this.okButton = new JButton("OK");
this.okButton.setEnabled(true); this.okButton.setEnabled(true);
this.okButton.addActionListener(new ActionListener() { this.okButton.addActionListener(e -> {
@Override if ((customEditor.getTopLevelAncestor() != null) && (customEditor.getTopLevelAncestor() instanceof Window)) {
public void actionPerformed(ActionEvent e) { Window w = (Window) customEditor.getTopLevelAncestor();
//backupObject = copyObject(object); w.dispose();
if ((customEditor.getTopLevelAncestor() != null) && (customEditor.getTopLevelAncestor() instanceof Window)) {
Window w = (Window) customEditor.getTopLevelAncestor();
w.dispose();
}
} }
}); });
this.buttonPanel.add(this.okButton); this.buttonPanel.add(this.okButton);

View File

@ -12,10 +12,6 @@ public class MultiLineString {
public MultiLineString() { public MultiLineString() {
} }
public static void main(String[] args) {
MultiLineString multiLineString1 = new MultiLineString();
}
public String getString() { public String getString() {
return string; return string;
} }