Internationalize TableBitwiseSwitch class

This commit is contained in:
Dale Schultz 2020-03-29 14:09:58 -04:00
parent 362bdb2d0b
commit 04fbfbd241
2 changed files with 11 additions and 4 deletions

View File

@ -0,0 +1,2 @@
OUTOFRANGE = Table: {0}\nDefinition file specified an out of range bit switch! Only values >= 0 and < size * 8 are allowed!
DEFERROR = ERROR - Incorrect definition

View File

@ -22,6 +22,7 @@ package com.romraider.maps;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@ -30,6 +31,7 @@ import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Map.Entry;
import javax.swing.JCheckBox;
@ -38,6 +40,7 @@ import javax.swing.JPanel;
import javax.swing.JTextArea;
import com.romraider.util.ByteUtil;
import com.romraider.util.ResourceUtil;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.showMessageDialog;
@ -45,6 +48,8 @@ import static javax.swing.JOptionPane.showMessageDialog;
public class TableBitwiseSwitch extends Table {
private static final long serialVersionUID = -4887718305447362308L;
private static final ResourceBundle rb = new ResourceUtil().getBundle(
TableBitwiseSwitch.class.getName());
private final Map<String, Integer> controlBits = new HashMap<String, Integer>();
private ArrayList<JCheckBox> checkboxes;
private int dataSize = 1;
@ -75,10 +80,10 @@ public class TableBitwiseSwitch extends Table {
for (Entry<String, Integer> entry : sortByValue(controlBits).entrySet()) {
if (entry.getValue() > maxBitPosition) {
String mismatch = String.format(
"Table: %s%nDefinition file specified an out of range bit switch! Only values >= 0 and < size * 8 are allowed!",
super.getName());
showMessageDialog(this, mismatch, "ERROR - Incorrect definition", ERROR_MESSAGE);
String mismatch = MessageFormat.format(
rb.getString("OUTOFRANGE"), super.getName());
showMessageDialog(this, mismatch,
rb.getString("DEFERROR"), ERROR_MESSAGE);
break;
} else {
JCheckBox cb = new JCheckBox(entry.getKey());