|
@@ -62,6 +62,8 @@ public class BackgroundPopUp extends JDialog {
|
|
private final JRadioButton rdbtnImagePixel = new JRadioButton("Use Image Size");
|
|
private final JRadioButton rdbtnImagePixel = new JRadioButton("Use Image Size");
|
|
private final JRadioButton rdbtnStretched = new JRadioButton("Strech Image");
|
|
private final JRadioButton rdbtnStretched = new JRadioButton("Strech Image");
|
|
private final JRadioButton rdbtnCustom = new JRadioButton("Custom Size");
|
|
private final JRadioButton rdbtnCustom = new JRadioButton("Custom Size");
|
|
|
|
+ private final JButton removeImageBtn = new JButton("Remove Background Image");
|
|
|
|
+ private boolean imageBtnClearedPressed = false;
|
|
|
|
|
|
// Modes
|
|
// Modes
|
|
public static final int IMAGE_PIXELS = 0, STRETCHED = 1, CUSTOM = 2;
|
|
public static final int IMAGE_PIXELS = 0, STRETCHED = 1, CUSTOM = 2;
|
|
@@ -134,6 +136,22 @@ public class BackgroundPopUp extends JDialog {
|
|
panel.add(imageHeight);
|
|
panel.add(imageHeight);
|
|
imageHeight.setColumns(10);
|
|
imageHeight.setColumns(10);
|
|
|
|
|
|
|
|
+ // remove BackgroundImage Button
|
|
|
|
+ removeImageBtn.setBackground(Color.WHITE);
|
|
|
|
+ removeImageBtn.addActionListener(new ActionListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
|
+ path = "";
|
|
|
|
+ textPath.setText("");
|
|
|
|
+ imageBtnClearedPressed = true;
|
|
|
|
+ lblImage.setIcon(null);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ JPanel removePanel = new JPanel();
|
|
|
|
+ removePanel.add(removeImageBtn);
|
|
|
|
+ removePanel.setBackground(Color.WHITE);
|
|
|
|
+ panelRadio.add(removePanel);
|
|
|
|
+
|
|
// Browse Panel
|
|
// Browse Panel
|
|
getContentPane().add(panelBrowse, BorderLayout.NORTH);
|
|
getContentPane().add(panelBrowse, BorderLayout.NORTH);
|
|
panelBrowse.setLayout(new BorderLayout(0, 0));
|
|
panelBrowse.setLayout(new BorderLayout(0, 0));
|
|
@@ -209,6 +227,16 @@ public class BackgroundPopUp extends JDialog {
|
|
Integer.parseInt(imageHeight.getText()));
|
|
Integer.parseInt(imageHeight.getText()));
|
|
}
|
|
}
|
|
dispose();
|
|
dispose();
|
|
|
|
+ } else if (imageBtnClearedPressed) {
|
|
|
|
+ if (canvas != null) {
|
|
|
|
+ controller.setBackgroundImage(path, mode, Integer.parseInt(imageWidth.getText()),
|
|
|
|
+ Integer.parseInt(imageHeight.getText()));
|
|
|
|
+ canvas.repaint();
|
|
|
|
+ } else if (uNode != null) {
|
|
|
|
+ uNode.setBackgroundImage(path, mode, Integer.parseInt(imageWidth.getText()),
|
|
|
|
+ Integer.parseInt(imageHeight.getText()));
|
|
|
|
+ }
|
|
|
|
+ dispose();
|
|
} else {
|
|
} else {
|
|
JOptionPane.showMessageDialog(null, "No image selected!", "Warning!", JOptionPane.WARNING_MESSAGE);
|
|
JOptionPane.showMessageDialog(null, "No image selected!", "Warning!", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
}
|