// Path: common/src/main/java/common/MinMaxFilter.java
// public class MinMaxFilter extends DocumentFilter {
// 	private int minimum;
// 	private int maximum;
// 
// 	public MinMaxFilter(int min, int max) {
// 		this.minimum = min;
// 		this.maximum = max;
// 	}
// 
// 	@Override
// 	public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
// 		Document doc = fb.getDocument();
// 		String replacement = new StringBuilder(doc.getText(0, doc.getLength())).replace(offset, offset + length, text).toString();
// 		try {
// 			int value = Integer.parseInt(replacement);
// 			if (value < this.minimum)
// 				value = this.minimum;
// 			if (value > this.maximum)
// 				value = this.maximum;
// 			super.replace(fb, 0, doc.getLength(), String.valueOf(value), attrs);
// 		}
// 		catch (NumberFormatException e) {
// 			String max = Integer.toString(this.maximum);
// 			if (text.length() > max.length() / 2)
// 				text = max;
// 			else
// 				text = Integer.toString(this.minimum);
// 			super.replace(fb, 0, doc.getLength(), text, attrs);
// 		}
// 	}
// }


import java.awt.Dimension;
import java.awt.GridLayout;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.AbstractDocument;
import common.MinMaxFilter;
		this.tileID.setHorizontalAlignment(SwingConstants.CENTER);
		this.extendedTileID.setHorizontalAlignment(SwingConstants.CENTER);
		this.tileSpecificID.setHorizontalAlignment(SwingConstants.CENTER);
		this.npcTriggerField.setHorizontalAlignment(SwingConstants.CENTER);

		this.alphaField.setHorizontalAlignment(SwingConstants.CENTER);
		this.redField.setHorizontalAlignment(SwingConstants.CENTER);
		this.greenField.setHorizontalAlignment(SwingConstants.CENTER);
		this.blueField.setHorizontalAlignment(SwingConstants.CENTER);
		this.isNpcTriggerBox.setHorizontalAlignment(SwingConstants.CENTER);

		this.alphaField.setEditable(false);
		this.redField.setEditable(false);
		this.greenField.setEditable(false);
		this.blueField.setEditable(false);
		this.isNpcTriggerBox.setEnabled(false);

		this.areaIDInputField.setHorizontalAlignment(SwingConstants.CENTER);
		this.alphaInputField.setHorizontalAlignment(SwingConstants.CENTER);
		this.redInputField.setHorizontalAlignment(SwingConstants.CENTER);
		this.greenInputField.setHorizontalAlignment(SwingConstants.CENTER);
		this.blueInputField.setHorizontalAlignment(SwingConstants.CENTER);

		// Intentionally setting the default text value for the area ID to be non-empty first.
		this.areaIDInputField.setText("0");

		// Set a min/max range for input fields when entering any value to be of unsigned values.
		((AbstractDocument) this.areaIDInputField.getDocument()).setDocumentFilter(new MinMaxFilter(0, Short.MAX_VALUE - Short.MIN_VALUE));
		((AbstractDocument) this.alphaInputField.getDocument()).setDocumentFilter(new MinMaxFilter(0, Byte.MAX_VALUE - Byte.MIN_VALUE));
		((AbstractDocument) this.redInputField.getDocument()).setDocumentFilter(new MinMaxFilter(0, Byte.MAX_VALUE - Byte.MIN_VALUE));
// Path: common/src/main/java/common/MinMaxFilter.java
// public class MinMaxFilter extends DocumentFilter {
// 	private int minimum;
// 	private int maximum;
// 
// 	public MinMaxFilter(int min, int max) {
// 		this.minimum = min;
// 		this.maximum = max;
// 	}
// 
// 	@Override
// 	public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
// 		Document doc = fb.getDocument();
// 		String replacement = new StringBuilder(doc.getText(0, doc.getLength())).replace(offset, offset + length, text).toString();
// 		try {
// 			int value = Integer.parseInt(replacement);
// 			if (value < this.minimum)
// 				value = this.minimum;
// 			if (value > this.maximum)
// 				value = this.maximum;
// 			super.replace(fb, 0, doc.getLength(), String.valueOf(value), attrs);
// 		}
// 		catch (NumberFormatException e) {
// 			String max = Integer.toString(this.maximum);
// 			if (text.length() > max.length() / 2)
// 				text = max;
// 			else
// 				text = Integer.toString(this.minimum);
// 			super.replace(fb, 0, doc.getLength(), text, attrs);
// 		}
// 	}
// }


// Path: levelEditor/src/main/java/editor/TilePropertiesPanel.java
import java.awt.Dimension;
import java.awt.GridLayout;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.AbstractDocument;
import common.MinMaxFilter;

		this.tileID.setHorizontalAlignment(SwingConstants.CENTER);
		this.extendedTileID.setHorizontalAlignment(SwingConstants.CENTER);
		this.tileSpecificID.setHorizontalAlignment(SwingConstants.CENTER);
		this.npcTriggerField.setHorizontalAlignment(SwingConstants.CENTER);

		this.alphaField.setHorizontalAlignment(SwingConstants.CENTER);
		this.redField.setHorizontalAlignment(SwingConstants.CENTER);
		this.greenField.setHorizontalAlignment(SwingConstants.CENTER);
		this.blueField.setHorizontalAlignment(SwingConstants.CENTER);
		this.isNpcTriggerBox.setHorizontalAlignment(SwingConstants.CENTER);

		this.alphaField.setEditable(false);
		this.redField.setEditable(false);
		this.greenField.setEditable(false);
		this.blueField.setEditable(false);
		this.isNpcTriggerBox.setEnabled(false);

		this.areaIDInputField.setHorizontalAlignment(SwingConstants.CENTER);
		this.alphaInputField.setHorizontalAlignment(SwingConstants.CENTER);
		this.redInputField.setHorizontalAlignment(SwingConstants.CENTER);
		this.greenInputField.setHorizontalAlignment(SwingConstants.CENTER);
		this.blueInputField.setHorizontalAlignment(SwingConstants.CENTER);

		// Intentionally setting the default text value for the area ID to be non-empty first.
		this.areaIDInputField.setText("0");

		// Set a min/max range for input fields when entering any value to be of unsigned values.
		((AbstractDocument) this.areaIDInputField.getDocument()).setDocumentFilter(new MinMaxFilter(0, Short.MAX_VALUE - Short.MIN_VALUE));
		((AbstractDocument) this.alphaInputField.getDocument()).setDocumentFilter(new MinMaxFilter(0, Byte.MAX_VALUE - Byte.MIN_VALUE));
		((AbstractDocument) this.redInputField.getDocument()).setDocumentFilter(new MinMaxFilter(0, Byte.MAX_VALUE - Byte.MIN_VALUE));
		((AbstractDocument) this.greenInputField.getDocument()).setDocumentFilter(new MinMaxFilter(0, Byte.MAX_VALUE - Byte.MIN_VALUE));