@@ -0,0 +1,1776 @@
+/*%0A * JaamSim Discrete Event Simulation%0A * Copyright (C) 2018 JaamSim Software Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.jaamsim.ui;%0A%0Aimport java.awt.Color;%0Aimport java.awt.Component;%0Aimport java.awt.Graphics;%0Aimport java.awt.Graphics2D;%0A%0Aimport javax.swing.Icon;%0A%0A/**%0A * Displays a rectangular icon for use in the user interface.%0A * @author Harry King%0A *%0A */%0Apublic class ColorIcon implements Icon %7B%0A%0A%09private final int width;%0A%09private final int height;%0A%09private Color fillColor = Color.BLACK;%0A%09private Color outlineColor = Color.BLACK;%0A%0A%09public ColorIcon(int w, int h) %7B%0A%09%09width = w;%0A%09%09height = h;%0A%09%7D%0A%0A%09public void setFillColor(Color col) %7B%0A%09%09fillColor = col;%0A%09%7D%0A%0A%09public void setOutlineColor(Color col) %7B%0A%09%09outlineColor = col;%0A%09%7D%0A%0A%09@Override%0A%09public void paintIcon(Component c, Graphics g, int x, int y) %7B%0A%09%09Graphics2D g2d = (Graphics2D) g.create();%0A%0A%09%09// Fill the rectangle with the selected color%0A%09%09g2d.setColor(fillColor);%0A%09%09g2d.fillRect(x, y, width - 1, height - 1);%0A%0A%09%09// Draw the outline around the rectangle%0A%09%09g2d.setColor(outlineColor);%0A%09%09g2d.drawRect(x, y, width - 1, height - 1);%0A%0A%09%09g2d.dispose();%0A%09%7D%0A%0A%09@Override%0A%09public int getIconWidth() %7B%0A%09%09return width;%0A%09%7D%0A%0A%09@Override%0A%09public int getIconHeight() %7B%0A%09%09return height;%0A%09%7D%0A%0A%7D%0A

add icon that displays a selected colour