⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oyoahatabbedpaneui.java

📁 java 开源,Swing外观:JGoodies look & feel. ... JGoodies look&feels让你的Swing 应用程序与applets看起来更漂亮.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
      //left      g.drawLine(x,y,x,y+(h-1));      //bottom      g.drawLine(x,y+(h-1),x+w,y+(h-1));    }  }  protected void paintRightTabBorder( int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)  {    int currentRun = getRunForTab( tabPane.getTabCount(), tabIndex );    int lastIndex = lastTabInRun( tabPane.getTabCount(), currentRun );    int firstIndex = tabRuns[ currentRun ];    OyoahaThemeScheme scheme = OyoahaUtilities.getScheme();    Color color = (tabPane.isEnabled())? scheme.getBlack() : scheme.getGray();    if(isSelected)    {      //top      g.setColor(scheme.getWhite());      g.drawLine(x-2,y-1,x+w,y-1);      g.setColor(color);      g.drawLine(x-2,y,x+w,y);      //right      g.setColor(color);      g.drawLine(x+w,y+1,x+w,y+h);      g.setColor(scheme.getGray());      g.drawLine(x+w+1,y-1,x+w+1,y+h);      //bottom      g.setColor(color);      g.drawLine(x-2,y+h,x+w,y+h);      g.setColor(scheme.getGray());      g.drawLine(x-2,y+h+1,x+w+1,y+h+1);    }    else    {      g.setColor(scheme.getGray());      //top      g.drawLine(x,y,x+w-1,y);      //bottom      g.drawLine(x,y+h,x+w-1,y+h);      //right      g.drawLine(x+w-1,y,x+w-1,y+h);    }  }  protected void paintLeftTabBorder( int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)  {    int currentRun = getRunForTab( tabPane.getTabCount(), tabIndex );    int lastIndex = lastTabInRun( tabPane.getTabCount(), currentRun );    int firstIndex = tabRuns[ currentRun ];    OyoahaThemeScheme scheme = OyoahaUtilities.getScheme();    Color color = (tabPane.isEnabled())? scheme.getBlack() : scheme.getGray();    if(isSelected)    {      //top      g.setColor(scheme.getWhite());      g.drawLine(x-1,y-1,x+w,y-1);      g.setColor(color);      g.drawLine(x,y,x+w,y);      //bottom      g.setColor(color);      g.drawLine(x,y+h,x+w,y+h);      g.setColor(scheme.getGray());      g.drawLine(x-1,y+h+1,x+w-1,y+h+1);      //left      g.setColor(scheme.getWhite());      g.drawLine(x-1,y-1,x-1,y+h);      g.setColor(color);      g.drawLine(x,y,x,y+h);    }    else    {      g.setColor(scheme.getGray());      //top      g.drawLine(x+1,y,x+w,y);      //bottom      g.drawLine(x+1,y+h,x+w,y+h);      //left      g.drawLine(x+1,y,x+1,y+h);    }  }*/  protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)  {    if(tabPane.hasFocus() && isSelected)    {      paintFocus(g, tabPane.getTitleAt(tabIndex), (getIconForTab(tabIndex)!=null)? true : false, rects[tabIndex], textRect, iconRect);            /*Rectangle tabRect = rects[tabIndex];      g.setColor(OyoahaUtilities.getColorFromScheme(OyoahaUtilities.FOCUS));      switch(tabPlacement)      {        case RIGHT:        g.drawLine(tabRect.x-2, tabRect.y+1, tabRect.x+tabRect.width-2, tabRect.y+1);        g.drawLine(tabRect.x+tabRect.width-1, tabRect.y+1, tabRect.x+tabRect.width-1, tabRect.y+tabRect.height-1);        g.drawLine(tabRect.x-2, tabRect.y+tabRect.height-1, tabRect.x+tabRect.width-2, tabRect.y+tabRect.height-1);        break;        case BOTTOM:        g.drawLine(tabRect.x+2, tabRect.y-2, tabRect.x+2, tabRect.y+tabRect.height-1);        g.drawLine(tabRect.x+2, tabRect.y+tabRect.height-1, tabRect.x+tabRect.width-2, tabRect.y+tabRect.height-1);        g.drawLine(tabRect.x+tabRect.width-2, tabRect.y-2, tabRect.x+tabRect.width-2, tabRect.y+tabRect.height-1);        break;        case TOP:        g.drawLine(tabRect.x+1, tabRect.y+1, tabRect.x+1, tabRect.y+tabRect.height);        g.drawLine(tabRect.x+2, tabRect.y+1, tabRect.x+tabRect.width-2, tabRect.y+1);        g.drawLine(tabRect.x+tabRect.width-2, tabRect.y+1, tabRect.x+tabRect.width-2, tabRect.y+tabRect.height);        break;        case LEFT:        g.drawLine(tabRect.x+2, tabRect.y+1, tabRect.x+tabRect.width, tabRect.y+1);        g.drawLine(tabRect.x+1, tabRect.y+1, tabRect.x+1, tabRect.y+tabRect.height-1);        g.drawLine(tabRect.x+2, tabRect.y+tabRect.height-1, tabRect.x+tabRect.width, tabRect.y+tabRect.height-1);      }*/                }  }    protected void paintFocus(Graphics g, String text, boolean isIcon, Rectangle viewRect, Rectangle textRect, Rectangle iconRect)  {    Rectangle focusRect = new Rectangle();    if (text!=null)    {        String t = text.toLowerCase();        t = t.trim();                //workaround the textRect if wrong with HTML component        //this workaround just doesn't paint the focus in this case        if (t.startsWith("<html>") && t.endsWith("</html>"))        {            return;        }    }        if(text!=null && !text.equals(""))    {      if (!isIcon)      {        focusRect.setBounds(textRect);      }      else      {        focusRect.setBounds(iconRect.union(textRect));      }    }    else    if(isIcon)    {      focusRect.setBounds(iconRect);    }    else    {      focusRect.setBounds(viewRect);    }    g.setColor(OyoahaUtilities.getColorFromScheme(OyoahaUtilities.FOCUS));    int h = focusRect.y+focusRect.height-1;    g.drawLine(focusRect.x, focusRect.y, focusRect.x+focusRect.width-1, focusRect.y);    g.drawLine(focusRect.x, h, focusRect.x+focusRect.width-1, h);  }  //paint the gap...  /*protected void paintContentBorderTopEdge( Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h )  {    OyoahaThemeScheme scheme = OyoahaUtilities.getScheme();    if (tabPlacement != TOP || selectedIndex < 0 || (rects[selectedIndex].y + rects[selectedIndex].height + 1 < y))    {      g.setColor(scheme.getWhite());      g.drawLine(x, y, x+w-1, y);    }    else    {      Rectangle selRect = rects[selectedIndex];      g.setColor(scheme.getWhite());      g.drawLine(x, y, selRect.x, y);      if(selRect.x+selRect.width<x+w-1)      {        g.setColor(scheme.getWhite());        g.drawLine(selRect.x + selRect.width, y, x+w-1, y);      }      else      {        g.setColor(scheme.getWhite());        g.drawLine(x+w-1, y, x+w-1, y);      }    }  }*/  /*protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)  {    OyoahaThemeScheme scheme = OyoahaUtilities.getScheme();    if (tabPlacement != BOTTOM || selectedIndex < 0 || (rects[selectedIndex].y - 1 > h))    {      g.setColor(scheme.getBlack());      g.drawLine(x, y+h-2, x+w-1, y+h-2);      g.setColor(scheme.getGray());      g.drawLine(x, y+h-1, x+w-1, y+h-1);    }    else    {      Rectangle selRect = rects[selectedIndex];      g.setColor(scheme.getBlack());      g.drawLine(x, y+h-2, selRect.x, y+h-2);      g.setColor(scheme.getGray());      g.drawLine(x, y+h-1, selRect.x, y+h-1);      if (selRect.x+selRect.width<x+w-1)      {        g.setColor(scheme.getBlack());        g.drawLine(selRect.x+selRect.width, y+h-2, x+w-1, y+h-2);        g.setColor(scheme.getGray());        g.drawLine(selRect.x+selRect.width, y+h-1, x+w-1, y+h-1);      }      else      {        g.setColor(scheme.getBlack());        g.drawLine(x+w-1, y+h-2, x+w-1, y+h-2);        g.setColor(scheme.getGray());        g.drawLine(x+w-1, y+h-1, x+w-1, y+h-1);      }    }  }*/  /*protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)  {    OyoahaThemeScheme scheme = OyoahaUtilities.getScheme();    if (tabPlacement != LEFT || selectedIndex < 0 || (rects[selectedIndex].x + rects[selectedIndex].width + 1< x))    {      g.setColor(scheme.getWhite());      g.drawLine(x, y, x, y+h-2);    }    else    {      Rectangle selRect = rects[selectedIndex];      g.setColor(scheme.getWhite());      g.drawLine(x, y, x, selRect.y-1);      if(selRect.y+selRect.height<y+h-2)      {        g.drawLine(x, selRect.y+selRect.height+1, x, y+h-2);      }      else      {        g.drawLine(x, y+h-2, x, y+h-2);      }    }  }*/  /*protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)  {    OyoahaThemeScheme scheme = OyoahaUtilities.getScheme();    if (tabPlacement != RIGHT || selectedIndex < 0 || rects[selectedIndex].x - 1 > w)    {      g.setColor(scheme.getBlack());      g.drawLine(x+w-2, y+1, x+w-2, y+h-2);      g.setColor(scheme.getGray());      g.drawLine(x+w-1, y, x+w-1, y+h-2);    }    else    {      Rectangle selRect = rects[selectedIndex];      g.setColor(scheme.getBlack());      g.drawLine(x+w-2, y+1, x+w-2, selRect.y-1);      g.setColor(scheme.getGray());      g.drawLine(x+w-1, y, x+w-1, selRect.y-2);      if (selRect.y + selRect.height < y + h - 2)      {        g.setColor(scheme.getBlack());        g.drawLine(x+w-2, selRect.y+selRect.height+1, x+w-2, y+h-2);        g.setColor(scheme.getGray());        g.drawLine(x+w-1, selRect.y+selRect.height+1, x+w-1, y+h-2);      }      else      {        g.setColor(scheme.getBlack());        g.drawLine(x+w-2, y+h-2, x+w-2, y+h-2);        g.setColor(scheme.getGray());        g.drawLine(x+w-1, y+h-2, x+w-1, y+h-2);      }    }  }*/    protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected)   {    if (tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex))    {        super.paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected);    }    else    {        String t = title.toLowerCase();        t = t.trim();                if (t.startsWith("<html>") && t.endsWith("</html>"))        {            super.paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected);        }        else        {            g.setFont(font);                        Color c = tabPane.getBackgroundAt(tabIndex);                        if(!isSelected && c instanceof UIResource)            g.setColor(c);            else            g.setColor(c.darker());                	        g.drawString(title,textRect.x,textRect.y + metrics.getAscent());        }    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -