Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4252164

Rounded Line Borders Don't Render Properly (fix included)

    Details

    • Subcomponent:
    • Resolved In Build:
      b15
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      Name: sg39081 Date: 07/07/99


      The Swing LineBorder doesn't draw rounded borders properly.
      The following change fixes the problem:

      In javax.swing.border.LineBorder.java in paintBorder(), replace:

        for(i = 0; i < thickness; i++) {
          if(!roundedCorners)
            g.drawRect(x+i, y+i, width-i-i-1, height-i-i-1);
          else
            g.drawRoundRect(x+i, y+i, width-i-i-1, height-i-i-1, thickness, thickness);
        }

      with

        if(!roundedCorners) {
          for(i = 0; i < thickness; i++) {
            g.drawRect(x+i, y+i, width-i-i-1, height-i-i-1);
          }
        } else {
          g.fillRoundRect(x,y,width,thickness,thickness,thickness);
          g.fillRoundRect(x,y+height-thickness,width,thickness,thickness,thickness);
          g.fillRoundRect(x,y,thickness,height,thickness,thickness);
          g.fillRoundRect(x+width-thickness,y,thickness,height,thickness,thickness);

        }
      (Review ID: 55026)
      ======================================================================

      Name: apC97674 Date: 11/04/99


      ----------------Test------------------------------
      import javax.swing.*;
      import javax.swing.border.*;
      import java.awt.*;

      public class bug4252164 extends JFrame {
          
          public static void main(String[] args) {
      JFrame jf = new JFrame("Focus Test");
      jf.getContentPane().setLayout(new FlowLayout());

      LineBorder brdr = new LineBorder(Color.blue, 7, true);
      JButton bt = new JButton("Do Nothing");
      bt.setBorder(brdr);

      jf.getContentPane().add(bt);
      jf.setSize(200,200);
      jf.setVisible(true);
          }
      }
      -------------------------------------------------------
      ###@###.###
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                malenkov Sergey Malenkov (Inactive)
                Reporter:
                sgoodsunw Sheri Good (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: