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

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

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

示例1: getDropIndication

?點讚 3

?

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;

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,

示例2: dropIndexOfPoint

?點讚 3

?

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;

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,

示例3: getImageBounds

?點讚 2

?

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;

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:35,

示例4: createTabImage

?點讚 2

?

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;

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,

示例5: getTabBounds

?點讚 2

?

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;

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,

示例6: getTabBounds

?點讚 2

?

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;

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,

示例7: getTabBounds

?點讚 2

?

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;

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,

示例8: paint

?點讚 2

?

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);

}

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,

示例9: redraw

?點讚 2

?

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);

}

}

開發者ID:GDSRS,項目名稱:TrabalhoFinalEDA2,代碼行數:14,

示例10: redraw

?點讚 2

?

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);

}

}

開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:12,

示例11: configureBalloon

?點讚 2

?

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 );

}

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:44,

示例12: updateOrientation

?點讚 2

?

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();

}

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:49,

示例13: getTabsArea

?點讚 2

?

import javax.swing.SwingUtilities; //導入方法依賴的package包/類

@Override

public Rectangle getTabsArea() {

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

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

return res;

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,

示例14: toComponentPane

?點讚 1

?

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);

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,

示例15: fromComponentPane

?點讚 1

?

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);

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,

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

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/538475.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/538475.shtml
英文地址,請注明出處:http://en.pswp.cn/news/538475.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

python 查詢包_查找Python包的依賴包(語句)

Window 10家庭中文版&#xff0c;Python 3.6.4&#xff0c;今天看完了urllib3的官文(官方文檔)&#xff0c;因為沒有具體使用過&#xff0c;所以&#xff0c;仍然是一知半解&#xff0c;但是&#xff0c;突然想知道 urllib3以及前面學習過的requests模塊都依賴了什么其它模塊。…

618選購手機正當時,好評率高達99%的手機了解一下!

一年一度的京東618年中購物狂歡節如火如荼的進行中&#xff0c;手機廠商們都使出了渾身解數&#xff0c;對消費者進行爭奪。對于用戶來說&#xff0c;618絕對是更換手機的好時機。不過&#xff0c;小伙伴們面對市場上的眾多機型&#xff0c;也有可能挑花了眼&#xff0c;不知道…

IntelliJ IDEA 2017.2 x64 安裝Scala

從官網下載好IntelliJ IDEA 和scala IntelliJ IDEA 安裝scala插件 新建scala項目 建好后&#xff0c;發現src右鍵--新建---沒有 .scala選項 解決方法

Django-ORM數據庫操作

背景 Django框架功能齊全自帶數據庫操作功能&#xff0c;由于工作中設計巨量的api接口&#xff0c;需要一個很好的web后端服務框架&#xff0c;Django給了莫大的幫助。本文主要介紹Django的ORM框架我們一般對數據庫的使用的認識是&#xff1a; 創建數據庫&#xff0c;設計表結構…

python查詢缺失值所在位置_Python Pandas找到缺失值的位置方法

問題描述&#xff1a;python pandas判斷缺失值一般采用 isnull()&#xff0c;然而生成的卻是所有數據的true&#xff0f;false矩陣&#xff0c;對于龐大的數據dataframe&#xff0c;很難一眼看出來哪個數據缺失&#xff0c;一共有多少個缺失數據&#xff0c;缺失數據的位置。首…

快學Scala習題解答—第二章 控制結構和函數

原文地址&#xff1a;http://blog.csdn.net/ivan_pig/article/details/8253068 ---------------------------------------------------------------------------------- 3 控制結構和函數 3.1 一個數字如果為正數&#xff0c;則它的signum為1;如果是負數,則signum為-1;如果為0…

java barrier_Java - Latch和Barrier的區別

之所以把Latch與Barrier放在一起比較是因為他們給人一種相似的感覺。他們都是阻塞一些行為直至某個事件發生&#xff0c;但Latch是等待某個事件發生&#xff0c;而Barrier是等待線程。先比較一下JCIP中對二者的描述&#xff1a;LatchA latch is a synchronizer that can delay …

Kingback小組沖刺博客

一、6月13日 1、今日完成的任務 李可欣 項目首頁的框架設計 項目首頁的導航欄部分 對于項目的配色進行了改進&#xff0c;并且設計了logo 楊帆 今天進行了數據庫的設計&#xff0c;完成了數據庫的增刪改查&#xff0c;并建立了兩個jsp頁面&#xff0c;還學習了一些數據庫設計的…

