javax.swing.JDesktopPane.setPreferredSize()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(206)

本文整理了Java中javax.swing.JDesktopPane.setPreferredSize()方法的一些代码示例,展示了JDesktopPane.setPreferredSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDesktopPane.setPreferredSize()方法的具体详情如下:
包路径:javax.swing.JDesktopPane
类名称:JDesktopPane
方法名:setPreferredSize

JDesktopPane.setPreferredSize介绍

暂无

代码示例

代码示例来源:origin: edu.illinois.lis/indri

/**
 * Make a link listener.
 */    
public DocLinkListener(Image image) {
winCount = 0;
icon = image;
f = new JFrame("Web Links");
deskTop = new JDesktopPane();
deskTop.setPreferredSize(new Dimension(700, 500));
f.setContentPane(deskTop);
f.setIconImage(icon);
f.pack();
f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
}

代码示例来源:origin: robo-code/robocode

public JDesktopPane getDesktopPane() {
  if (desktopPane == null) {
    desktopPane = new JDesktopPane();
    desktopPane.setBackground(Color.GRAY);
    desktopPane.setPreferredSize(new Dimension(750, 550));
  }
  return desktopPane;
}

代码示例来源:origin: stackoverflow.com

public class Window extends Frame {
  JScrollPane scrollContainer = new JScrollPane();
  JDesktopPane mainWorkingPane = new JDesktopPane();

  public Window() {
    scrollContainer.setViewportView(mainWorkingPane);

    addComponentListener(new ComponentAdapter() {
      public void componentResized(ComponentEvent evt) {
        revalidateDesktopPane();
      }
    });
  }

  private void revalidateDesktopPane() {
    Dimension dim = new Dimension(0,0);
    Component[] com = mainWorkingPane.getComponents();
    for (int i=0 ; i<com.length ; i++) {
      int w = (int) dim.getWidth()+com[i].getWidth();
      int h = (int) dim.getHeight()+com[i].getHeight();
      dim.setSize(new Dimension(w,h));
    }
    mainWorkingPane.setPreferredSize(dim);
    mainWorkingPane.revalidate();
    revalidate();
    repaint();  
  }
}

代码示例来源:origin: stackoverflow.com

class testDialog {

  public static void main(String[] args) {
   JDialog d = new JDialog();
   JDesktopPane desktoppane = new JDesktopPane(); // added
   desktoppane.setPreferredSize(new Dimension(100, 100));// added
   JInternalFrame i = new JInternalFrame("HI", false, false, false, false);
   // i.setPreferredSize(new Dimension(100, 100));
   i.setBounds(0, 0, 100, 100);// added
   desktoppane.add(i);
   i.setVisible(true);

   d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
   d.setTitle("Wait dialog");
   // d.add(i);
   d.add(desktoppane); // added
   d.pack();
   // d.setPreferredSize(new Dimension(100, 100));
   d.setLocation(300, 300);
   d.setAlwaysOnTop(true);
   d.setVisible(true);
  }
}

代码示例来源:origin: com.github.tntim96/rhino

getContentPane().add(contentPane, BorderLayout.CENTER);
desk = new JDesktopPane();
desk.setPreferredSize(new Dimension(600, 300));
desk.setMinimumSize(new Dimension(150, 50));
desk.add(console = new JSInternalConsole("JavaScript Console"));

代码示例来源:origin: ro.isdc.wro4j/rhino

getContentPane().add(contentPane, BorderLayout.CENTER);
desk = new JDesktopPane();
desk.setPreferredSize(new Dimension(600, 300));
desk.setMinimumSize(new Dimension(150, 50));
desk.add(console = new JSInternalConsole("JavaScript Console"));

代码示例来源:origin: com.github.houbie/rhino-mod

getContentPane().add(contentPane, BorderLayout.CENTER);
desk = new JDesktopPane();
desk.setPreferredSize(new Dimension(600, 300));
desk.setMinimumSize(new Dimension(150, 50));
desk.add(console = new JSInternalConsole("JavaScript Console"));

代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger

getContentPane().add(contentPane, BorderLayout.CENTER);
desk = new JDesktopPane();
desk.setPreferredSize(new Dimension(600, 300));
desk.setMinimumSize(new Dimension(150, 50));
desk.add(console = new JSInternalConsole("JavaScript Console"));

代码示例来源:origin: zolyfarkas/spf4j

desktopPane.setPreferredSize(new java.awt.Dimension(800, 600));
desktopPane.setLayout(null);

相关文章