本文整理汇总了Java中javax.swing.plaf.TabbedPaneUI类的典型用法代码示例。如果您正苦于以下问题:Java TabbedPaneUI类的具体用法?Java TabbedPaneUI怎么用?Java TabbedPaneUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TabbedPaneUI类属于javax.swing.plaf包,在下文中一共展示了TabbedPaneUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: placeFeedback
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
public void placeFeedback(FeedbackLayer feedbackLayer, ComponentDragObject dragObject) {
final String tooltipText = UIDesignerBundle.message("insert.feedback.add.tab", getDisplayName(), myInsertIndex);
if (myInsertIndex < getTabbedPane().getTabCount()) {
feedbackLayer.putFeedback(getDelegee(), myFeedbackRect, VertInsertFeedbackPainter.INSTANCE, tooltipText);
}
else {
Rectangle rcFeedback;
final JTabbedPane tabbedPane = getTabbedPane();
final TabbedPaneUI ui = tabbedPane.getUI();
if (tabbedPane.getTabCount() > 0) {
Rectangle rc = ui.getTabBounds(tabbedPane, tabbedPane.getTabCount()-1);
rcFeedback = new Rectangle(rc.x+rc.width, rc.y, 50, rc.height);
}
else {
// approximate
rcFeedback = new Rectangle(0, 0, 50, tabbedPane.getFontMetrics(tabbedPane.getFont()).getHeight() + 8);
}
feedbackLayer.putFeedback(getDelegee(), rcFeedback, tooltipText);
}
}
示例2: maybeShowKeyStoreTabPopup
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
private void maybeShowKeyStoreTabPopup(MouseEvent evt) {
if (evt.isPopupTrigger()) {
int tabCount = jkstpKeyStores.getTabCount();
TabbedPaneUI tpu = jkstpKeyStores.getUI();
for (int i = 0; i < tabCount; i++) {
Rectangle rect = tpu.getTabBounds(jkstpKeyStores, i);
int x = evt.getX();
int y = evt.getY();
if (x < rect.x || x > rect.x + rect.width || y < rect.y || y > rect.y + rect.height) {
continue;
}
jpmKeyStoreTab.show(evt.getComponent(), evt.getX(), evt.getY());
break;
}
}
}
示例3: TabManager
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
public TabManager(final JTabbedPane tabbedPane, final int tabBarWidth, final int tabLayoutPolicy) {
this.tabbedPane = tabbedPane;
this.tabbedPane.setTabLayoutPolicy(tabLayoutPolicy);
this.TAB_BAR_WIDTH = tabBarWidth;
final TabbedPaneUI tabUI = this.tabbedPane.getUI();
if (tabUI instanceof MetalTabbedPaneUI) {
this.tabbedPane.setUI(new CustomMetalTabbedPaneUI(this));
} else if (tabUI instanceof SynthTabbedPaneUI) {
this.tabbedPane.setUI(new CustomSynthTabbedPaneUI(this));
} else if (tabUI instanceof MotifTabbedPaneUI) {
this.tabbedPane.setUI(new CustomMotifTabbedPaneUI(this));
} else if (tabUI instanceof WindowsTabbedPaneUI) {
this.tabbedPane.setUI(new CustomWindowsTabbedPaneUI(this));
} else {
this.tabbedPane.setUI(new CustomBasicTabbedPaneUI(this));
}
}
示例4: showPopup
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
/** Called when the seqeunce of mouse events should lead to actual
* showing of the popup menu. */
@Override
protected void showPopup(java.awt.event.MouseEvent mouseEvent) {
TabbedPaneUI tabUI = mergeTabbedPane.getUI();
int clickTab = tabUI.tabForCoordinate(mergeTabbedPane, mouseEvent.getX(), mouseEvent.getY());
MergePanel panel = getSelectedMergePanel();
if (panel == null) {
return;
}
if (clickTab != -1) {
//Click is on valid tab, not on empty area in tab
showPopupMenu(createPopupMenu(panel), mouseEvent.getPoint(), mergeTabbedPane);
}
}
示例5: tabForCoordinate
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
/**
* Invokes the <code>tabForCoordinate</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public int tabForCoordinate(JTabbedPane a, int b, int c) {
int returnValue =
((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c);
for (int i = 1; i < uis.size(); i++) {
((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c);
}
return returnValue;
}
示例6: getTabBounds
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
/**
* Invokes the <code>getTabBounds</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public Rectangle getTabBounds(JTabbedPane a, int b) {
Rectangle returnValue =
((TabbedPaneUI) (uis.elementAt(0))).getTabBounds(a,b);
for (int i = 1; i < uis.size(); i++) {
((TabbedPaneUI) (uis.elementAt(i))).getTabBounds(a,b);
}
return returnValue;
}
示例7: getTabRunCount
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
/**
* Invokes the <code>getTabRunCount</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public int getTabRunCount(JTabbedPane a) {
int returnValue =
((TabbedPaneUI) (uis.elementAt(0))).getTabRunCount(a);
for (int i = 1; i < uis.size(); i++) {
((TabbedPaneUI) (uis.elementAt(i))).getTabRunCount(a);
}
return returnValue;
}
示例8: getUI
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
/**
* Maps {@code JTabbedPane.getUI()} through queue
*/
public TabbedPaneUI getUI() {
return (runMapping(new MapAction<TabbedPaneUI>("getUI") {
@Override
public TabbedPaneUI map() {
return ((JTabbedPane) getSource()).getUI();
}
}));
}
示例9: setUI
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
/**
* Maps {@code JTabbedPane.setUI(TabbedPaneUI)} through queue
*/
public void setUI(final TabbedPaneUI tabbedPaneUI) {
runMapping(new MapVoidAction("setUI") {
@Override
public void map() {
((JTabbedPane) getSource()).setUI(tabbedPaneUI);
}
});
}
示例10: closeTabAt
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
private void closeTabAt(int x, int y) {
TabbedPaneUI ui = getUI();
int index = ui.tabForCoordinate(this, x, y);
if (index < 0 || !myManager.canCloseContents()) {
return;
}
final Content content = myManager.getContent(index);
if (content != null && content.isCloseable()) {
myManager.removeContent(content, true);
}
}
示例11: processMouseEvent
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
protected void processMouseEvent(MouseEvent e) {
if (e.isPopupTrigger()) { // Popup doesn't activate clicked tab.
showPopup(e.getX(), e.getY());
return;
}
if (!e.isShiftDown() && (MouseEvent.BUTTON1_MASK & e.getModifiers()) > 0) { // RightClick without Shift modifiers just select tab
if (MouseEvent.MOUSE_RELEASED == e.getID()) {
TabbedPaneUI ui = getUI();
int index = ui.tabForCoordinate(this, e.getX(), e.getY());
if (index != -1) {
setSelectedIndex(index);
}
hideMenu();
}
}
else if (e.isShiftDown() && (MouseEvent.BUTTON1_MASK & e.getModifiers()) > 0) { // Shift+LeftClick closes the tab
if (MouseEvent.MOUSE_RELEASED == e.getID()) {
closeTabAt(e.getX(), e.getY());
hideMenu();
}
}
else if ((MouseEvent.BUTTON2_MASK & e.getModifiers()) > 0) { // MouseWheelClick closes the tab
if (MouseEvent.MOUSE_RELEASED == e.getID()) {
closeTabAt(e.getX(), e.getY());
hideMenu();
}
}
else if ((MouseEvent.BUTTON3_MASK & e.getModifiers()) > 0 && SystemInfo.isWindows) { // Right mouse button doesn't activate tab
}
else {
super.processMouseEvent(e);
}
}
示例12: getContentAt
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
/**
* @return content at the specified location. <code>x</code> and <code>y</code> are in
* tabbed pane coordinate system. The method returns <code>null</code> if there is no contnt at the
* specified location.
*/
private Content getContentAt(int x, int y) {
TabbedPaneUI ui = getUI();
int index = ui.tabForCoordinate(this, x, y);
if (index < 0) {
return null;
}
return myManager.getContent(index);
}
示例13: setUI
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
@Override
public void setUI(final TabbedPaneUI ui){
super.setUI(ui);
if(ui instanceof BasicTabbedPaneUI){
myScrollableTabSupport=new ScrollableTabSupport((BasicTabbedPaneUI)ui);
}else{
myScrollableTabSupport=null;
}
}
示例14: getTabIndexAt
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
protected final int getTabIndexAt(final int x,final int y){
final TabbedPaneUI ui=getUI();
for (int i = 0; i < getTabCount(); i++) {
final Rectangle bounds = ui.getTabBounds(this, i);
if (bounds.contains(x, y)) {
return i;
}
}
return -1;
}
示例15: getInplaceProperty
import javax.swing.plaf.TabbedPaneUI; //导入依赖的package包/类
/**
* @return inplace property for editing of the title of the clicked tab
*/
public Property getInplaceProperty(final int x, final int y) {
final JTabbedPane tabbedPane = getTabbedPane();
final TabbedPaneUI ui = tabbedPane.getUI();
LOG.assertTrue(ui != null);
final int index = ui.tabForCoordinate(tabbedPane, x, y);
return index != -1 ? new MyTitleProperty(null, index) : null;
}