本文整理汇总了Java中javax.swing.SwingUtilities.convertRectangle方法的典型用法代码示例。如果您正苦于以下问题:Java SwingUtilities.convertRectangle方法的具体用法?Java SwingUtilities.convertRectangle怎么用?Java SwingUtilities.convertRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.SwingUtilities
的用法示例。
在下文中一共展示了SwingUtilities.convertRectangle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDropIndication
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
protected Shape getDropIndication( TopComponent draggedTC, Point location ) {
location = SwingUtilities.convertPoint( getComponent(), location, getTabDisplayer() );
Path2D res = new Path2D.Double();
Rectangle tabRect = getTabDisplayer().dropIndication( draggedTC, location );
if( null != tabRect ) {
tabRect = SwingUtilities.convertRectangle( getTabDisplayer(), tabRect, container );
res.append( tabRect, false );
}
res.append( container.getContentArea(), false );
return res;
}
示例2: dropIndexOfPoint
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public int dropIndexOfPoint( Point location ) {
int res = -1;
location = SwingUtilities.convertPoint( this, location, table );
TabData tab = table.getTabAt( location );
if( null != tab ) {
res = getModel().indexOf( tab );
Rectangle rect = getTabBounds( res );
rect = SwingUtilities.convertRectangle( this, rect, table );
if( orientation == JTabbedPane.VERTICAL ) {
if( location.y <= rect.y + rect.height/2 ) {
res = Math.max( 0, res );
} else {
res++;
}
} else {
if( location.x <= rect.x + rect.width/2 ) {
res = Math.max( 0, res );
} else {
res++;
}
}
}
return res;
}
示例3: getImageBounds
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private Rectangle getImageBounds() {
if (!changed) {
return rect;
}
Component c = tabDisplayer;
r2.setBounds (0, 0, c.getWidth(), c.getHeight());
Rectangle dispBounds = SwingUtilities.convertRectangle(c, r2,
this);
if (orientation == TabDisplayer.ORIENTATION_WEST) {
rect.x = dispBounds.x + dispBounds.width;
rect.y = dispBounds.y;
rect.width = Math.round (inc * d.width);
rect.height = dispBounds.height;
} else if (orientation == TabDisplayer.ORIENTATION_EAST) {
rect.width = Math.round (inc * d.width);
rect.height = dispBounds.height;
rect.x = dispBounds.x - rect.width;
rect.y = dispBounds.y;
} else if (orientation == TabDisplayer.ORIENTATION_SOUTH) {
rect.width = dispBounds.width;
rect.height = Math.round(inc * d.height);
rect.x = dispBounds.x;
rect.y = dispBounds.y - rect.height;
} else if (orientation == TabDisplayer.ORIENTATION_NORTH) {
rect.x = dispBounds.x;
rect.y = dispBounds.y + dispBounds.height;
rect.width = dispBounds.width;
rect.height = Math.round(inc * d.height);
}
changed = false;
return rect;
}
示例4: createTabImage
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private BufferedImage createTabImage() {
GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice().getDefaultConfiguration();
//the tab rectangle must be painted by top-level window otherwise the transparent
//button icons will be messed up
Window parentWindow = SwingUtilities.getWindowAncestor(container.getComponent());
Rectangle rect = SwingUtilities.convertRectangle(container.getComponent(), tabRectangle, parentWindow);
BufferedImage res = config.createCompatibleImage(tabRectangle.width, tabRectangle.height);
Graphics2D g = res.createGraphics();
g.translate(-rect.x, -rect.y);
g.setClip(rect);
parentWindow.paint(g);
return res;
}
示例5: getTabBounds
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public Rectangle getTabBounds( int tabIndex ) {
Rectangle res = getTabDisplayer().getTabBounds( tabIndex );
if( null != res )
res = SwingUtilities.convertRectangle( getTabDisplayer(), res, container );
return res;
}
示例6: getTabBounds
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
Rectangle getTabBounds( int tabIndex ) {
TabData tab = tabModel.getTab( tabIndex );
if( null == tab )
return null;
for( SingleRowTabTable table : rows ) {
if( table.hasTabIndex( tabIndex ) ) {
Rectangle rect = table.getTabBounds( tabIndex );
if( null != rect ) {
rect = SwingUtilities.convertRectangle( table, rect, container );
}
return rect;
}
}
return null;
}
示例7: getTabBounds
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public Rectangle getTabBounds( int tabIndex ) {
Rectangle res = table.getTabBounds( tabIndex );
if( null != res )
res = SwingUtilities.convertRectangle( table, res, this );
return res;
}
示例8: paint
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void paint(Graphics g) {
super.paint(g);
if (hover != null) {
Rectangle b = SwingUtilities.convertRectangle(
hover.getParent(), hover.getBounds(), this);
g.setColor(Color.RED);
g.drawRect(b.x, b.y, b.width, b.height);
}
}
示例9: redraw
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
* Updates the buffer (if one exists) and repaints the given cell state.
*/
public void redraw(mxCellState state)
{
if (state != null)
{
Rectangle dirty = state.getBoundingBox().getRectangle();
repaintTripleBuffer(new Rectangle(dirty));
dirty = SwingUtilities.convertRectangle(graphControl, dirty, this);
repaint(dirty);
}
}
示例10: redraw
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
* Updates the buffer (if one exists) and repaints the given cell state.
*/
public void redraw(mxCellState state) {
if (state != null) {
Rectangle dirty = state.getBoundingBox().getRectangle();
repaintTripleBuffer(new Rectangle(dirty));
dirty = SwingUtilities.convertRectangle(graphControl, dirty, this);
repaint(dirty);
}
}
示例11: configureBalloon
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private static void configureBalloon( Balloon balloon, JLayeredPane pane, JComponent ownerComp ) {
Rectangle ownerCompBounds = ownerComp.getBounds();
ownerCompBounds = SwingUtilities.convertRectangle( ownerComp.getParent(), ownerCompBounds, pane );
int paneWidth = pane.getWidth();
int paneHeight = pane.getHeight();
Dimension balloonSize = balloon.getPreferredSize();
balloonSize.height += Balloon.ARC;
//first try lower right corner
if( ownerCompBounds.x + ownerCompBounds.width + balloonSize.width < paneWidth
&&
ownerCompBounds.y + ownerCompBounds.height + balloonSize.height + Balloon.ARC < paneHeight ) {
balloon.setArrowLocation( GridBagConstraints.SOUTHEAST );
balloon.setBounds( ownerCompBounds.x+ownerCompBounds.width-Balloon.ARC/2,
ownerCompBounds.y+ownerCompBounds.height, balloonSize.width+Balloon.ARC, balloonSize.height );
//upper right corner
} else if( ownerCompBounds.x + ownerCompBounds.width + balloonSize.width < paneWidth
&&
ownerCompBounds.y - balloonSize.height - Balloon.ARC > 0 ) {
balloon.setArrowLocation( GridBagConstraints.NORTHEAST );
balloon.setBounds( ownerCompBounds.x+ownerCompBounds.width-Balloon.ARC/2,
ownerCompBounds.y-balloonSize.height, balloonSize.width+Balloon.ARC, balloonSize.height );
//lower left corner
} else if( ownerCompBounds.x - balloonSize.width > 0
&&
ownerCompBounds.y + ownerCompBounds.height + balloonSize.height + Balloon.ARC < paneHeight ) {
balloon.setArrowLocation( GridBagConstraints.SOUTHWEST );
balloon.setBounds( ownerCompBounds.x-balloonSize.width+Balloon.ARC/2,
ownerCompBounds.y+ownerCompBounds.height, balloonSize.width+Balloon.ARC, balloonSize.height );
//upper left corent
} else {
balloon.setArrowLocation( GridBagConstraints.NORTHWEST );
balloon.setBounds( ownerCompBounds.x-balloonSize.width/*+Balloon.ARC/2*/,
ownerCompBounds.y-balloonSize.height, balloonSize.width+Balloon.ARC, balloonSize.height );
}
}
示例12: updateOrientation
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/** Checks the position of the tabbed container relative to its parent
* window, and potentially updates its orientation client property.
*
* @see TabDisplayer#PROP_ORIENTATION
*/
protected final void updateOrientation() {
if (!container.isDisplayable()) {
return;
}
if (Boolean.FALSE.equals(container.getClientProperty (TabbedContainer.PROP_MANAGE_TAB_POSITION))) {
//The client has specified that it does not want automatic management
//of the displayer orientation
return;
}
Object currOrientation = tabDisplayer.getClientProperty(TabDisplayer.PROP_ORIENTATION);
Container window = container.getTopLevelAncestor();
Rectangle containerBounds = container.getBounds();
containerBounds = SwingUtilities.convertRectangle(container, containerBounds, window);
boolean longestIsVertical = containerBounds.width < containerBounds.height;
int distanceToLeft = containerBounds.x;
int distanceToTop = containerBounds.y;
int distanceToRight = window.getWidth() - (containerBounds.x + containerBounds.width);
int distanceToBottom = window.getHeight() - (containerBounds.y + containerBounds.height);
Object orientation;
if (!longestIsVertical) {
if (distanceToBottom > distanceToTop) {
orientation = TabDisplayer.ORIENTATION_NORTH;
} else {
orientation = TabDisplayer.ORIENTATION_SOUTH;
}
} else {
if (distanceToLeft > distanceToRight) {
orientation = TabDisplayer.ORIENTATION_EAST;
} else {
orientation = TabDisplayer.ORIENTATION_WEST;
}
}
if (currOrientation != orientation) {
tabDisplayer.putClientProperty(
TabDisplayer.PROP_ORIENTATION, orientation);
container.validate();
}
}
示例13: getTabsArea
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public Rectangle getTabsArea() {
Rectangle res = container.getTabDisplayer().getTabsArea();
res = SwingUtilities.convertRectangle( getTabDisplayer(), res, container );
return res;
}
示例14: toComponentPane
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
* Converts a {@code rectangle} in {@code innerPane} coordinates to
* a corresponding rectangle in {@code componentPane} coordinates.
*
* @param rectangle rectangle in {@code innerPane} coordinates.
* @return rectangle in {@code componentPane} coordinates.
*/
Rectangle toComponentPane(Rectangle rectangle) {
return SwingUtilities.convertRectangle(innerPane, rectangle, componentPane);
}
示例15: fromComponentPane
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
* Converts a {@code rectangle} in {@code componentPane} coordinates to
* a corresponding rectangle in {@code innerPane} coordinates.
*
* @param rectangle rectangle in {@code componentPane} coordinates.
* @return rectangle in {@code innerPane} coordinates.
*/
Rectangle fromComponentPane(Rectangle rectangle) {
return SwingUtilities.convertRectangle(componentPane, rectangle, innerPane);
}