jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaBorder.java
changeset 28981 3099f6f8254e
parent 25859 3317bb8137f4
equal deleted inserted replaced
28980:956d72dffed1 28981:3099f6f8254e
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 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
    66     protected void setSize(final Size size) {
    66     protected void setSize(final Size size) {
    67         sizeVariant = sizeDescriptor.get(size);
    67         sizeVariant = sizeDescriptor.get(size);
    68         painter.state.set(size);
    68         painter.state.set(size);
    69     }
    69     }
    70 
    70 
       
    71     @Override
    71     public Insets getBorderInsets(final Component c) {
    72     public Insets getBorderInsets(final Component c) {
    72         return sizeVariant.margins;
    73         return (Insets) sizeVariant.margins.clone();
    73     }
    74     }
    74 
    75 
    75     protected AquaBorder deriveBorderForSize(final Size size) {
    76     protected AquaBorder deriveBorderForSize(final Size size) {
    76         try {
    77         try {
    77             final Class<? extends AquaBorder> clazz = getClass();
    78             final Class<? extends AquaBorder> clazz = getClass();
   128         }
   129         }
   129 
   130 
   130         return (focusable != null && focusable instanceof JComponent && ((JComponent)focusable).hasFocus());
   131         return (focusable != null && focusable instanceof JComponent && ((JComponent)focusable).hasFocus());
   131     }
   132     }
   132 
   133 
       
   134     @Override
   133     public boolean isBorderOpaque() { return false; }
   135     public boolean isBorderOpaque() { return false; }
   134 
   136 
       
   137     @Override
   135     public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int w, final int h) {
   138     public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int w, final int h) {
   136         painter.paint(g, c, x, y, w, h);
   139         painter.paint(g, c, x, y, w, h);
   137     }
   140     }
   138 
   141 
   139     static class Default extends AquaBorder {
   142     static class Default extends AquaBorder {