jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicBorders.java
changeset 29507 f16389ada5f3
parent 25859 3317bb8137f4
equal deleted inserted replaced
29506:a7367abd4c4c 29507:f16389ada5f3
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2015, 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
    35 import java.awt.Dimension;
    35 import java.awt.Dimension;
    36 import java.awt.Rectangle;
    36 import java.awt.Rectangle;
    37 import java.awt.Color;
    37 import java.awt.Color;
    38 import java.awt.Graphics;
    38 import java.awt.Graphics;
    39 
    39 
       
    40 import sun.swing.SwingUtilities2;
       
    41 
    40 /**
    42 /**
    41  * Factory object that can vend Borders appropriate for the basic L & F.
    43  * Factory object that can vend Borders appropriate for the basic L & F.
    42  * @author Georges Saab
    44  * @author Georges Saab
    43  * @author Amy Fowler
    45  * @author Amy Fowler
    44  */
    46  */
   451 
   453 
   452         public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
   454         public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
   453             Color oldColor = g.getColor();
   455             Color oldColor = g.getColor();
   454             g.translate(x, y);
   456             g.translate(x, y);
   455             g.setColor(shadow);
   457             g.setColor(shadow);
   456             g.drawLine(0, height-2, width, height-2);
   458             SwingUtilities2.drawHLine(g, 0, width - 1, height - 2);
   457             g.setColor(highlight);
   459             g.setColor(highlight);
   458             g.drawLine(0, height-1, width, height-1);
   460             SwingUtilities2.drawHLine(g, 0, width - 1, height - 1);
   459             g.translate(-x,-y);
   461             g.translate(-x, -y);
   460             g.setColor(oldColor);
   462             g.setColor(oldColor);
   461         }
   463         }
   462 
   464 
   463         public Insets getBorderInsets(Component c, Insets insets)       {
   465         public Insets getBorderInsets(Component c, Insets insets)       {
   464             insets.set(0, 0, 2, 0);
   466             insets.set(0, 0, 2, 0);