Skip to content

Commit 0096e57

Browse files
committed
Some cleanup
1 parent 0dfba1f commit 0096e57

File tree

3 files changed

+7
-22
lines changed

3 files changed

+7
-22
lines changed

src/main/java/info/loenwind/compare/AppWindow.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ public class AppWindow {
4848
private Component verticalStrut;
4949
private Component horizontalStrut_2;
5050

51-
/**
52-
* Launch the application.
53-
*/
5451
public static void run() {
5552
EventQueue.invokeLater(new Runnable() {
5653
@Override
@@ -65,16 +62,10 @@ public void run() {
6562
});
6663
}
6764

68-
/**
69-
* Create the application.
70-
*/
7165
public AppWindow() {
7266
initialize();
7367
}
7468

75-
/**
76-
* Initialize the contents of the frame.
77-
*/
7869
private void initialize() {
7970
try {
8071
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
@@ -166,9 +157,9 @@ public void changedUpdate(DocumentEvent e) {
166157
public void actionPerformed(ActionEvent e) {
167158
JFileChooser chooser = new JFileChooser();
168159
if (textField.getText().isEmpty()) {
169-
chooser.setCurrentDirectory(new java.io.File("."));
160+
chooser.setCurrentDirectory(new File("."));
170161
} else {
171-
chooser.setCurrentDirectory(new java.io.File(textField.getText()));
162+
chooser.setCurrentDirectory(new File(textField.getText()));
172163
}
173164
chooser.setDialogTitle("Select images folder");
174165
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
@@ -303,7 +294,6 @@ public void windowClosing(WindowEvent e1) {
303294
}
304295
}
305296
});
306-
// buttonCompare.setEnabled(false);
307297
GridBagConstraints gbc_btnNewButton_2 = new GridBagConstraints();
308298
gbc_btnNewButton_2.insets = new Insets(0, 0, 5, 5);
309299
gbc_btnNewButton_2.gridx = 3;

src/main/java/info/loenwind/compare/ImagePanel.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
/**
1919
* @beaninfo attribute: isContainer false description: A component that displays an image.
2020
*
21-
* @author micaja
22-
*
2321
*/
2422
public class ImagePanel extends JPanel {
2523

@@ -30,6 +28,9 @@ public class ImagePanel extends JPanel {
3028
private boolean hovered = false;
3129
private Rectangle imgpos;
3230

31+
/**
32+
* A dummy panel that is resized to match the current image so mouse enter and exit events can be used.
33+
*/
3334
private final JPanel overlay;
3435

3536
public ImagePanel() {
@@ -139,6 +140,7 @@ public void mouseClicked(MouseEvent e) {
139140
listener1.run();
140141
break;
141142
case MouseEvent.BUTTON2:
143+
case MouseEvent.BUTTON3:
142144
listener2.run();
143145
break;
144146
}

src/main/java/info/loenwind/compare/ResultWindow.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public class ResultWindow extends JFrame {
4141
private JTable table;
4242
private JTabbedPane tabbedPane;
4343

44-
/**
45-
* Create the dialog.
46-
*/
4744
public ResultWindow(DefaultTableModel model, String result) {
4845
setBounds(100, 100, 640, 480);
4946
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
@@ -67,14 +64,10 @@ public Component prepareRenderer(TableCellRenderer renderer, int row, int col) {
6764

6865
Component c = super.prepareRenderer(renderer, row, col);
6966
if (c instanceof JComponent) {
70-
// try {
7167
JComponent jc = (JComponent) c;
7268
String name = getValueAt(row, convertColumnIndexToModel(1)).toString();
73-
String html = "<html><body><img src=\"" + new File(name).toURI()/* .toURL() */ + "\"></body></html>";
69+
String html = "<html><body><img src=\"" + new File(name).toURI() + "\"></body></html>";
7470
jc.setToolTipText(html);
75-
// } catch (MalformedURLException e) {
76-
// e.printStackTrace();
77-
// }
7871
}
7972
return c;
8073
}

0 commit comments

Comments
 (0)