/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.jtattoo.plaf;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import javax.swing.text.View;
import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.util.Vector;
import java.util.Hashtable;
/**
* This class is a modified copy of the javax.swing.plaf.basic.BasicTabbedPaneUI
*
* A Basic L&F implementation of TabbedPaneUI.
*
* @version 1.87 06/08/99
* @author Amy Fowler
* @author Philip Milne
* @author Steve Wilson
* @author Tom Santos
* @author Dave Moore
* @author Michael Hagen
*/
public class BaseTabbedPaneUI extends TabbedPaneUI implements SwingConstants {
protected static final Insets NULL_BORDER_INSETS = new Insets(0, 0, 0, 0);
protected static final int GAP = 5;
// Instance variables initialized at installation
protected JTabbedPane tabPane;
protected Color tabAreaBackground;
protected Color selectedColor;
protected int textIconGap;
protected int tabRunOverlay;
protected Insets tabInsets;
protected Insets selectedTabPadInsets;
protected Insets tabAreaInsets;
protected Insets contentBorderInsets;
// Transient variables (recalculated each time TabbedPane is layed out)
protected int tabRuns[] = new int[10];
protected int runCount = 0;
protected int selectedRun = -1;
protected Rectangle rects[] = new Rectangle[0];
protected int maxTabHeight;
protected int maxTabWidth;
// Listeners
protected ChangeListener tabChangeListener;
protected PropertyChangeListener propertyChangeListener;
protected MouseListener mouseListener;
protected MouseMotionListener mouseMotionListener;
protected FocusListener focusListener;
// PENDING(api): See comment for ContainerHandler
private ContainerListener containerListener;
// Private instance data
private Insets currentPadInsets = new Insets(0, 0, 0, 0);
private Insets currentTabAreaInsets = new Insets(0, 0, 0, 0);
private Component visibleComponent;
// PENDING(api): See comment for ContainerHandler
private Vector htmlViews;
private Hashtable mnemonicToIndexMap;
/**
* InputMap used for mnemonics. Only non-null if the JTabbedPane has
* mnemonics associated with it. Lazily created in initMnemonics.
*/
private InputMap mnemonicInputMap;
// For use when tabLayoutPolicy = SCROLL_TAB_LAYOUT
private ScrollableTabSupport tabScroller;
private TabContainer tabContainer;
/**
* A rectangle used for general layout calculations in order
* to avoid constructing many new Rectangles on the fly.
*/
protected transient Rectangle calcRect = new Rectangle(0, 0, 0, 0);
/**
* Number of tabs. When the count differs, the mnemonics are updated.
*/
// PENDING: This wouldn't be necessary if JTabbedPane had a better
// way of notifying listeners when the count changed.
private int tabCount;
protected int oldRolloverIndex = -1;
protected int rolloverIndex = -1;
protected boolean roundedTabs = true;
protected boolean simpleButtonBorder = false;
// private static PrintStream outStream = null;
// static {
// try {
// outStream = new PrintStream(new File("c:/temp/BaseTabbedPaneExceptions.txt"));
// outStream.print("----------------------------------------------------\n");
// outStream.print("Start: " + new Date() + "\n");
// outStream.print("----------------------------------------------------\n");
// }
// catch (Exception ex) {
//
// }
// }
public static ComponentUI createUI(JComponent c) {
return new BaseTabbedPaneUI();
}
// UI Installation/De-installation
public void installUI(JComponent c) {
this.tabPane = (JTabbedPane) c;
c.setLayout(createLayoutManager());
installComponents();
installDefaults();
installListeners();
installKeyboardActions();
}
public void uninstallUI(JComponent c) {
uninstallKeyboardActions();
uninstallListeners();
uninstallDefaults();
uninstallComponents();
c.setLayout(null);
this.tabPane = null;
}
/**
* Invoked by <code>installUI</code> to create
* a layout manager object to manage
* the <code>JTabbedPane</code>.
*
* @return a layout manager object
*
* @see TabbedPaneLayout
* @see javax.swing.JTabbedPane#getTabLayoutPolicy
*/
protected LayoutManager createLayoutManager() {
if (JTattooUtilities.getJavaVersion() >= 1.4) {
if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) {
return new TabbedPaneScrollLayout();
}
}
/* WRAP_TAB_LAYOUT */
return new TabbedPaneLayout();
}
/* In an attempt to preserve backward compatibility for programs
* which have extended BaseTabbedPaneUI to do their own layout, the
* UI uses the installed layoutManager (and not tabLayoutPolicy) to
* determine if scrollTabLayout is enabled.
*/
protected boolean scrollableTabLayoutEnabled() {
return (tabPane.getLayout() instanceof TabbedPaneScrollLayout);
}
/**
* Creates and installs any required subcomponents for the JTabbedPane.
* Invoked by installUI.
*
* @since 1.4
*/
protected void installComponents() {
if (scrollableTabLayoutEnabled()) {
if (tabScroller == null) {
tabScroller = new ScrollableTabSupport(tabPane.getTabPlacement());
tabPane.add(tabScroller.viewport);
tabPane.add(tabScroller.scrollForwardButton);
tabPane.add(tabScroller.scrollBackwardButton);
tabPane.add(tabScroller.popupMenuButton);
tabScroller.tabPanel.setBackground(tabAreaBackground);
}
}
installTabContainer();
}
private void installTabContainer() {
if (JTattooUtilities.getJavaVersion() >= 1.6) {
for (int i = 0; i < tabPane.getTabCount(); i++) {
Component tabComponent = tabPane.getTabComponentAt(i);
if (tabComponent != null) {
if (tabContainer == null) {
tabContainer = new TabContainer();
}
tabContainer.add(tabComponent);
}
}
if (tabContainer == null) {
return;
}
if (scrollableTabLayoutEnabled()) {
tabScroller.tabPanel.add(tabContainer);
} else {
tabPane.add(tabContainer);
}
}
}
/**
* Removes any installed subcomponents from the JTabbedPane.
* Invoked by uninstallUI.
*
* @since 1.4
*/
protected void uninstallComponents() {
uninstallTabContainer();
if (scrollableTabLayoutEnabled()) {
tabPane.remove(tabScroller.viewport);
tabPane.remove(tabScroller.scrollForwardButton);
tabPane.remove(tabScroller.scrollBackwardButton);
tabPane.remove(tabScroller.popupMenuButton);
tabScroller = null;
}
}
private void uninstallTabContainer() {
if (JTattooUtilities.getJavaVersion() >= 1.6) {
if (tabContainer == null) {
return;
}
// Remove all the tabComponents, making sure not to notify the tabbedpane.
tabContainer.notifyTabbedPane = false;
tabContainer.removeAll();
if (scrollableTabLayoutEnabled()) {
tabScroller.tabPanel.remove(tabContainer);
} else {
tabPane.remove(tabC
没有合适的资源?快使用搜索试试~ 我知道了~
JTattooSource.zip_Swing皮肤_java 皮肤_jtattoo.jar_netbeans project
共420个文件
java:289个
gif:126个
jpg:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 41 浏览量
2022-09-21
07:14:45
上传
评论
收藏 401KB ZIP 举报
温馨提示
改变你的swing程序皮肤的最简单的方法,将JTattoo.jar添加到classpath中(如果用eclipse或NetBeans则导入到工程使用的库中)
资源推荐
资源详情
资源评论
收起资源包目录
JTattooSource.zip_Swing皮肤_java 皮肤_jtattoo.jar_netbeans project (420个子文件)
Resizing.gif 2KB
Error.gif 1KB
Error.gif 1KB
Warning.gif 1KB
Question.gif 1KB
Warning.gif 1KB
Inform.gif 1KB
radio.gif 1KB
radio_rollover_selected.gif 1KB
radio_selected.gif 1KB
radio_rollover.gif 1KB
pearl_green.gif 1KB
pearl_red.gif 1KB
pearl_orange.gif 1KB
iconizer.gif 1KB
radio_disabled_selected.gif 1KB
closer.gif 1KB
radio_disabled.gif 1KB
pearl_blue.gif 1KB
maximizer.gif 1KB
pearl_white.gif 1KB
iconizer_inactive.gif 1KB
minimizer.gif 1KB
closer_inactive.gif 1KB
maximizer_inactive.gif 1KB
minimizer_inactive.gif 1KB
thumb_ver_rollover.gif 969B
thumb_hor_rollover.gif 963B
thumb_hor_rollover.gif 962B
thumb_ver.gif 961B
thumb_ver_rollover.gif 960B
thumb_hor.gif 960B
thumb_hor.gif 960B
thumb_ver.gif 959B
thumb_ver.gif 959B
thumb_hor.gif 958B
thumb_hor.gif 958B
thumb_hor_rollover.gif 958B
thumb_ver_rollover.gif 957B
NewFolder.gif 954B
thumb_ver.gif 952B
TreeOpenButton.gif 951B
thumb_hor_rollover.gif 950B
TreeClosedButton.gif 948B
thumb_ver_rollover.gif 947B
check_rollover_selected.gif 945B
check_disabled_selected.gif 945B
check_selected.gif 943B
check_pressed.gif 942B
check.gif 936B
check_rollover.gif 933B
check_disabled.gif 932B
UpFolder.gif 931B
Home.gif 929B
HomeFolder.gif 929B
Directory.gif 926B
TreeOpen.gif 926B
TreeClosed.gif 926B
Question.gif 918B
TreeLeaf.gif 902B
JavaCup.gif 899B
RadioSymbolDisabled.gif 884B
RadioSymbol.gif 884B
Inform.gif 884B
RadioSymbol.gif 879B
ListView.gif 877B
DetailsView.gif 869B
SplitterVerBumps.gif 868B
SplitterHorBumps.gif 866B
SplitterVerBumps.gif 860B
CheckSymbolDisabled.gif 860B
CheckSymbol.gif 860B
TreeClosedButton.gif 859B
SplitterHorBumps.gif 858B
CheckSymbol.gif 857B
TreeOpenButton.gif 856B
TreeClosedButton.gif 851B
CheckSymbol.gif 850B
TreeOpenButton.gif 845B
RadioSymbol.gif 840B
CheckSymbolDisabled.gif 839B
CheckPressedSymbol.gif 839B
CheckSymbol.gif 839B
CheckPressedSymbol.gif 839B
CheckPressedSymbol.gif 839B
CheckPressedSymbol.gif 839B
RadioSymbolDisabled.gif 834B
DownArrow.gif 833B
RightArrow.gif 833B
DownArrow.gif 833B
RightArrow.gif 833B
RightArrow.gif 833B
DownArrow.gif 833B
RadioSymbol.gif 833B
SplitterHorBumpsSmall.gif 832B
SplitterVerBumpsSmall.gif 832B
LeftArrow.gif 832B
LeftArrow.gif 832B
LeftArrow.gif 832B
RightArrow.gif 831B
共 420 条
- 1
- 2
- 3
- 4
- 5
资源评论
alvarocfc
- 粉丝: 105
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功