1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 */ 16 17 package com.android.hierarchyviewer.laf; 18 19 import javax.swing.border.AbstractBorder; 20 import java.awt.*; 21 22 public class UnifiedContentBorder extends AbstractBorder { 23 private static final Color BORDER_TOP_COLOR1 = new Color(0x575757); 24 private static final Color BORDER_BOTTOM_COLOR1 = new Color(0x404040); 25 private static final Color BORDER_BOTTOM_COLOR2 = new Color(0xd8d8d8); 26 27 @Override paintBorder(Component c, Graphics g, int x, int y, int width, int height)28 public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { 29 g.setColor(BORDER_TOP_COLOR1); 30 g.drawLine(x, y, x + width, y); 31 g.setColor(BORDER_BOTTOM_COLOR1); 32 g.drawLine(x, y + height - 2, x + width, y + height - 2); 33 g.setColor(BORDER_BOTTOM_COLOR2); 34 g.drawLine(x, y + height - 1, x + width, y + height - 1); 35 } 36 37 @Override getBorderInsets(Component component)38 public Insets getBorderInsets(Component component) { 39 return new Insets(1, 0, 2, 0); 40 } 41 42 @Override isBorderOpaque()43 public boolean isBorderOpaque() { 44 return true; 45 } 46 } 47