trackeditor: fix some warnings

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8238 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 7f170fffb12d1468d0a4fd4d5c56a2e36c6a6d1e
Former-commit-id: b652f6b34506d0adc4b1414b96dcd40da7988dca
This commit is contained in:
iobyte 2022-06-21 19:29:12 +00:00
parent 385b6dc1a0
commit df8efdc3e2
10 changed files with 50 additions and 58 deletions

View file

@ -431,7 +431,7 @@ public class EditorFrame extends JFrame
this.setLocation(p); this.setLocation(p);
menuFile.setText("File"); menuFile.setText("File");
itemCloseCircuit.setText("Exit"); itemCloseCircuit.setText("Exit");
itemCloseCircuit.addActionListener(new java.awt.event.ActionListener() itemCloseCircuit.addActionListener(new ActionListener()
{ {
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
@ -456,7 +456,7 @@ public class EditorFrame extends JFrame
{ {
} }
menuItemAddBackground.setText("Add ..."); menuItemAddBackground.setText("Add ...");
menuItemAddBackground.addActionListener(new java.awt.event.ActionListener() menuItemAddBackground.addActionListener(new ActionListener()
{ {
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
@ -464,7 +464,7 @@ public class EditorFrame extends JFrame
} }
}); });
menuItemShoStartPoint.setText("Show start point"); menuItemShoStartPoint.setText("Show start point");
menuItemShoStartPoint.addActionListener(new java.awt.event.ActionListener() menuItemShoStartPoint.addActionListener(new ActionListener()
{ {
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
@ -1167,9 +1167,9 @@ public class EditorFrame extends JFrame
{ {
jContentPane = new JPanel(); jContentPane = new JPanel();
jContentPane.setLayout(new BorderLayout()); jContentPane.setLayout(new BorderLayout());
jContentPane.add(mainScrollPane, java.awt.BorderLayout.CENTER); jContentPane.add(mainScrollPane, BorderLayout.CENTER);
jContentPane.add(getJToolBar(), java.awt.BorderLayout.NORTH); jContentPane.add(getJToolBar(), BorderLayout.NORTH);
//jContentPane.add(getDeltaPanel(), java.awt.BorderLayout.SOUTH); //jContentPane.add(getDeltaPanel(), BorderLayout.SOUTH);
} }
return jContentPane; return jContentPane;
} }
@ -1179,9 +1179,9 @@ public class EditorFrame extends JFrame
// if (deltaPanel == null) // if (deltaPanel == null)
// { // {
// deltaPanel = new DeltaPanel(); // deltaPanel = new DeltaPanel();
// //deltaPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); // //deltaPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(BevelBorder.LOWERED));
// //deltaPanel.setBackground(new java.awt.Color(0,204,204)); // //deltaPanel.setBackground(new Color(0,204,204));
// deltaPanel.setPreferredSize(new java.awt.Dimension(140,24)); // deltaPanel.setPreferredSize(new Dimension(140,24));
// } // }
// return deltaPanel; // return deltaPanel;
// } // }
@ -1190,29 +1190,29 @@ public class EditorFrame extends JFrame
{ {
if (documentIsModified) if (documentIsModified)
{ {
// ask wether to save or not // ask whether to save or not
int Res = JOptionPane.showConfirmDialog(this, "The circuit was modified. Do you want to save it ?", int Res = JOptionPane.showConfirmDialog(this, "The circuit was modified. Do you want to save it ?",
"Closing circuit", JOptionPane.YES_NO_CANCEL_OPTION); "Closing circuit", JOptionPane.YES_NO_CANCEL_OPTION);
if (Res == JOptionPane.CANCEL_OPTION) if (Res == JOptionPane.CANCEL_OPTION)
{ {
// can't close // can't close
return (false); return false;
} else if (Res == JOptionPane.YES_OPTION) } else if (Res == JOptionPane.YES_OPTION)
{ {
// save // save
saveProject(); saveProject();
// can close // can close
return (true); return true;
} else } else
{ {
// don't save, but can close // don't save, but can close
return (true); return true;
} }
} else } else
{ {
// can close // can close
return (true); return true;
} }
} }
@ -1422,38 +1422,29 @@ public class EditorFrame extends JFrame
*/ */
private void createActions() private void createActions()
{ {
undoAction = new UndoAction("Undo", createNavigationIcon("Undo24"), "Undo.", new Integer(KeyEvent.VK_Z)); undoAction = new UndoAction("Undo", createNavigationIcon("Undo24"), "Undo.", KeyEvent.VK_Z);
redoAction = new RedoAction("Redo", createNavigationIcon("Redo24"), "Redo.", new Integer(KeyEvent.VK_R)); redoAction = new RedoAction("Redo", createNavigationIcon("Redo24"), "Redo.", KeyEvent.VK_R);
deleteAction = new DeleteAction("Delete", createNavigationIcon("Cut24"), "Delete.", new Integer(KeyEvent.VK_L)); deleteAction = new DeleteAction("Delete", createNavigationIcon("Cut24"), "Delete.", KeyEvent.VK_L);
zoomPlusAction = new ZoomPlusAction("Zoom in", createNavigationIcon("ZoomIn24"), "Zoom in.", new Integer( zoomPlusAction = new ZoomPlusAction("Zoom in", createNavigationIcon("ZoomIn24"), "Zoom in.", KeyEvent.VK_M);
KeyEvent.VK_M)); zoomOneAction = new ZoomOneAction("Zoom 1:1", createNavigationIcon("Zoom24"), "Zoom 1:1.", KeyEvent.VK_N);
zoomOneAction = new ZoomOneAction("Zoom 1:1", createNavigationIcon("Zoom24"), "Zoom 1:1.", new Integer( zoomMinusAction = new ZoomMinusAction("Zoom out", createNavigationIcon("ZoomOut24"), "Zoom out.", KeyEvent.VK_O);
KeyEvent.VK_N));
zoomMinusAction = new ZoomMinusAction("Zoom out", createNavigationIcon("ZoomOut24"), "Zoom out.", new Integer(
KeyEvent.VK_O));
straightAction = new StraightAction("Add straight", createNavigationIcon("Straight24"), straightAction = new StraightAction("Add straight", createNavigationIcon("Straight24"),
"Add a straight segment.", new Integer(KeyEvent.VK_P)); "Add a straight segment.", KeyEvent.VK_P);
rightAction = new RightAction("Add right", createNavigationIcon("TurnRight24"), "Add a right turn segment.", rightAction = new RightAction("Add right", createNavigationIcon("TurnRight24"), "Add a right turn segment.", KeyEvent.VK_Q);
new Integer(KeyEvent.VK_Q)); leftAction = new LeftAction("Add left", createNavigationIcon("TurnLeft24"), "Add a left turn segment.", KeyEvent.VK_S);
leftAction = new LeftAction("Add left", createNavigationIcon("TurnLeft24"), "Add a left turn segment.", newAction = new NewAction("New", createNavigationIcon("New24"), "New circuit.", KeyEvent.VK_S);
new Integer(KeyEvent.VK_S)); openAction = new OpenAction("Open", createNavigationIcon("Open24"), "Open existing circuit.", KeyEvent.VK_S);
newAction = new NewAction("New", createNavigationIcon("New24"), "New circuit.", new Integer(KeyEvent.VK_S)); saveAction = new SaveAction("Save", createNavigationIcon("Save24"), "Save the circuit.", KeyEvent.VK_S);
openAction = new OpenAction("Open", createNavigationIcon("Open24"), "Open existing circuit.", new Integer( moveAction = new MoveAction("Move", createNavigationIcon("Export24"), "Move.", KeyEvent.VK_S);
KeyEvent.VK_S)); showArrowsAction = new ShowArrowsAction("Show arrows", createNavigationIcon("FindAgain24"), "Show arrows.", KeyEvent.VK_S);
saveAction = new SaveAction("Save", createNavigationIcon("Save24"), "Save the circuit.", new Integer(
KeyEvent.VK_S));
moveAction = new MoveAction("Move", createNavigationIcon("Export24"), "Move.", new Integer(KeyEvent.VK_S));
showArrowsAction = new ShowArrowsAction("Show arrows", createNavigationIcon("FindAgain24"), "Show arrows.",
new Integer(KeyEvent.VK_S));
showBackgroundAction = new ShowBackgroundAction("Show background", createNavigationIcon("Search24"), showBackgroundAction = new ShowBackgroundAction("Show background", createNavigationIcon("Search24"),
"Show background image.", new Integer(KeyEvent.VK_S)); "Show background image.", KeyEvent.VK_S);
helpAction = new HelpAction("Help", createNavigationIcon("Help24"), "Help.", new Integer(KeyEvent.VK_S)); helpAction = new HelpAction("Help", createNavigationIcon("Help24"), "Help.", KeyEvent.VK_S);
/** ******************************************************************* */ /** ******************************************************************* */
allAction = new ExportAllAction("All", null, "Export both XML file and AC3 file.", new Integer(KeyEvent.VK_S)); allAction = new ExportAllAction("All", null, "Export both XML file and AC3 file.", KeyEvent.VK_S);
ac3Action = new ExportAC3Action("AC3", null, "Create AC3 file.", new Integer(KeyEvent.VK_S)); ac3Action = new ExportAC3Action("AC3", null, "Create AC3 file.", KeyEvent.VK_S);
propertiesAction = new PropertiesAction("Properties", null, "Properties dialog.", new Integer(KeyEvent.VK_S)); propertiesAction = new PropertiesAction("Properties", null, "Properties dialog.", KeyEvent.VK_S);
calcDeltaAction = new CalcDeltaAction("Delta's", createNavigationIcon("Calc24"), "Calculate Delta's for x,y,z and angle.", new Integer(KeyEvent.VK_S)); calcDeltaAction = new CalcDeltaAction("Delta's", createNavigationIcon("Calc24"), "Calculate Delta's for x,y,z and angle.", KeyEvent.VK_S);
} }
public class UndoAction extends AbstractAction public class UndoAction extends AbstractAction

View file

@ -247,7 +247,7 @@ public class EnvMapProperties extends PropertyPanel
} }
for (int i = 0; i < minCount; i++) for (int i = 0; i < minCount; i++)
{ {
utils.circuit.EnvironmentMapping envMap = envMaps.elementAt(i); EnvironmentMapping envMap = envMaps.elementAt(i);
EnvMapPanel panel = (EnvMapPanel) tabbedPane.getComponentAt(i); EnvMapPanel panel = (EnvMapPanel) tabbedPane.getComponentAt(i);
if (isDifferent(panel.nameTextField.getText(), envMap.getName(), stringResult)) if (isDifferent(panel.nameTextField.getText(), envMap.getName(), stringResult))
{ {

View file

@ -217,7 +217,7 @@ public class ObjectProperties extends PropertyPanel
} }
private String getString(int value) private String getString(int value)
{ {
if (value != (Integer.MAX_VALUE)) if (value != Integer.MAX_VALUE)
return "0x" + Integer.toHexString(value).toUpperCase(); return "0x" + Integer.toHexString(value).toUpperCase();
return null; return null;

View file

@ -21,6 +21,7 @@
package gui.properties; package gui.properties;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JDialog; import javax.swing.JDialog;
@ -134,8 +135,8 @@ public class PropertiesDialog extends JDialog
{ {
pane = new JPanel(); pane = new JPanel();
pane.setLayout(new BorderLayout()); pane.setLayout(new BorderLayout());
pane.add(getTabbedPane(), java.awt.BorderLayout.CENTER); pane.add(getTabbedPane(), BorderLayout.CENTER);
pane.add(getFooterPanel(), java.awt.BorderLayout.SOUTH); pane.add(getFooterPanel(), BorderLayout.SOUTH);
} }
return pane; return pane;
} }
@ -151,7 +152,7 @@ public class PropertiesDialog extends JDialog
footerPanel = new JPanel(); footerPanel = new JPanel();
footerPanel.setLayout(null); footerPanel.setLayout(null);
footerPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED)); footerPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
footerPanel.setPreferredSize(new java.awt.Dimension(14, 35)); footerPanel.setPreferredSize(new Dimension(14, 35));
footerPanel.add(getOkButton(), null); footerPanel.add(getOkButton(), null);
footerPanel.add(getCancelButton(), null); footerPanel.add(getCancelButton(), null);
} }

