Remove “X” button in Swing JDialog

前端 未结 6 884
时光说笑
时光说笑 2020-12-08 18:18

Is there a way to remove the close button (\"X\") from the JDialog title bar?

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 19:06

    static public void removeButtons(Component c){
        if (c instanceof AbstractButton){
            String accn = c.getAccessibleContext().getAccessibleName();
            Container p=c.getParent();
            //log.debug("remove button %s from %s",accn,p.getClass().getName());
            c.getParent().remove(c);
        }
        else if (c instanceof Container){
            //log.debug("processing components of %s",c.getClass().getName());
            Component[] comps = ((Container)c).getComponents();
            for(int i = 0; i

提交回复
热议问题