/* * [USB2aFemaleVertical.java] * * Summary: draw female USB2a connector vertically. * * Copyright: (c) 2011-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2011-01-29 initial version. */ package com.mindprod.connectors; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; /** * draw female USB2a connector vertically. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2011-01-29 initial version. * @since 2011-01-29 */ class USB2aFemaleVertical extends ConnectorPanel { private static final int DOT_UNIT = 70; private static final int THICK_UNIT = 150; private static final int THIN_UNIT = 50; USB2aFemaleVertical() { super( 600, 1000 ); } /** * common code to draw various female USB connectors * * @param g2d Graphics object to draw on * @param plasticBarColor What colour to make the plastic bar white=usb3 blue=usb3 */ static void drawUSBFemale( final Graphics2D g2d, final Color plasticBarColor ) { final int yCenter = 500; final int yBottom = 1000; // outline g2d.setColor( OUTLINE_COLOR ); int x = 0; int y = 0; int width = THICK_UNIT * 2 + THIN_UNIT * 3; int height = yBottom; g2d.fillRect( x, y, width, height ); final int barHeight = yBottom - 2 * 50; // while plastic bar g2d.setColor( plasticBarColor ); x = THIN_UNIT; y = THIN_UNIT; width = THICK_UNIT; height = barHeight; g2d.fillRect( x, y, width, height ); // hole next to plastic bar g2d.setColor( HOLE_COLOR ); x = THIN_UNIT * 2 + THICK_UNIT; y = THIN_UNIT; width = THICK_UNIT; height = barHeight; g2d.fillRect( x, y, width, height ); // red dot g2d.setColor( Color.RED ); x = THICK_UNIT * 2 + THIN_UNIT * 5 - DOT_UNIT / 2; y = yCenter - DOT_UNIT / 2; width = DOT_UNIT; height = DOT_UNIT; g2d.fillOval( x, y, width, height ); } /** * draw a USB2-B female connector in the vertical position * * @param g where to paint */ public void paintComponent( Graphics g ) { super.paintComponent( g ); drawUSBFemale( ( Graphics2D ) g, Color.WHITE ); } }