本文整理了Java中javax.swing.JInternalFrame.getWidth()
方法的一些代码示例,展示了JInternalFrame.getWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JInternalFrame.getWidth()
方法的具体详情如下:
包路径:javax.swing.JInternalFrame
类名称:JInternalFrame
方法名:getWidth
暂无
代码示例来源:origin: magefree/mage
@Override
public void deiconifyFrame(JInternalFrame f) {
super.deiconifyFrame(f);
if (f instanceof CardInfoWindowDialog) {
JInternalFrame.JDesktopIcon icon = f.getDesktopIcon();
f.setBounds(icon.getX() + (DESKTOP_ICON_WIDTH - f.getWidth()), icon.getY(), f.getWidth(), f.getHeight());
}
}
代码示例来源:origin: magefree/mage
@Override
public void iconifyFrame(JInternalFrame f) {
super.iconifyFrame(f);
if (f instanceof CardInfoWindowDialog) {
JInternalFrame.JDesktopIcon icon = f.getDesktopIcon();
icon.setBounds(f.getX() + (f.getWidth() - DESKTOP_ICON_WIDTH), f.getY(), DESKTOP_ICON_WIDTH, icon.getHeight());
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
protected void sortFramesByWidth(JInternalFrame[] _frames) {
sortFramesByTitle(_frames);
JInternalFrame tmp;
int i, l;
l = _frames.length;
for (i = 0; i + 1 < l; i++)
if (_frames[i].getWidth() < _frames[i + 1].getWidth()) {
tmp = _frames[i];
_frames[i] = _frames[i + 1];
_frames[i + 1] = tmp;
i--;
if (i >= 0) i--;
}
}
代码示例来源:origin: stackoverflow.com
public static Point getPointForCentering(JInternalFrame window) {
try {
//assert window != null;
Point mousePoint = MouseInfo.getPointerInfo().getLocation();
GraphicsDevice[] devices = GraphicsEnvironment
.getLocalGraphicsEnvironment().getScreenDevices();
for (GraphicsDevice device : devices) {
Rectangle bounds = device.getDefaultConfiguration().
getBounds();
//check to see if the mouse cursor is within these bounds
if (mousePoint.x >= bounds.x && mousePoint.y >= bounds.y &&
mousePoint.x <= (bounds.x + bounds.width) && mousePoint.y
<= (bounds.y + bounds.height)) {
int screenWidth = bounds.width;//this is it
int screenHeight = bounds.height;
int width = window.getWidth();
int height = window.getHeight();
return new Point(((screenWidth - width) / 2) + bounds.x,
((screenHeight - height) / 2) + bounds.y);
}
}
} catch (Exception e) {
LOG.log(Level.FINE, e.getLocalizedMessage() +
" - this can occur do to a Security exception in sandboxed apps");
}
return new Point(0, 0);
}
代码示例来源:origin: com.numdata/numdata-swing
/**
* Center the specified internal frame on it's container (don't modify
* size).
*
* @param window Target window.
*/
public static void center( @NotNull final JInternalFrame window )
{
final Container parent = window.getParent();
if ( parent != null )
{
final Insets parentInsets = parent.getInsets();
final int x = parentInsets.left + ( parent.getWidth() - parentInsets.left - parentInsets.right - window.getWidth() ) / 2;
final int y = parentInsets.top + ( parent.getHeight() - parentInsets.top - parentInsets.bottom - window.getHeight() ) / 2;
window.setLocation( x, y );
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
protected Rectangle getBoundsForIconOf(JInternalFrame _f)
{
JInternalFrame.JDesktopIcon icon=_f.getDesktopIcon();
Dimension ps =icon.getPreferredSize();
return new Rectangle
(_f.getX()+_f.getWidth()-ps.width,_f.getY(),ps.width,ps.height);
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
int screenWidth = usableBounds.width;
int screenHeight = usableBounds.height;
int width = window.getWidth();
int height = window.getHeight();
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-common
int screenWidth = usableBounds.width;
int screenHeight = usableBounds.height;
int width = window.getWidth();
int height = window.getHeight();
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public void mouseDragged(MouseEvent _evt)
{
if(frame_!=null)
getManager(frame_).resizeFrame
(frame_,frame_.getX(),frame_.getY(),
frame_.getWidth ()+_evt.getX()-resizeCorner_.getWidth(),
frame_.getHeight()+_evt.getY()-resizeCorner_.getHeight());
}
}
代码示例来源:origin: net.sf.nimrod/nimrod-laf
void dodo( MouseEvent ev) {
if ( ev.getComponent() instanceof NimRODInternalFrameTitlePane ) {
if ( frame.getDesktopPane() != null ) {
frame.getDesktopPane().updateUI();
}
}
else {
int x = ev.getX();
int w = frame.getWidth();
int y = ev.getY();
int h = frame.getHeight();
if ( ( x <= 5 ) || ( x >= w - ins.right) || ( y >= h - ins.bottom ) ) {
if ( frame.getDesktopPane() != null ) {
frame.getDesktopPane().updateUI();
}
}
}
}
}
代码示例来源:origin: net.sf.jung/jung-samples
public void actionPerformed(ActionEvent e) {
dialog.pack();
dialog.setLocation(desktop.getWidth()-dialog.getWidth(),0);
dialog.show();
try {
dialog.setSelected(true);
} catch (java.beans.PropertyVetoException ex) {}
}
});
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
JInternalFrame allFrames[] = desktop.getAllFrames();
for (int i = 0; i < allFrames.length; i++) {
if (allFrames[i].getX() + allFrames[i].getWidth() > x) {
x = allFrames[i].getX() + allFrames[i].getWidth();
代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql
/**
* Calculate the required size of this desktop pane so that
* all visible intenal frames will be fully shown.
*
* @return <TT>Dimension</TT> required size.
*/
public Dimension getRequiredSize()
{
JInternalFrame[] frames = getAllFrames();
int maxX = 0;
int maxY = 0;
for (int i = 0; i < frames.length; ++i)
{
if (frames[i].isVisible())
{
JInternalFrame frame = frames[i];
int x = frame.getX() + frame.getWidth();
if (x > maxX)
{
maxX = x;
}
int y = frame.getY() + frame.getHeight();
if (y > maxY)
{
maxY = y;
}
}
}
return new Dimension(maxX, maxY);
}
代码示例来源:origin: khuxtable/seaglass
public void deiconifyFrame(JInternalFrame f) {
JInternalFrame.JDesktopIcon desktopIcon = f.getDesktopIcon();
Container c = desktopIcon.getParent();
if (c != null) {
c = c.getParent();
if (c != null) {
c.add(f);
if (f.isMaximum()) {
int w = c.getWidth();
int h = c.getHeight() - taskBar.getHeight();
if (f.getWidth() != w || f.getHeight() != h) {
setBoundsForFrame(f, 0, 0, w, h);
}
}
if (f.isSelected()) {
f.moveToFront();
} else {
try {
f.setSelected(true);
} catch (PropertyVetoException e2) {
}
}
}
}
}
代码示例来源:origin: cytoscape/application
private void setDesktopStates() throws JAXBException {
DesktopSize dSize = factory.createDesktopSize();
NetworkFrames frames = factory.createNetworkFrames();
Component[] networkFrames = Cytoscape.getDesktop().getNetworkViewManager().getDesktopPane()
.getComponents();
for (int i = 0; i < networkFrames.length; i++) {
if(networkFrames[i] instanceof JInternalFrame) {
JInternalFrame networkFrame = (JInternalFrame) networkFrames[i];
NetworkFrame frame = factory.createNetworkFrame();
frame.setFrameID(networkFrame.getTitle());
frame.setWidth(BigInteger.valueOf(networkFrame.getWidth()));
frame.setHeight(BigInteger.valueOf(networkFrame.getHeight()));
frame.setX(BigInteger.valueOf(networkFrame.getX()));
frame.setY(BigInteger.valueOf(networkFrame.getY()));
frames.getNetworkFrame().add(frame);
}
}
dSize.setHeight(BigInteger.valueOf(Cytoscape.getDesktop().getSize().height));
dSize.setWidth(BigInteger.valueOf(Cytoscape.getDesktop().getSize().width));
Desktop desktop = factory.createDesktop();
desktop.setDesktopSize(dSize);
desktop.setNetworkFrames(frames);
sState.setDesktop(desktop);
}
代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf
public void deiconifyFrame(JInternalFrame f) {
JInternalFrame.JDesktopIcon desktopIcon = f.getDesktopIcon();
Container c = desktopIcon.getParent();
if (c != null) {
c.add(f);
// If the frame is to be restored to a maximized state make
// sure it still fills the whole desktop.
if (f.isMaximum()) {
Rectangle desktopBounds = c.getBounds();
if (f.getWidth() != desktopBounds.width ||
f.getHeight() != desktopBounds.height) {
setBoundsForFrame(f, 0, 0,
desktopBounds.width, desktopBounds.height);
}
}
removeIconFor(f);
if (f.isSelected()) {
f.moveToFront();
} else {
try {
f.setSelected(true);
} catch (PropertyVetoException e2) {
}
}
}
}
代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf
public void closeFrame(JInternalFrame f) {
boolean findNext = f.isSelected();
Container c = f.getParent();
if (findNext)
try {
f.setSelected(false);
} catch (PropertyVetoException e2) {
}
if (c != null) {
c.remove(f);
c.repaint(f.getX(), f.getY(), f.getWidth(), f.getHeight());
}
removeIconFor(f);
if (f.getNormalBounds() != null)
f.setNormalBounds(null);
if (wasIcon(f))
setWasIcon(f, null);
if (findNext) activateNextFrame(c);
}
代码示例来源:origin: com.fifesoft.rtext/fife.common
/**
* Removes the frame, and, if necessary, the
* <code>desktopIcon</code>, from its parent. This method is overridden so
* that the "next internal frame" isn't selected after this one is closed.
* @param f the <code>JInternalFrame</code> to be removed
*/
@Override
public void closeFrame(JInternalFrame f) {
Container c = f.getParent();
if (f.isSelected()) {
try {
f.setSelected(false);
} catch (PropertyVetoException e2) {
// Do nothing
}
}
if(c != null) {
c.remove(f);
c.repaint(f.getX(), f.getY(), f.getWidth(), f.getHeight());
}
removeIconFor(f);
if(f.getNormalBounds() != null)
f.setNormalBounds(null);
if(wasIcon(f))
setWasIcon(f, null);
}
代码示例来源:origin: apache/sis
/**
* Creates and shows a new internal frame for the given image.
*/
private void addImage(final RenderedImage image, final String title) {
final JInternalFrame internal = new JInternalFrame(title, true, true);
internal.add(new ImagePanel(image));
internal.pack();
internal.show();
desktop.add(internal);
if (location > min(desktop.getWidth() - internal.getWidth(),
desktop.getHeight() - internal.getHeight()))
{
location = 0;
}
internal.setLocation(location, location);
location += 30;
internal.toFront();
}
代码示例来源:origin: Geomatys/geotoolkit
/**
* Creates and shows a new internal frame for the given image.
*/
final void addImage(final RenderedImage image, final String title) {
final JInternalFrame internal = new JInternalFrame(title, true, true);
internal.add(new ImagePanel(image));
internal.pack();
internal.show();
desktop.add(internal);
if (location > min(desktop.getWidth() - internal.getWidth(),
desktop.getHeight() - internal.getHeight()))
{
location = 0;
}
internal.setLocation(location, location);
location += 30;
internal.toFront();
}
内容来源于网络,如有侵权,请联系作者删除!