本文整理汇总了Java中org.netbeans.swing.tabcontrol.TabDisplayer类的典型用法代码示例。如果您正苦于以下问题:Java TabDisplayer类的具体用法?Java TabDisplayer怎么用?Java TabDisplayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TabDisplayer类属于org.netbeans.swing.tabcontrol包,在下文中一共展示了TabDisplayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paint
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
/** Provides the painting logic. Note that this does not call any of the
* painting methods of BasicToggleButtonUI */
@Override
public final void paint(Graphics g, JComponent c) {
BasicSlidingTabDisplayerUI.IndexButton b =
(BasicSlidingTabDisplayerUI.IndexButton) c;
Graphics2D g2d = (Graphics2D) g;
paintBackground (g2d, b);
Object orientation = b.getOrientation();
AffineTransform tr = g2d.getTransform();
if (orientation == TabDisplayer.ORIENTATION_EAST) {
g2d.rotate( Math.PI / 2 );
g2d.translate( 0, - c.getWidth() );
} else if (orientation == TabDisplayer.ORIENTATION_WEST) {
g2d.rotate(-Math.PI / 2);
g2d.translate(-c.getHeight(), 0);
}
paintIconAndText (g2d, b, orientation);
g2d.setTransform (tr);
}
示例2: maybeMakeSelectedTabVisible
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
/**
* This method is called to scroll the selected tab into view if its
* title changes (it may be scrolled offscreen). NetBeans' editor uses
* this to ensure that the user can see what file they're editing when
* the user starts typing (this triggers a * being appended to the tab
* title, thus triggering this call).
*/
private void maybeMakeSelectedTabVisible(ComplexListDataEvent clde) {
if (!container.isShowing() || container.getWidth() < 10) {
//Java module fires icon changes from badging before the
//main window has been validated for the first time
return;
}
if (tabDisplayer.getType() == TabDisplayer.TYPE_EDITOR) {
int idx = tabDisplayer.getSelectionModel().getSelectedIndex();
//If more than one tab changed, it's probably not an event we want.
//Only do this if there is only one.
if ((clde.getIndex0() == clde.getIndex1())
&& clde.getIndex0() == idx) {
(tabDisplayer).makeTabVisible(idx);
}
}
}
示例3: minimumLayoutSize
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
public Dimension minimumLayoutSize(Container parent) {
JComponent c = tabDisplayer;
Object orientation = c.getClientProperty (
TabDisplayer.PROP_ORIENTATION);
Dimension tabSize = tabDisplayer.getPreferredSize();
Insets ins = container.getInsets();
Dimension result = new Dimension();
Dimension contentSize = contentDisplayer.getPreferredSize();
if (tabDisplayer.getSelectionModel().getSelectedIndex() == -1) {
contentSize.width = 0;
contentSize.height = 0;
}
if (orientation == TabDisplayer.ORIENTATION_NORTH || orientation == TabDisplayer.ORIENTATION_SOUTH) {
result.height = ins.top + ins.bottom + contentSize.height + tabSize.height;
result.width = ins.left + ins.right + Math.max (contentSize.width, tabSize.width);
} else {
result.width = ins.left + ins.right + contentSize.width + tabSize.width;
result.height = ins.top + ins.bottom + Math.max (contentSize.height, tabSize.height);
}
return result;
}
示例4: mouseMoved
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
@Override
public void mouseMoved(MouseEvent e) {
int idx = updateMouseLocation(e);
tabState.setMouseInTabsArea(true);
tabState.setContainsMouse(idx);
if (idx != -1) {
TabCellRenderer tcr = getTabCellRenderer(idx);
getTabRect(idx, scratch);
int state = tabState.getState(idx);
String s = tcr.getCommandAtPoint(e.getPoint(), state, scratch);
if (TabDisplayer.COMMAND_CLOSE == s) {
tabState.setCloseButtonContainsMouse(idx);
} else {
tabState.setCloseButtonContainsMouse(-1);
}
} else {
tabState.setContainsMouse(-1);
}
}
示例5: potentialCommand
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
private void potentialCommand (int idx, MouseEvent e, int state, TabCellRenderer tcr, Rectangle bounds) {
String command = tcr.getCommandAtPoint (e.getPoint(), state, bounds,
e.getButton(), e.getID(), e.getModifiersEx());
if (command == null || TabDisplayer.COMMAND_SELECT == command) {
if (e.isPopupTrigger()) {
displayer.repaint();
performCommand (TabDisplayer.COMMAND_POPUP_REQUEST, idx, e);
return;
} else if (e.getID() == MouseEvent.MOUSE_CLICKED && e.getClickCount() >= 2 && e.getButton() == MouseEvent.BUTTON1 ) {
performCommand (TabDisplayer.COMMAND_MAXIMIZE, idx, e);
return;
}
}
if (command != null) {
performCommand (command, lastPressedTab == -1 || lastPressedTab >=
displayer.getModel().size() ? idx : lastPressedTab, e);
}
}
示例6: mouseReleased
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
@Override
public void mouseReleased(MouseEvent e) {
int idx = updateMouseLocation(e);
if (idx != -1) {
TabCellRenderer tcr = getTabCellRenderer(idx);
getTabRect(idx, scratch);
int state = tabState.getState(idx);
if ((state & TabState.PRESSED) != 0 && ((state & TabState.CLIP_LEFT) != 0) || (state & TabState.CLIP_RIGHT) != 0) {
makeTabVisible(idx);
}
potentialCommand (idx, e, state, tcr, scratch);
} else {
if( e.isPopupTrigger() ) {
displayer.repaint();
performCommand (TabDisplayer.COMMAND_POPUP_REQUEST, -1, e);
}
}
tabState.setMouseInTabsArea(idx != -1);
tabState.setPressed(-1);
tabState.setMousePressedInCloseButton(-1);
}
示例7: getCommandAtPoint
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
public String getCommandAtPoint(Point p, int tabState, Rectangle bounds) {
setBounds (bounds);
setState (tabState);
if (supportsCloseButton(getBorder()) && isShowCloseButton()) {
TabPainter cbp = (TabPainter) getBorder();
cbp.getCloseButtonRectangle (this, scratch, bounds);
if (getClass() != AquaEditorTabCellRenderer.class) {
//#47408 - hit test area of close button is too small
scratch.x -=3;
scratch.y -=3;
scratch.width += 6;
scratch.height += 6;
}
if (scratch.contains(p)) {
return TabDisplayer.COMMAND_CLOSE;
}
}
Polygon tabShape = getTabShape (tabState, bounds);
if (tabShape.contains(p)) {
return TabDisplayer.COMMAND_SELECT;
}
return null;
}
示例8: getButtonId
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
@Override
protected int getButtonId() {
int retValue = TabControlButton.ID_PIN_BUTTON;
Component currentTab = getActiveTab( getTabDisplayer() );
if( null != currentTab ) {
WinsysInfoForTabbedContainer winsysInfo = getTabDisplayer().getContainerWinsysInfo();
if( null != winsysInfo ) {
Object orientation = winsysInfo.getOrientation( currentTab );
if( TabDisplayer.ORIENTATION_EAST.equals( orientation ) )
retValue = TabControlButton.ID_SLIDE_RIGHT_BUTTON;
else if( TabDisplayer.ORIENTATION_WEST.equals( orientation ) )
retValue = TabControlButton.ID_SLIDE_LEFT_BUTTON;
else if( TabDisplayer.ORIENTATION_SOUTH.equals( orientation ) )
retValue = TabControlButton.ID_SLIDE_DOWN_BUTTON;
}
}
return retValue;
}
示例9: showHideControlButtons
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
void showHideControlButtons() {
Component tabComponent = null;
boolean tcSlidingEnabled = true;
boolean tcClosingEnabled = true;
int selIndex = Math.max( 0, displayer.getSelectionModel().getSelectedIndex() );
if( selIndex >= 0 && selIndex < displayer.getModel().size() ) {
TabData tab = displayer.getModel().getTab( selIndex );
tabComponent = tab.getComponent();
if( tabComponent instanceof TopComponent ) {
tcSlidingEnabled = displayer.getContainerWinsysInfo().isTopComponentSlidingEnabled( (TopComponent)tabComponent );
tcClosingEnabled = displayer.getContainerWinsysInfo().isTopComponentClosingEnabled( (TopComponent)tabComponent );
}
}
btnAutoHidePin.setVisible( tabComponent != null
&& !TabDisplayer.ORIENTATION_INVISIBLE.equals( displayer.getContainerWinsysInfo().getOrientation( tabComponent ) )
&& displayer.getContainerWinsysInfo().isTopComponentSlidingEnabled()
&& tcSlidingEnabled );
if( null != btnClose ) {
btnClose.setVisible(tabComponent != null && tcClosingEnabled);
}
}
示例10: mousePressed
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
Point p = e.getPoint();
int i = getLayoutModel().indexOfPoint(p.x, p.y);
tabState.setPressed(i);
SingleSelectionModel sel = getSelectionModel();
selectionChanged = i != sel.getSelectedIndex();
// invoke possible selection change
if ((i != -1) || !selectionChanged) {
boolean change = shouldPerformAction(TabDisplayer.COMMAND_SELECT,
i, e);
if (change) {
getSelectionModel().setSelectedIndex(i);
tabState.setSelected(i);
Component tc = i >= 0 ? getDataModel().getTab(i).getComponent() : null;
if( null != tc && tc instanceof TopComponent
&& !((TopComponent)tc).isAncestorOf( KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner() ) ) {
((TopComponent)tc).requestActive();
}
}
}
if (e.isPopupTrigger()) {
//Post a popup menu show request
shouldPerformAction(TabDisplayer.COMMAND_POPUP_REQUEST, i, e);
}
}
示例11: preferredLayoutSize
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
@Override
public Dimension preferredLayoutSize(Container parent) {
Object orientation = getDisplayerOrientation();
boolean flip = orientation == TabDisplayer.ORIENTATION_EAST ||
orientation == TabDisplayer.ORIENTATION_WEST;
int max = displayer.getModel().size();
Dimension result = new Dimension();
for (int i=0; i < max; i++) {
result.height = Math.max (result.height, layoutModel.getH(i));
result.width += layoutModel.getW(i);
}
if (flip) {
int tmp = result.height;
result.height = result.width;
result.width = tmp;
}
return result;
}
示例12: createFxProvider
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
/**
* Create an FxProvider instance which will provide transition effects when tabs are selected.
* By default creates a no-op instance for all displayer types except TYPE_SLIDING.
*
* @return An instance of FxProvider
*/
protected FxProvider createFxProvider() {
if (NO_EFFECTS || (tabDisplayer.getType() != TabDisplayer.TYPE_SLIDING && !EFFECTS_EVERYWHERE)) {
return new NoOpFxProvider();
} else {
if (ADD_TO_GLASSPANE) {
return new LiveComponentSlideFxProvider();
} else {
return new ImageSlideFxProvider();
}
}
}
示例13: showComponentWithFxProvider
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
/**
* Shows a component in the control, using the <code>FxProvider</code> created in
* <code>createFxProvider()</code> to manage showing it. Equivalent to calling <code>showComponent</code>,
* but there may be a delay while the effect is performed. If no <code>FxProvider</code> is installed,
* this will simply delegate to <code>showComponent</code>; if not, the <code>FxProvider</code> is expected
* to do that when its effect is completed.
*
* @param c The component to be shown.
*/
protected final void showComponentWithFxProvider (Component c) {
if (slideEffectManager == null || !container.isShowing() || (!(c instanceof JComponent))) {
Component last = showComponent (c);
maybeRemoveLastComponent (last);
} else {
slideEffectManager.start((JComponent) c, container.getRootPane(),
tabDisplayer.getClientProperty(TabDisplayer.PROP_ORIENTATION));
}
}
示例14: updateActiveState
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
/** Sets the active state of the displayer to match that of the container */
private void updateActiveState() {
//#45630 - more of a hack than a fix.
//apparently uninstallUI() was called before the the ContainerPropertyChangeListener instance was removed in
//ContainerHierarchyListener's hierarchyChanged method.
// for such case the property change should be a noop.
TabDisplayer displ = tabDisplayer;
TabbedContainer cont = container;
if (displ != null && cont != null) {
displ.setActive(cont.isActive());
}
}
示例15: initSize
import org.netbeans.swing.tabcontrol.TabDisplayer; //导入依赖的package包/类
private void initSize() {
d = comp.getPreferredSize();
Dimension d2 = contentDisplayer.getSize();
d.width = Math.max (d2.width, d.width);
d.height = Math.max (d2.height, d.height);
boolean flip = orientation == TabDisplayer.ORIENTATION_EAST ||
orientation == TabDisplayer.ORIENTATION_WEST;
if (d.width == 0 || d.height == 0) {
if (flip) {
d.width = root.getWidth();
d.height = tabDisplayer.getHeight();
} else {
d.width = tabDisplayer.getWidth();
d.height = root.getHeight();
}
} else {
if (flip) {
d.height = Math.max (d.height, tabDisplayer.getHeight());
} else {
d.width = Math.max (d.width, tabDisplayer.getWidth());
}
}
}