package mapMaker; import javax.swing.*; import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; //import MDUtils.MDDimUtils; /** A GUI for the Map Maker project. * The JFrame will have two panels: one for drawing, one for text * drawGUI.java * * Created on October 27, 2002, 10:06 AM * @author dickey */ public class drawGUI extends JFrame { /**default frame dimensions */ final static int defaultWidth = 850; final static int defaultHeight = 550; final static Color borderColor = Color.orange; MapPanel drawingPanel; TextPanel countyInfoPanel; // MapModel theMap; // the map to draw /** Creates a new instance of drawGUI */ public drawGUI(Dimension requestedDim, MapModel mm) { super(); this.setSize(requestedDim); this.setTitle("Map Maker"); Container contentPane = this.getContentPane(); contentPane.setLayout(new FlowLayout()); contentPane.setSize(this.getSize()); contentPane.setBackground(Color.black); //no need to set Frame background this.drawingPanel = new MapPanel(); contentPane.add(drawingPanel); //Now create a panel for text information this.countyInfoPanel = new TextPanel(); contentPane.add(countyInfoPanel); this.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); this.setMapModel(mm); //this.show(); //this.drawingPanel.repaint(); } //end constructor public drawGUI(MapModel mm) { this(new Dimension(defaultWidth, defaultHeight), mm); } public drawGUI() { this(new MapModel()); } //end default constructor public void setMapModel(MapModel mm) { //now have a real map to process this.drawingPanel.setMapModel(mm); this.countyInfoPanel.setMapModel(mm); } //just a little class test routine public static void main(String[] args) { MapModel mm = new MapModel(); new drawGUI(mm); } //end main }