Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
VerticalTabbedPaneUI.java
1 
16 package net.squiz.matrix.plaf;
17 
18 import java.awt.*;
19 import javax.swing.plaf.basic.*;
20 
25 public class VerticalTabbedPaneUI extends BasicTabbedPaneUI {
26  private boolean tabsVertical;
27 
28  public VerticalTabbedPaneUI(boolean tabsVertical) {
29  this.tabsVertical = tabsVertical;
30  }
31 
32  protected void installDefaults() {
33  super.installDefaults();
34  if (tabsVertical) {
35  // All tab padding
36  // Insets(left, top, right, bottom)
37  tabAreaInsets = new Insets(2, 2, 0, 0);
38 
39  // Individual tab properties
40  // Insets(width from left, height top , width from right, height from bottom)
41  tabInsets = new Insets(0, 0, 0, 0);
42 
43  // Tab content panel insets
44  // Insets(top, left, bottom, right)
45  contentBorderInsets = new Insets(0, 0, 0, 0);
46 
47  // Selected tab insets
48  // Insets(height, width, height, width)
49  selectedTabPadInsets = new Insets(2, 0, 1, 1);
50  }
51  }
52 
53  protected void paintFocusIndicator(Graphics g,
54  int tabPlacement,
55  Rectangle[] rects,
56  int tabIndex,
57  Rectangle iconRect,
58  Rectangle textRect,
59  boolean isSelected) {
60 
61  // Do nothing
62  }
63 
64  protected void paintTabBorder(Graphics g,
65  int tabPlacement,
66  int tabIndex,
67  int x,
68  int y,
69  int w,
70  int h,
71  boolean isSelected) {
72 
73  if (!isSelected && tabsVertical) {
74  g.setColor(MatrixLookAndFeel.PANEL_BORDER_COLOUR.darker());
75  int right_x = x + w - 1;
76  g.drawLine(right_x, y, right_x, y+h);
77  }
78 
79  super.paintTabBorder(g, tabPlacement, tabIndex, x, y, w, h, isSelected);
80  }
81 
82 }