Java Code Examples for java.awt.Graphics#fill3DRect()
The following examples show how to use
java.awt.Graphics#fill3DRect() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: mxConnectionHandler.java From blog-codes with Apache License 2.0 | 6 votes |
/** * */ public void paint(Graphics g) { if (bounds != null) { if (connectIcon != null) { g.drawImage(connectIcon.getImage(), bounds.x, bounds.y, bounds.width, bounds.height, null); } else if (handleEnabled) { g.setColor(Color.BLACK); g.draw3DRect(bounds.x, bounds.y, bounds.width - 1, bounds.height - 1, true); g.setColor(Color.GREEN); g.fill3DRect(bounds.x + 1, bounds.y + 1, bounds.width - 2, bounds.height - 2, true); g.setColor(Color.BLUE); g.drawRect(bounds.x + bounds.width / 2 - 1, bounds.y + bounds.height / 2 - 1, 1, 1); } } }
Example 2
Source File: MultilayerPerceptron.java From tsml with GNU General Public License v3.0 | 6 votes |
/** * This will draw the node id to the graphics context. * @param g The graphics context. * @param w The width of the drawing area. * @param h The height of the drawing area. */ public void drawNode(Graphics g, int w, int h) { if ((m_type & PURE_INPUT) == PURE_INPUT) { g.setColor(Color.green); } else { g.setColor(Color.orange); } FontMetrics fm = g.getFontMetrics(); int l = (int)(m_x * w) - fm.stringWidth(m_id) / 2; int t = (int)(m_y * h) - fm.getHeight() / 2; g.fill3DRect(l, t, fm.stringWidth(m_id) + 4 , fm.getHeight() + fm.getDescent() + 4 , true); g.setColor(Color.black); g.drawString(m_id, l + 2, t + fm.getHeight() + 2); }
Example 3
Source File: LightweightEventTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void paint(Graphics g) { super.paint(g); Rectangle bounds = getBounds(); if (superIsButton) { return; } Dimension size = getSize(); Color oldColor = g.getColor(); // draw border g.setColor(getBackground()); g.fill3DRect(0, 0, size.width, size.height, false); g.fill3DRect(3, 3, size.width - 6, size.height - 6, true); // draw text FontMetrics metrics = g.getFontMetrics(); int centerX = size.width / 2; int centerY = size.height / 2; int textX = centerX - (metrics.stringWidth(labelString) / 2); int textY = centerY + ((metrics.getMaxAscent() + metrics.getMaxDescent()) / 2); g.setColor(getForeground()); g.drawString(labelString, textX, textY); g.setColor(oldColor); }
Example 4
Source File: ColorSwatchButton.java From Pixelitor with GNU General Public License v3.0 | 5 votes |
@Override protected void paintComponent(Graphics g) { g.setColor(color); g.fill3DRect(0, 0, SIZE, SIZE, raised); if (marked) { g.setColor(LayerButton.SELECTED_COLOR); g.fillRect(1, 1, 7, 7); g.setColor(LayerButton.UNSELECTED_COLOR); g.fillRect(3, 3, 3, 3); } }
Example 5
Source File: Cell.java From JavaExercises with GNU General Public License v2.0 | 4 votes |
void paint(Graphics g, int cellSize, boolean hide) { if (!hide || (hide && color == RED)) { g.setColor(color); g.fill3DRect(x*cellSize + 1, y*cellSize + 1, cellSize - 2, cellSize - 2, true); } }
Example 6
Source File: BundleImageIcon.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void paintIcon(Component c, Graphics g, int x, int y) { updateIcon(); super.paintIcon(c, g, x, y); Icon overlay = null; switch (bundle.getState()) { case Bundle.ACTIVE: overlay = OVERLAY_ACTIVE; break; case Bundle.INSTALLED: overlay = OVERLAY_INSTALLED; break; case Bundle.RESOLVED: overlay = OVERLAY_RESOLVED; break; case Bundle.STARTING: overlay = OVERLAY_STARTING; break; case Bundle.STOPPING: overlay = OVERLAY_STOPPING; break; case Bundle.UNINSTALLED: overlay = OVERLAY_UNINSTALLED; break; default: } if (overlay != null) { final int x1 = x + (getIconWidth() - overlay.getIconWidth()); final int y1 = y + (getIconHeight() - overlay.getIconHeight()); final int w = overlay.getIconWidth(); final int h = overlay.getIconHeight(); g.setColor(Color.white); g.fill3DRect(x1 - 1, y1 - 1, w + 2, h + 2, true); overlay.paintIcon(c, g, x1, y1); } }
Example 7
Source File: ColorPickerPanel.java From netbeans-mmd-plugin with Apache License 2.0 | 4 votes |
@Override public void paintComponent(@Nonnull final Graphics gfx) { gfx.setColor(this.getBackground()); gfx.fill3DRect(0, 0, this.getWidth(), this.getHeight(), true); }
Example 8
Source File: ColorIcon.java From uima-uimaj with Apache License 2.0 | 4 votes |
@Override public void paintIcon(Component arg0, Graphics graphics, int x, int y) { graphics.setColor(this.color); graphics.fill3DRect(x, y, size, size, true); }