2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.ui
;
18 import com
.intellij
.util
.ui
.UIUtil
;
21 import javax
.swing
.border
.Border
;
24 public class EdgeBorder
implements Border
{
25 public static final int EDGE_RIGHT
= 61440;
26 public static final int EDGE_BOTTOM
= 3840;
27 public static final int EDGE_LEFT
= 240;
28 public static final int EDGE_TOP
= 15;
29 public static final int EDGE_ALL
= 65535;
30 private final Insets myInsets
;
33 public EdgeBorder(int i
) {
34 myInsets
= new Insets(2, 2, 2, 2);
39 public boolean isBorderOpaque() {
43 public Insets
getBorderInsets(Component component
) {
47 public void paintBorder(Component component
, Graphics g
, int x
, int y
, int width
, int height
) {
48 java
.awt
.Color color
= UIUtil
.getSeparatorShadow();
49 java
.awt
.Color color1
= UIUtil
.getSeparatorHighlight();
50 java
.awt
.Color color2
= g
.getColor();
53 UIUtil
.drawLine(g
, x
, y
, (x
+ width
) - 1, y
);
55 UIUtil
.drawLine(g
, x
, y
+ 1, (x
+ width
) - 1, y
+ 1);
59 UIUtil
.drawLine(g
, x
, y
, x
, (y
+ height
) - 1);
61 UIUtil
.drawLine(g
, x
+ 1, y
, x
+ 1, (y
+ height
) - 1);
63 if ((b
& 0xf00) != 0){
65 UIUtil
.drawLine(g
, x
, (y
+ height
) - 2, (x
+ width
) - 1, (y
+ height
) - 2);
67 UIUtil
.drawLine(g
, x
, (y
+ height
) - 1, (x
+ width
) - 1, (y
+ height
) - 1);
69 if ((b
& 0xf000) != 0){
71 UIUtil
.drawLine(g
, (x
+ width
) + 1, y
, (x
+ width
) + 1, (y
+ height
) - 1);
73 UIUtil
.drawLine(g
, (x
+ width
), y
, (x
+ width
), (y
+ height
) - 1);
78 protected void recalcInsets() {
79 myInsets
.top
= (b
& 0xf) == 0 ?
0 : 2;
80 myInsets
.left
= (b
& 0xf0) == 0 ?
0 : 2;
81 myInsets
.bottom
= (b
& 0xf00) == 0 ?
0 : 2;
82 myInsets
.right
= (b
& 0xf000) == 0 ?
0 : 2;