public StaticImages() { // //Get the default toolkit Toolkit toolkit = Toolkit.getDefaultToolkit(); Resources toolbarRes = EPDShore.res().folder("images/toolbar"); // Load an image for the cursor Image image = toolkit.getImage(toolbarRes.getResource("drag_mouse.png")); dragCursor = toolkit.createCustomCursor(image, new Point(0, 0), "Drag"); Image image2 = toolkit.getImage(toolbarRes.getResource("drag_on_mouse.png")); dragCursorMouseClicked = toolkit.createCustomCursor(image2, new Point(0, 0), "Drag_on_mouse"); Image image3 = toolkit.getImage(toolbarRes.getResource("zoom_mouse.png")); navCursor = toolkit.createCustomCursor(image3, new Point(0, 0), "Zoom"); Image image4 = toolkit.getImage(toolbarRes.getResource("zoom_on_mouse.png")); navCursorMouseClicked = toolkit.createCustomCursor(image4, new Point(0, 0), "Zoom_on_mouse"); highlightIcon = EPDShore.res().getCachedImageIcon("images/ais/highlight.png"); Resources vesselRes = EPDShore.res().folder("images/vesselIcons"); vesselWhite = vesselRes.getCachedImageIcon("white1_90.png"); vesselBlue = vesselRes.getCachedImageIcon("blue1_90.png"); vesselLightgreen = vesselRes.getCachedImageIcon("lightgreen1_90.png"); vesselCyan = vesselRes.getCachedImageIcon("cyan1_90.png"); vesselRed = vesselRes.getCachedImageIcon("red1_90.png"); vesselWhite0 = vesselRes.getCachedImageIcon("white0.png"); vesselBrown = vesselRes.getCachedImageIcon("brown1_90.png"); vesselMagenta = vesselRes.getCachedImageIcon("magenta1_90.png"); vesselLightgray = vesselRes.getCachedImageIcon("lightgray1_90.png"); }
/** * Constructor for setting up the status area * * @param mainFrame reference to the mainframe */ public StatusArea(MainFrame mainFrame) { // Setup location this.setLocation(10 + moveHandlerHeight, 80 + mainFrame.getToolbar().getHeight()); this.setVisible(true); this.setResizable(false); // Strip off window looks setRootPaneCheckingEnabled(false); ((javax.swing.plaf.basic.BasicInternalFrameUI) this.getUI()).setNorthPane(null); this.setBorder(null); // Create the top movehandler (for dragging) moveHandler = new JPanel(new BorderLayout()); moveHandler.add(new JLabel("Status", SwingConstants.CENTER), BorderLayout.CENTER); moveHandler.setForeground(new Color(200, 200, 200)); moveHandler.setOpaque(true); moveHandler.setBackground(Color.DARK_GRAY); moveHandler.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(30, 30, 30))); moveHandler.setFont(new Font("Arial", Font.BOLD, 9)); moveHandler.setPreferredSize(new Dimension(statusItemWidth, moveHandlerHeight)); ToolbarMoveMouseListener mml = new ToolbarMoveMouseListener(this, mainFrame); moveHandler.addMouseListener(mml); moveHandler.addMouseMotionListener(mml); JLabel close = new JLabel(EPDShore.res().getCachedImageIcon("images/window/close.png")); close.addMouseListener( new MouseAdapter() { public void mouseReleased(MouseEvent e) { setVisible(false); } }); close.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); moveHandler.add(close, BorderLayout.EAST); // Create the grid for the status items statusPanel = new JPanel(); statusPanel.setLayout(new GridLayout(0, 1)); statusPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 0)); statusPanel.setBackground(new Color(83, 83, 83)); // Add status items here // Status: X coordinate statusItems.put("LAT", new JLabel(" LAT: N/A")); // Status: Y coordinate statusItems.put("LON", new JLabel(" LON: N/A")); // Create the grid for the highlighted ship info area highlightPanel = new JPanel(); highlightPanel.setLayout(new GridLayout(0, 1)); highlightPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 0)); highlightPanel.setBackground(new Color(83, 83, 83)); // Create the masterpanel for aligning masterPanel = new JPanel(new BorderLayout()); masterPanel.add(moveHandler, BorderLayout.NORTH); masterPanel.add(statusPanel, BorderLayout.CENTER); masterPanel.add(highlightPanel, BorderLayout.SOUTH); masterPanel.setBorder( BorderFactory.createEtchedBorder( EtchedBorder.LOWERED, new Color(30, 30, 30), new Color(45, 45, 45))); this.getContentPane().add(masterPanel); // And finally refresh the status bar repaintToolbar(); }