zoukankan      html  css  js  c++  java
  • 如何在JApplet中显示一个JDialog,并让其在屏幕居中显示

    先把JDialog的类创建好,在Netbeans中通过GUI的界面可以把界面画好。然后调用的方法是这样: 
    Frame f = (Frame)SwingUtilities.getAncestorOfClass(Frame.classthis);
    AddNodeDialog and 
    = new AddNodeDialog(f, props.getProperty("setsharetree.addnodedlg.title"), true);
    and.setProps(props);
    and.setUserListString(allUserString);
    and.setPrjListString(allProjectString);
    and.setDeptListString(allDeptString);
    and.customInit();
    // Define AddNodeDialog Postion
    int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
    int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
    and.setLocation((screenWidth 
    - and.getSize().width) / 2, (screenHeight - and.getSize().height) / 2);
    and.pack();
    and.setVisible(
    true);
  • 相关阅读:
    Arduino
    DTU
    现代信号处理与应用
    matlab学习记录
    列车准点节能操纵
    泊松过程
    序号生成算法odoo
    操作系统特性
    c语言中的变量
    xml中的四则运算与时间爱格式
  • 原文地址:https://www.cnblogs.com/super119/p/1924536.html
Copyright © 2011-2022 走看看