📄 mapscrollpane.java
字号:
/* Written by : Seet Yew Siang
* Sim Xiangyuan
* Description of class: Class is used to contains mapCanvas as a means of
* being able to scroll mapCanvas when the physical size
* becomes bigger than the scrollPane
* Description of methods: Methods of this class are purely delegation method, ie
* it only forward the method to mapCanvas
*/
package GUI;
import javax.swing.JScrollPane;
import tools.BusRoute;
import tools.MapData;
public class MapScrollPane extends JScrollPane {
private MapCanvas mapCanvas;
private int mode;
/*
* constructor to initialise width, height and gridSize
*/
MapScrollPane(int width,int height,int gridSize) {
super();
mapCanvas = new MapCanvas(width,height,gridSize);
this.setViewportView(mapCanvas);
}
/*
* function to copy selected object in mapCanvas
*/
public void copy() {
//forward method to mapCanvas
mapCanvas.copy();
}
/*
* function to cut selected object in mapCanvas
*/
public void cut() {
//forward method to mapCanvas
mapCanvas.cut();
}
/*
* function to delete selected object in mapCanvas
*/
public void delete() {
//forward method to mapCanvas
mapCanvas.delete();
}
/*
* function to paste selected object in mapCanvas
*/
public void paste() {
//forward method to mapCanvas
mapCanvas.paste();
}
/*
* function to set frame of mapCanvas so that
* main frame function can be called
*/
public void setFrame(CmeGUI frame) {
mapCanvas.setFrame(frame);
}
/*
* function to set mapData of mapCanvas
*/
public void setMapData(MapData mapData) {
//forward method to mapCanvas
mapCanvas.setMapData(mapData);
}
/*
* function to set mode of mapCanvas
*/
public void setMode(int mode) {
//forward method to mapCanvas
mapCanvas.setMode(mode);
}
/*
* function to set value of mapCanvas selected object
* only roads,rivers and bus route property can be set
*/
public void setSelectedValue(String text) {
//forward method to mapCanvas
mapCanvas.setSelectedValue(text);
}
/*
* function to set displayedBusRoute of mapCanvas
*/
public void setDisplayedBusRoute(BusRoute busRoute) {
//forward method to mapCanvas
mapCanvas.setDisplayedBusRoute(busRoute);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -