日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

java swing rectangle_Java SwingUtilities.convertRectangle方法代碼示例

發(fā)布時間:2025/3/11 50 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java swing rectangle_Java SwingUtilities.convertRectangle方法代碼示例 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

本文整理匯總了Java中javax.swing.SwingUtilities.convertRectangle方法的典型用法代碼示例。如果您正苦於以下問題:Java SwingUtilities.convertRectangle方法的具體用法?Java SwingUtilities.convertRectangle怎麼用?Java SwingUtilities.convertRectangle使用的例子?那麼恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進(jìn)一步了解該方法所在類javax.swing.SwingUtilities的用法示例。

在下文中一共展示了SwingUtilities.convertRectangle方法的15個代碼示例,這些例子默認(rèn)根據(jù)受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統(tǒng)推薦出更棒的Java代碼示例。

示例1: getDropIndication

?點讚 3

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的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;

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):13,

示例2: dropIndexOfPoint

?點讚 3

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的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;

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):26,

示例3: getImageBounds

?點讚 2

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的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;

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):35,

示例4: createTabImage

?點讚 2

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的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;

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):16,

示例5: getTabBounds

?點讚 2

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的package包/類

@Override

public Rectangle getTabBounds( int tabIndex ) {

Rectangle res = getTabDisplayer().getTabBounds( tabIndex );

if( null != res )

res = SwingUtilities.convertRectangle( getTabDisplayer(), res, container );

return res;

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):8,

示例6: getTabBounds

?點讚 2

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的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;

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):16,

示例7: getTabBounds

?點讚 2

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的package包/類

@Override

public Rectangle getTabBounds( int tabIndex ) {

Rectangle res = table.getTabBounds( tabIndex );

if( null != res )

res = SwingUtilities.convertRectangle( table, res, this );

return res;

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):8,

示例8: paint

?點讚 2

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的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);

}

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):11,

示例9: redraw

?點讚 2

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的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);

}

}

開發(fā)者ID:GDSRS,項目名稱:TrabalhoFinalEDA2,代碼行數(shù):14,

示例10: redraw

?點讚 2

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的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);

}

}

開發(fā)者ID:ModelWriter,項目名稱:Tarski,代碼行數(shù):12,

示例11: configureBalloon

?點讚 2

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的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 );

}

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):44,

示例12: updateOrientation

?點讚 2

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的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();

}

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):49,

示例13: getTabsArea

?點讚 2

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的package包/類

@Override

public Rectangle getTabsArea() {

Rectangle res = container.getTabDisplayer().getTabsArea();

res = SwingUtilities.convertRectangle( getTabDisplayer(), res, container );

return res;

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):7,

示例14: toComponentPane

?點讚 1

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的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);

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):11,

示例15: fromComponentPane

?點讚 1

?

import javax.swing.SwingUtilities; //導(dǎo)入方法依賴的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);

}

開發(fā)者ID:apache,項目名稱:incubator-netbeans,代碼行數(shù):11,

注:本文中的javax.swing.SwingUtilities.convertRectangle方法示例整理自Github/MSDocs等源碼及文檔管理平臺,相關(guān)代碼片段篩選自各路編程大神貢獻(xiàn)的開源項目,源碼版權(quán)歸原作者所有,傳播和使用請參考對應(yīng)項目的License;未經(jīng)允許,請勿轉(zhuǎn)載。

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎

總結(jié)

以上是生活随笔為你收集整理的java swing rectangle_Java SwingUtilities.convertRectangle方法代碼示例的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。