清理无用主函数,标点名称为空时不予标记
This commit is contained in:
@@ -401,7 +401,7 @@ public class ImageDotMarker extends JFrame {
|
|||||||
private void addNewPoint(Point imgPoint) {
|
private void addNewPoint(Point imgPoint) {
|
||||||
// 提示用户输入点名称
|
// 提示用户输入点名称
|
||||||
String name = JOptionPane.showInputDialog(this, "请输入标记点名称:", "添加标记点", JOptionPane.PLAIN_MESSAGE);
|
String name = JOptionPane.showInputDialog(this, "请输入标记点名称:", "添加标记点", JOptionPane.PLAIN_MESSAGE);
|
||||||
if (name == null) return; // 用户取消
|
if (name == null || name.isEmpty()) return; // 用户取消
|
||||||
|
|
||||||
MarkPoint point = new MarkPoint(imgPoint.x, imgPoint.y, name);
|
MarkPoint point = new MarkPoint(imgPoint.x, imgPoint.y, name);
|
||||||
points.add(point);
|
points.add(point);
|
||||||
@@ -549,13 +549,6 @@ public class ImageDotMarker extends JFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
|
||||||
ImageDotMarker app = new ImageDotMarker();
|
|
||||||
app.setVisible(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 标记点类,包含坐标和名称
|
// 标记点类,包含坐标和名称
|
||||||
private static class MarkPoint {
|
private static class MarkPoint {
|
||||||
int x;
|
int x;
|
||||||
|
|||||||
Reference in New Issue
Block a user