用python前端html后端django_淺談Django前端后端值傳遞問題

前端后端傳值問題總結前端傳給后端通過表單傳值1、通過表單get請求傳值在前端當通過get的方式傳值時&#xff0c;表單中的標簽的name值將會被當做action的地址的參數此時&#xff0c;在后端可以通過get請求相應的name值拿到對應的value值例子:html中:{% csrf_token %}類別{% fo…

使用Git上傳本地項目到oschina

原文地址&#xff1a;https://my.oschina.net/158/blog/530112 --------------------------------------------- 1.首先看一下自己是否有公鑰&#xff0c; 在 我的資料-->SSH公鑰 查看&#xff0c;如果沒有&#xff0c;添加自己的SSH 公鑰&#xff1a; SSH key 可以讓你在…

手動創建git忽略push清單,node_module以及自身

1.文件夾內右鍵git bash&#xff0c;輸 touch .gitignore&#xff0c;注意中間有空格 2.編輯器打開生成的 .gitignore 文件&#xff0c;加入 .gitignore node_modules12 3.保存 4.以后再push到倉庫的就會過濾這倆了&#xff0c;想加啥自己加

整數數組按絕對值排序

2019獨角獸企業重金招聘Python工程師標準>>> 題目&#xff1a; 給出一組整數數組&#xff0c;要求按照絕對值從小到大進行排序后輸出。 可以用經典的冒泡排序法來計算此問題&#xff0c;計算過程&#xff1a; 1、比較相鄰兩個元素絕對值&#xff0c;如果第一個比第二…

python定時任務是異步的嗎_定時任務、異步任務

------------定時任務、異步任務--------pip install celery --targetD:\Users\ex-ouyangl003\PycharmProjects\data_new\dg_meta_system\metadata_system\venv\Lib\site-packages# coding:utf-8from apscheduler.schedulers.blocking import BlockingSchedulerimport datetime…

java excel自動保存_java讀取excel的內容(可保存到數據庫中)

//**poi jar包//public classReadExcel {SuppressWarnings("static-access")private staticString getValue(HSSFCell hssfCell) {if (hssfCell.getCellType() hssfCell.CELL_TYPE_BOOLEAN) {//返回布爾類型的值returnString.valueOf(hssfCell.getBooleanCellValue()…

《快學Scala》勘誤

原文鏈接&#xff1a;http://www.blogjava.net/sean/archive/2012/11/15/391386.html ---------------- 第11頁&#xff08;練習&#xff09;&#xff1a; 在Scala REPL中鍵入3&#xff0c;然后按Tab鍵 應為 在Scala REPL中鍵入3.&#xff0c;然后按Tab鍵 第19頁&#xff0…

二分排序java實現

1.什么是二分排序&#xff1a; 二分排序是指利用二分法的思想對插入排序進行改進的一種插入排序算法&#xff0c;不同于二叉排序&#xff0c;可以利用數組的特點快速定位指定索引的元素&#xff1b; 算法思想&#xff1a;二分法插入排序是在插入第i個元素時&#xff0c;對前面的…

pearson相關系數_pearson相關系數與典型相關性分析(CCA)

本文主要介紹相關系數的概念&#xff0c;以及簡單相關系數中的pearson相關系數及其局限性。隨后介紹pearson相關系數無法解決的問題(兩個變量組之間的相關性問題)的解決方案。1、pearson相關系數在日常中&#xff0c;我們經常會遇到一些關于相關性的分析&#xff0c;例如&#…

快學Scala習題解答—第三章 數組相關操作

原文鏈接&#xff1a;http://blog.csdn.net/ivan_pig/article/details/8257365 -------------------------------------------------- 4 數組相關操作 4.1 編寫一段代碼&#xff0c;將a設置為一個n個隨機整數的數組&#xff0c;要求隨機數介于0(包含)和n(不包含)之間 random和…

seo自動工具_愛站SEO工具包詳細介紹

愛站SEO工具-seoer的瑞士軍刀&#xff01;這個工具主要是為了方便SEOer查詢一些網站的問題&#xff0c;監控關鍵詞排名收錄等等&#xff0c;新手老手都可以用的工具&#xff0c;更快的讓SEOer上手。相信有很多SEOer都使用過愛站SEO工具包&#xff0c;也有很多新入行的小伙伴可能…

人物三(依芙蒂法)

轉載于:https://www.cnblogs.com/song1900/p/9189921.html