System.out.println("(New) Tile: " + tile + " Local Tileset: " + localtset);
        public void mouseClicked(MouseEvent e)        {            // System.out.println("Mouse clicked! Button: " + e.getButton());        	// System.out.println("Mouse clicked! Data: " + e);        	if ((e.getButton() == 1) && (editbox.isSelected())        			&& (gfxcontrol.getModeProps()[2] == 1))        	{        		int mousex = e.getX();        		int mousey = e.getY();        		int mapx = 0;        		int mapy = 0;        		        		for (int i = 0; mousex - (i * tilewidth) > tilewidth; i++)        		{        			mapx++;        		}        		        		for (int i = 0; mousey - (i * tilewidth) > tilewidth; i++)        		{        			mapy++;        		}        		        		int tile = editbox.getSelected();        		int localtset = 0;        		for (int i = 1; editbox.getSelected() - (i << 8) >= 0; i++)        		{        			tile -= (1 << 8);        			localtset++;        		}        		        		System.out.println("(New) Tile: " + tile + " Local Tileset: " + localtset);        		        		mapcontrol.changeTile(scrollx + mapx, scrolly + mapy, tile);        		gfxcontrol.changeMapArray(mapx, mapy, tile);        		mapcontrol.setLocalTileset(scrollx + mapx, scrolly + mapy,        				localtset);        		gfxcontrol.remoteRepaint();        	}            else if (e.getButton() == 3)            {            	changingSectors = true;                int mousex = e.getX();                int mousey = e.getY();                int sectorx = getSectorXorY(getTileXorY(mousex,                    tilewidth, screen_width)                    + x, sector_width);                int sectory = getSectorXorY(getTileXorY(mousey,                    tileheight, screen_height)                    + y, sector_height);                                int[] tsetpal = mapcontrol.getTsetPal(sectorx, sectory);                int[] modeprops = gfxcontrol.getModeProps();                if (modeprops[0] == 2)                {                    // System.out.println("Sector xy: " + sectorx + "," +                    // sectory);                    tilesetList.setSelectedIndex(tsetpal[0]);                    paletteField.setValue(new Integer(tsetpal[1]));                }                                if (modeprops[2] == 1)                {                	boolean isSame = editbox.setTsetPal(                			mapcontrol.getDrawTileset(tsetpal[0]),                            TileEditor.tilesets[mapcontrol.getDrawTileset(                            		tsetpal[0])].getPaletteNum(tsetpal[0],                            				tsetpal[1]));                	if (! isSame)                	{                		editbox.remoteRepaint();                	}                }                // System.out.println("Tile: " + getTileXorY(mousex - screen_x,                // tilewidth, screen_width) + "x" + getTileXorY(mousey -                // screen_y, tileheight, screen_height));                gfxcontrol.setSector(sectorx, sectory);                gfxcontrol.remoteRepaint();                changingSectors = false;            }        }