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.mzph.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