本文整理了Java中javax.swing.JDesktopPane.getSize()
方法的一些代码示例,展示了JDesktopPane.getSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDesktopPane.getSize()
方法的具体详情如下:
包路径:javax.swing.JDesktopPane
类名称:JDesktopPane
方法名:getSize
暂无
代码示例来源:origin: pentaho/mondrian
private void tileMenuItemActionPerformed(ActionEvent evt) {
final Dimension dsize = desktopPane.getSize();
final int desktopW = (int) dsize.getWidth();
final int desktopH = (int) dsize.getHeight();
代码示例来源:origin: geotools/geotools
window = frame;
content = new JPanel(); // Pour avoir un fond opaque
parentSize = desktop.getSize();
frame.setContentPane(content);
frame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
代码示例来源:origin: cmu-phil/tetrad
/**
* @return a reasonable divider location for the log output.
*/
private int getDivider() {
int height;
if (desktopPane.getSize().height == 0) {
Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
height = size.height;
} else {
height = desktopPane.getSize().height;
}
return (int) (height * .80);
}
代码示例来源:origin: antlr/antlrworks
public void setDefaultSize() {
if(useDesktop) {
Dimension dim = desktop.getSize();
setPreferredSize((int) (dim.width*0.8), (int) (dim.height*0.8));
} else {
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
setPreferredSize((int)(dim.width*0.5), (int)(dim.height*0.5));
}
}
代码示例来源:origin: xyz.cofe/docking-frames-core
public void componentResized( ComponentEvent e ){
if( desktop.isVisible() ){
if( lastSize == null || lastSize.width == 0 || lastSize.height == 0 ){
lastSize = desktop.getSize();
}
else{
onResize = true;
SwingUtilities.invokeLater( new Runnable(){
public void run() {
try{
for( Map.Entry<ScreenDockStation, Dockable[]> entry : dockables.entrySet() ){
ScreenDockStation station = entry.getKey();
for( Dockable dockable : entry.getValue() ){
ScreenDockWindow window = station.getWindow( dockable );
window.setWindowBounds( new Rectangle( 0, 0, desktop.getWidth(), desktop.getHeight() ) );
}
entry.setValue( station.getFullscreenChildren() );
}
}
finally{
onResize = false;
}
}
});
}
}
}
};
代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-core
public void componentResized( ComponentEvent e ){
if( desktop.isVisible() ){
if( lastSize == null || lastSize.width == 0 || lastSize.height == 0 ){
lastSize = desktop.getSize();
}
else{
onResize = true;
SwingUtilities.invokeLater( new Runnable(){
public void run() {
try{
for( Map.Entry<ScreenDockStation, Dockable[]> entry : dockables.entrySet() ){
ScreenDockStation station = entry.getKey();
for( Dockable dockable : entry.getValue() ){
ScreenDockWindow window = station.getWindow( dockable );
window.setWindowBounds( new Rectangle( 0, 0, desktop.getWidth(), desktop.getHeight() ) );
}
entry.setValue( station.getFullscreenChildren() );
}
}
finally{
onResize = false;
}
}
});
}
}
}
};
代码示例来源:origin: org.cytoscape/swing-application-impl
@Override
public Dimension getDesktopViewAreaSize() {
JDesktopPane desktop = desk.getNetworkViewManager().getDesktopPane();
return desktop.getSize();
}
代码示例来源:origin: xyz.cofe/docking-frames-core
protected Rectangle validate( Rectangle destination, Point center ){
if( desktop.isVisible() ){
if( lastSize == null || lastSize.width == 0 || lastSize.height == 0 ){
lastSize = desktop.getSize();
}
else{
if( center == null ){
center = new Point( destination.width/2, destination.height/2 );
}
Rectangle result = new Rectangle( destination );
result.x = Math.max( -center.x, result.x );
result.x = Math.min( result.x, desktop.getWidth() - center.x );
result.y = Math.max( -center.y, result.y );
result.y = Math.min( desktop.getHeight() - center.y, result.y );
return result;
}
}
return null;
}
}
代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-core
protected Rectangle validate( Rectangle destination, Point center ){
if( desktop.isVisible() ){
if( lastSize == null || lastSize.width == 0 || lastSize.height == 0 ){
lastSize = desktop.getSize();
}
else{
if( center == null ){
center = new Point( destination.width/2, destination.height/2 );
}
Rectangle result = new Rectangle( destination );
result.x = Math.max( -center.x, result.x );
result.x = Math.min( result.x, desktop.getWidth() - center.x );
result.y = Math.max( -center.y, result.y );
result.y = Math.min( desktop.getHeight() - center.y, result.y );
return result;
}
}
return null;
}
}
代码示例来源:origin: stackoverflow.com
JDesktopPane mainPanel;
JInternalFrame jif_test = new JInternalFrame();
public void centerJIF(JInternalFrame jif) {
Dimension desktopSize = mainPanel.getSize();
Dimension jInternalFrameSize = jif.getSize();
int width = (desktopSize.width - jInternalFrameSize.width) / 2;
int height = (desktopSize.height - jInternalFrameSize.height) / 2;
jif.setLocation(width, height);
jif.setVisible(true);
}
代码示例来源:origin: org.geotools/gt-swing
window = frame;
content = new JPanel(); // Pour avoir un fond opaque
parentSize = desktop.getSize();
frame.setContentPane(content);
frame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
代码示例来源:origin: cmu-phil/tetrad
/**
* Randomly picks the location of a new window, such that it fits completely
* on the screen.
*
* @param desktopPane the desktop pane that the frame is being added to.
* @param frame the JInternalFrame which is being added.
* @param desiredSize the desired dimensions of the frame.
*/
public static void setGoodBounds(JInternalFrame frame,
JDesktopPane desktopPane, Dimension desiredSize) {
RandomUtil randomUtil = RandomUtil.getInstance();
Dimension desktopSize = desktopPane.getSize();
Dimension d = new Dimension(desiredSize);
int tx = desktopSize.width - d.width;
int ty = desktopSize.height - d.height;
if (tx < 0) {
tx = 0;
d.width = desktopSize.width;
} else {
tx = (int) (randomUtil.nextDouble() * tx);
}
if (ty < 0) {
ty = 0;
d.height = desktopSize.height;
} else {
ty = (int) (randomUtil.nextDouble() * ty);
}
frame.setBounds(tx, ty, d.width, d.height);
}
代码示例来源:origin: net.java.linoleum/application
void select(final JInternalFrame frame) {
frame.setVisible(true);
try {
if (frame.isIcon()) {
frame.setIcon(false);
} else {
frame.setSelected(true);
}
} catch (final PropertyVetoException ex) {
ex.printStackTrace();
}
final Dimension size = getDesktopPane().getSize();
final Dimension s = frame.getSize();
final Point p = frame.getLocation();
final int x = Math.max(Math.min(p.x - (p.x + s.width - size.width), p.x), 0);
final int y = Math.max(Math.min(p.y - (p.y + s.height - size.height), p.y), 0);
if (x != p.x || y != p.y) {
frame.setLocation(x, y);
}
final int width = Math.min(s.width, size.width);
final int height = Math.min(s.height, size.height);
if (width < s.width || height < s.height) {
frame.setSize(width, height);
}
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
window = frame;
content = new JPanel(); // Pour avoir un fond opaque
parentSize = desktop.getSize();
frame.setContentPane(content);
frame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
代码示例来源:origin: cmu-phil/tetrad
Dimension fullSize = desktopPane.getSize();
int smallSize = Math.min(fullSize.width - MARGIN, fullSize.height
- MARGIN);
代码示例来源:origin: stackoverflow.com
Dimension d = desktop.getSize();
代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger
Dimension size = desk.getSize();
int w = size.width/cols;
int h = size.height/rows;
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
frame.setClosable (true);
frame.setResizable (true);
dimension = mOutput.getSize ();
frame.setBounds (0, 0, dimension.width, dimension.height / 2);
JTree tree = new JTree (new HtmlTreeModel (bean.getNodes ()));
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
frame.setClosable (true);
frame.setResizable (true);
dimension = mOutput.getSize ();
frame.setBounds (0, 0, dimension.width, dimension.height);
list = new NodeList ();
代码示例来源:origin: robo-code/robocode
Dimension screenSize = getDesktopPane().getSize();
Dimension size = internalFrame.getSize();
内容来源于网络,如有侵权,请联系作者删除!