View file

@ -459,7 +459,7 @@ public class TerrainProperties extends PropertyPanel
for (int i = 0; i < objectMaps.size(); i++) for (int i = 0; i < objectMaps.size(); i++)
{ {
utils.circuit.ObjectMap objectMap = objectMaps.elementAt(i); ObjectMap objectMap = objectMaps.elementAt(i);
tabbedPane.addTab(objectMap.getName(), null, new ObjectMapPanel(objectMap.getName(), objectMap.getObjectMap()), null); tabbedPane.addTab(objectMap.getName(), null, new ObjectMapPanel(objectMap.getName(), objectMap.getObjectMap()), null);
} }
} }
@ -644,7 +644,7 @@ public class TerrainProperties extends PropertyPanel
} }
for (int i = 0; i < minCount; i++) for (int i = 0; i < minCount; i++)
{ {
utils.circuit.ObjectMap objectMap = objectMaps.elementAt(i); ObjectMap objectMap = objectMaps.elementAt(i);
ObjectMapPanel panel = (ObjectMapPanel) tabbedPane.getComponentAt(i); ObjectMapPanel panel = (ObjectMapPanel) tabbedPane.getComponentAt(i);
if (isDifferent(panel.nameTextField.getText(), objectMap.getName(), stringResult)) if (isDifferent(panel.nameTextField.getText(), objectMap.getName(), stringResult))
{ {

View file

@ -886,7 +886,7 @@ public class SegmentEditorDlg extends JDialog implements SliderListener
frame.documentIsModified = true; frame.documentIsModified = true;
} }
public void windowClosing(java.awt.event.WindowEvent anEvent) public void windowClosing(WindowEvent anEvent)
{ {
System.out.println("JDialog is closing"); System.out.println("JDialog is closing");
} }

View file

@ -123,7 +123,7 @@ public class SegmentSlider extends JPanel
if (slider == null) if (slider == null)
{ {
slider = new JSlider(); slider = new JSlider();
slider.setOrientation(javax.swing.JSlider.VERTICAL); slider.setOrientation(JSlider.VERTICAL);
} }
return slider; return slider;
} }

