equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
335 |
335 |
336 @Override |
336 @Override |
337 public void paintComponent(Graphics g) { |
337 public void paintComponent(Graphics g) { |
338 super.paintComponent(g); |
338 super.paintComponent(g); |
339 |
339 |
|
340 int width = getWidth()-rightMargin-leftMargin-10; |
|
341 int height = getHeight()-topMargin-bottomMargin; |
|
342 if (width <= 0 || height <= 0) { |
|
343 // not enough room to paint anything |
|
344 return; |
|
345 } |
|
346 |
340 Color oldColor = g.getColor(); |
347 Color oldColor = g.getColor(); |
341 Font oldFont = g.getFont(); |
348 Font oldFont = g.getFont(); |
342 Color fg = getForeground(); |
349 Color fg = getForeground(); |
343 Color bg = getBackground(); |
350 Color bg = getBackground(); |
344 boolean bgIsLight = (bg.getRed() > 200 && |
351 boolean bgIsLight = (bg.getRed() > 200 && |