View file

@ -199,7 +199,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
} }
/** /**
* blank construtor * blank constructor
*/ */
public CircuitView() public CircuitView()
{ {
@ -213,7 +213,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
*/ */
public boolean isFocusTraversable() public boolean isFocusTraversable()
{ {
return (true); return true;
} }
public void screenToReal(MouseEvent e, Point2D.Double point) public void screenToReal(MouseEvent e, Point2D.Double point)

View file

@ -63,7 +63,7 @@ public class Curve extends Segment implements Cloneable
shape.nbSteps = nbSteps; shape.nbSteps = nbSteps;
return (shape); return shape;
} }
public void calcShape(Segment previousShape) throws Exception public void calcShape(Segment previousShape) throws Exception

View file

@ -190,7 +190,7 @@ public class Segment implements Cloneable
shape.xToDraw = (int[]) xToDraw.clone(); shape.xToDraw = (int[]) xToDraw.clone();
shape.yToDraw = (int[]) yToDraw.clone(); shape.yToDraw = (int[]) yToDraw.clone();
return (shape); return shape;
} }
public boolean contains(double x, double y) public boolean contains(double x, double y)
@ -243,10 +243,10 @@ public class Segment implements Cloneable
} }
if (found) if (found)
return (true); return true;
} }
return (false); return false;
} }
public Rectangle2D.Double getBounds() public Rectangle2D.Double getBounds()