java.awt.event.WindowAdapter源码实例Demo

java.awt.event.KeyAdapter#java.awt.event.WindowAdapter源码实例Demo

下面列出了java.awt.event.KeyAdapter#java.awt.event.WindowAdapter 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: FancyBing   文件: GoGui.java
private void createTree()
{
    m_gameTreeViewer = new GameTreeViewer(this, this, m_messageDialogs);
    m_gameTreeViewer.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                actionDisposeTree();
            }
        });
    GuiAction.registerAll(m_gameTreeViewer.getLayeredPane());
    m_gameTreeViewer.setLabelMode(m_treeLabels);
    m_gameTreeViewer.setSizeMode(m_treeSize);
    m_gameTreeViewer.setShowSubtreeSizes(m_showSubtreeSizes);
    restoreSize(m_gameTreeViewer, "tree");
    m_gameTreeViewer.update(getTree(), getCurrentNode());
    m_gameTreeViewer.setVisible(true);
}
 
源代码2 项目: PacketProxy   文件: GUIDiffDialogParent.java
public GUIDiffDialogParent(JFrame owner) throws Exception {
	super(owner);
	setTitle("Diff");

	Rectangle rect = owner.getBounds();
	width = rect.width - 100;
	height = rect.height - 100;
	setBounds(rect.x + rect.width/2 - width/2, rect.y + rect.height/2 - height/2, width, height); /* ド真ん中 */

	createPanel();
	Container c = getContentPane();
	c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS));
	c.add(main_panel);

	addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent event) {
			try {
				dispose();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	});
}
 
源代码3 项目: PacketProxy   文件: GUIFilterConfigDialog.java
public GUIFilterConfigDialog(JFrame owner) throws Exception {
	super(owner);
	this.owner = owner;
	setTitle(I18nString.get("Manage filters"));
	addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
    		dispose();
		}
	});
	
	Rectangle rect = owner.getBounds();
	setBounds(rect.x + rect.width/2 - width/2, rect.y + rect.height/2 - height/2, width, height); /* ド真ん中 */

	Container c = getContentPane();
	JPanel panel = new JPanel(); 
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(new GUIFilterConfig(owner).createPanel());
	c.add(panel);

}
 
源代码4 项目: SubTitleSearcher   文件: ExtractDialog.java
private void initComponents() {
	ExtractDialog _this = this;
	setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
	// setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
	setIconImage(MainWin.icon);
	setSize(820, 460);
	// setResizable(false);

	setLocationRelativeTo(this.getParent());
	setTitle("请选择压缩包中要保存的字幕文件");

	this.addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
			_this.clear();
			_this.dispose();
		}
	});

	add(bsPanel, BorderLayout.CENTER);
	openUrl(MainWin.class.getResource("/html/extract_dialog.html").toExternalForm());

}
 
源代码5 项目: JPPF   文件: NBodyRunner.java
/**
 * Create the UI.
 * @throws Exception if any error occurs.
 */
private static void createUI() throws Exception {
  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  final JFrame frame = new JFrame("N-Body demo");
  frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  frame.addWindowListener(new WindowAdapter() {
    @Override
    public void windowClosing(final WindowEvent e) {
      System.exit(0);
    }
  });
  final JPanel topPanel = new JPanel();
  label = new JLabel("Time steps: 0");
  label.setHorizontalAlignment(SwingConstants.LEFT);
  label.setAlignmentX(0f);
  topPanel.add(label, BorderLayout.WEST);
  frame.getContentPane().add(topPanel, BorderLayout.NORTH);
  panel = new NBodyPanel();
  final Dimension dim = new Dimension((int) radius, (int) radius);
  panel.setMinimumSize(dim);
  panel.setMaximumSize(dim);
  panel.setPreferredSize(dim);
  frame.getContentPane().add(panel, BorderLayout.CENTER);
  frame.setSize((int) radius + 50, (int) radius + 70);
  frame.setVisible(true);
}
 
源代码6 项目: MogwaiERDesignerNG   文件: ERDesignerMainFrame.java
public ERDesignerMainFrame() {
    super(ERDesignerBundle.TITLE);

    initialize();

    setSize(800, 600);
    setExtendedState(MAXIMIZED_BOTH);
    setIconImage(IconFactory.getERDesignerIcon().getImage());

    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            exitApplication();
        }
    });

    UIInitializer.getInstance().initialize(this);
    initTitle();
}
 
源代码7 项目: JavaGame   文件: MyFrame.java
/**
 * ���ش���
 */
public void loadFrame(){
	this.setTitle("����˹����");
	this.setSize(Constant.FRAME_WIDTH, Constant.FRAME_HEIGHT);
	this.setBackground(Color.WHITE);
	this.setLocationRelativeTo(null);//����
	this.setResizable(false);
	this.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			System.exit(0);
		}
	});
	
	this.setVisible(true);
	
	new MyThread().start();
}
 
源代码8 项目: JavaGame   文件: Client.java
public void loadFrame() {
	initRandomTree();
	this.setTitle("����");
	this.setSize(FRAME_WIDTH, FRAME_HEIGHT);
	this.setBackground(Color.WHITE);
	this.setLocationRelativeTo(null);// ����
	this.setResizable(false);
	this.setFont(new Font("��Բ", Font.BOLD, 20));
	this.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			System.exit(0);
		}
	});
	this.setLayout(null);
	this.initComponent();// ��ʼ�����
	this.setVisible(true);
}
 
源代码9 项目: JavaGame   文件: MyFrame.java
/**
 * �Զ������ɴ��ڵķ���
 * 
 * @throws InterruptedException
 */
public void launchFrame() {
	// ���ô��ڴ�С
	setSize(Constant.GAME_WIDTH, Constant.GAME_HEIGHT);
	// ���ô���λ��
	// setLocation(0, 0);
	setLocationRelativeTo(null);// ��Ծ��У�����null���������ʾ����Ļ
	// ���ô��ڱ���
	setTitle("�ɻ���ս");
	// ���ÿɼ�
	setVisible(true);
	// ���ò��ܸı��С
	setResizable(false);
	// ���ùرմ���
	addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			System.exit(0);// ���ùر�
		}
	});
	enableInputMethods(false);//�������뷨
	setBackground(Color.BLACK);

	new MyThread().start();

}
 
源代码10 项目: JavaGame   文件: MyFrame.java
/**
 * �Զ������ɴ��ڵķ���
 * 
 * @throws InterruptedException
 */
public void launchFrame() {
	// ���ô��ڴ�С
	setSize(Constant.GAME_WIDTH, Constant.GAME_HEIGHT);
	// ���ô���λ��
	// setLocation(0, 0);
	setLocationRelativeTo(null);// ��Ծ��У�����null���������ʾ����Ļ
	// ���ô��ڱ���
	setTitle("�ɻ���ս(�޾���)");
	// ���ÿɼ�
	setVisible(true);
	// ���ò��ܸı��С
	setResizable(false);
	// ���ùرմ���
	addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			System.exit(0);// ���ùر�
		}
	});
	enableInputMethods(false);//�������뷨
	setBackground(Color.BLACK);

	new MyThread().start();

}
 
源代码11 项目: JavaGame   文件: MyFrame.java
/**
 * ���ش���
 */
public void loadFrame(){
	this.setTitle("����˹����");
	this.setSize(Constant.FRAME_WIDTH, Constant.FRAME_HEIGHT);
	this.setBackground(Color.WHITE);
	this.setLocationRelativeTo(null);//����
	this.setResizable(false);
	this.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			System.exit(0);
		}
	});
	
	this.setVisible(true);
	new MyThread().start();
}
 
源代码12 项目: MeteoInfo   文件: MapLayout.java
/**
 * Show measurment form
 */
public void showMeasurementForm() {
    if (_frmMeasure == null) {
        _frmMeasure = new FrmMeasurement((JFrame) SwingUtilities.getWindowAncestor(this), false);
        _frmMeasure.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosed(WindowEvent e) {
                _currentLayoutMap.getMapFrame().getMapView().setDrawIdentiferShape(false);
                //repaint();
                repaintOld();
            }
        });
        _frmMeasure.setLocationRelativeTo(this);
        _frmMeasure.setVisible(true);
    } else if (!_frmMeasure.isVisible()) {
        _frmMeasure.setVisible(true);
    }
}
 
源代码13 项目: MeteoInfo   文件: Triangle.java
public static void main(String[] args) {

        final GLProfile gp = GLProfile.get(GLProfile.GL2);
        GLCapabilities cap = new GLCapabilities(gp);

        final GLCanvas gc = new GLCanvas(cap);
        Triangle tr = new Triangle();
        gc.addGLEventListener(tr);
        gc.setSize(400, 400);

        final JFrame frame = new JFrame("JOGL Triangle");
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent windowevent) {
                frame.dispose();
                System.exit(0);
            }
        });
        frame.add(gc);
        frame.setSize(500, 400);
        frame.setVisible(true);
    }
 
源代码14 项目: dragonwell8_jdk   文件: Font2DTest.java
private void loadComparisonPNG( String fileName ) {
    try {
        BufferedImage image =
            javax.imageio.ImageIO.read(new File(fileName));
        JFrame f = new JFrame( "Comparison PNG" );
        ImagePanel ip = new ImagePanel( image );
        f.setResizable( false );
        f.getContentPane().add( ip );
        f.addWindowListener( new WindowAdapter() {
            public void windowClosing( WindowEvent e ) {
                ( (JFrame) e.getSource() ).dispose();
            }
        });
        f.pack();
        f.show();
    }
    catch ( Exception ex ) {
        fireChangeStatus( "ERROR: Failed to Load PNG File; See Stack Trace", true );
        ex.printStackTrace();
    }
}
 
源代码15 项目: dragonwell8_jdk   文件: OutputViewer.java
private static void append(String s) {
    if (frame == null) {
        // FIXME: The frame title should be a localized string.
        frame = new JFrame("JConsole: Output");
        ta = new JTextArea();
        ta.setEditable(false);
        frame.getContentPane().add(new JScrollPane(ta));
        ta.setFont(new Font("Monospaced", Font.BOLD, 14));
        frame.setSize(500, 600);
        frame.setLocation(1024-500, 768-600);
        // Exit JConsole if no window remains.
        // e.g. jconsole -version only creates the OutputViewer
        // but no other window.
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                if (JFrame.getFrames().length == 1) {
                    System.exit(0);
                }
            }
        });
    }
    ta.append(s);
    ta.setCaretPosition(ta.getText().length());
    frame.setVisible(true);
}
 
private JFrame createMainFrame() {
    JFrame mainFrame = new JFrame();
    mainFrame.setTitle("Image Recognizer");
    mainFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    mainFrame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
    mainFrame.setLocationRelativeTo(null);
    mainFrame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            System.exit(0);
        }
    });
    ImageIcon imageIcon = new ImageIcon("icon.png");
    mainFrame.setIconImage(imageIcon.getImage());

    return mainFrame;
}
 
源代码17 项目: ghidra   文件: GraphAlgorithmsVisualDebugger.java
private TestGraphAlgorithmSteppingViewerPanel<TestV, TestE> showViewer(
		AlgorithmSteppingTaskMonitor steppingMonitor) {

	String isHeadless = Boolean.toString(false);
	System.setProperty(SystemUtilities.HEADLESS_PROPERTY, isHeadless);
	System.setProperty("java.awt.headless", isHeadless);

	JFrame frame = new JFrame("Graph");
	TestGraphAlgorithmSteppingViewerPanel<TestV, TestE> gp =
		new TestGraphAlgorithmSteppingViewerPanel<>(g, steppingMonitor);
	frame.getContentPane().add(gp);
	frame.setSize(800, 800);
	frame.setVisible(true);

	frame.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			steppingMonitor.cancel();
		}
	});

	return gp;
}
 
源代码18 项目: FancyBing   文件: GoGui.java
private void createAnalyzeDialog()
{
    m_analyzeDialog = new AnalyzeDialog(this, this, m_analyzeCommands,
                                        m_gtp, m_messageDialogs);
    m_analyzeDialog.setReuseTextWindow(
                    m_prefs.getBoolean("analyze-reuse-text-window", false));
    GuiAction.registerAll(m_analyzeDialog.getLayeredPane());
    m_analyzeDialog.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                actionDisposeAnalyzeDialog();
            }
        });
    m_analyzeDialog.setBoardSize(getBoardSize());
    m_analyzeDialog.setSelectedColor(getToMove());
    restoreSize(m_analyzeDialog, "analyze");
    m_analyzeDialog.setVisible(true);
}
 
源代码19 项目: arcusplatform   文件: ModelController.java
public Window show(Model model) {
   Window window = windows.computeIfAbsent(model.getAddress(), (address) -> {
      ModelTableView view = new ModelTableView();
      view.bind(new DefaultSelectionModel<Model>(model));
      
      JDialog dialog = new JDialog(null, model.getAddress(), ModalityType.MODELESS);
      dialog.add(new JScrollPane(view.getComponent()));
      dialog.setSize(600, 400);
      dialog.addWindowListener(new WindowAdapter() {
         /* (non-Javadoc)
          * @see java.awt.event.WindowAdapter#windowClosed(java.awt.event.WindowEvent)
          */
         @Override
         public void windowClosed(WindowEvent e) {
            view.dispose();
         }
      });
      
      return dialog;
   });
   window.setVisible(true);
   return window;
}
 
源代码20 项目: TencentKona-8   文件: TableExample2.java
public TableExample2(String URL, String driver, String user,
        String passwd, String query) {
    JFrame frame = new JFrame("Table");
    frame.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    JDBCAdapter dt = new JDBCAdapter(URL, driver, user, passwd);
    dt.executeQuery(query);

    // Create the table
    JTable tableView = new JTable(dt);

    JScrollPane scrollpane = new JScrollPane(tableView);
    scrollpane.setPreferredSize(new Dimension(700, 300));

    frame.getContentPane().add(scrollpane);
    frame.pack();
    frame.setVisible(true);
}
 
源代码21 项目: TencentKona-8   文件: MetalworksFrame.java
public MetalworksFrame() {
    super("Metalworks");
    final int inset = 50;
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setBounds(inset, inset, screenSize.width - inset * 2, screenSize.height - inset
            * 2);
    buildContent();
    buildMenus();
    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            quit();
        }
    });
    UIManager.addPropertyChangeListener(new UISwitchListener(
            (JComponent) getRootPane()));
}
 
源代码22 项目: SikuliX1   文件: ClickableWindow.java
public ClickableWindow(Guide guide) {
  super(new Color(0.1f, 0f, 0f, 0.005f), null);
  this.guide = guide;

  jp = getJPanel();

  mouseTracker = GlobalMouseMotionTracker.getInstance();
  mouseTracker.addListener(this);

  setVisible(false);
  setFocusableWindowState(false);

  addMouseListener(this);

  addWindowListener(new WindowAdapter() {
    public void windowClosed(WindowEvent e) {
      // stop the global mouse tracker's timer thread
      mouseTracker.stop();
    }
  });
}
 
源代码23 项目: opt4j   文件: PlotApplication.java
/**
 * Display the given plot. Unlike the two argument constructor, this does
 * not take command-line arguments, and does not fill the plot with a sample
 * plot.
 * 
 * @param plot
 *            The instance of Plot to display.
 */
public PlotApplication(PlotBox plot) {
	// Invoke the base class constructor and pass in the argument a Plot
	// object. This makes sure that the plot field is an instance of
	// Plot class.
	super("PlotApplication", plot);

	// Handle window closing by exiting the application.
	addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			// Strangely, calling _close() here sends javac into
			// an infinite loop (in jdk 1.1.4).
			// _close();
			System.exit(0);
		}
	});

	setVisible(true);
}
 
源代码24 项目: xdm   文件: VideoDownloadWindow.java
public VideoDownloadWindow(HttpMetadata metadata, String file) {
	// this.folder = Config.getInstance().getDownloadFolder();
	this.metadata = metadata;
	if (this.metadata == null) {
		this.metadata = new HttpMetadata();
	}

	initUI();

	if (file != null && file.length() > 0) {
		filePane.setFileName(file);
		// txtFile.setCaretPosition(0);
		originalExt = XDMUtils.getExtension(filePane.getFileName());
	}

	getRootPane().setDefaultButton(btnDN);

	addWindowListener(new WindowAdapter() {
		@Override
		public void windowActivated(WindowEvent e) {
			filePane.setFocus();
		}
	});

	queueId = "";
}
 
private void setupUI() {
    mainPanel = new JPanel(new BorderLayout());
    dialog.getContentPane().add(mainPanel);

    mainPanel.add(createOptionsPanel(), BorderLayout.NORTH);
    mainPanel.add(createCenterPanel(), BorderLayout.CENTER);
    mainPanel.add(createOkCancelPanel(), BorderLayout.SOUTH);

    mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    dialog.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            close(false);
        }
    });

    dialog.setSize(600, 750);
    dialog.setLocationRelativeTo(dialog.getParent());
}
 
源代码26 项目: jdk8u60   文件: TableExample2.java
public TableExample2(String URL, String driver, String user,
        String passwd, String query) {
    JFrame frame = new JFrame("Table");
    frame.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    JDBCAdapter dt = new JDBCAdapter(URL, driver, user, passwd);
    dt.executeQuery(query);

    // Create the table
    JTable tableView = new JTable(dt);

    JScrollPane scrollpane = new JScrollPane(tableView);
    scrollpane.setPreferredSize(new Dimension(700, 300));

    frame.getContentPane().add(scrollpane);
    frame.pack();
    frame.setVisible(true);
}
 
源代码27 项目: openjdk-jdk8u   文件: OutputViewer.java
private static void append(String s) {
    if (frame == null) {
        // FIXME: The frame title should be a localized string.
        frame = new JFrame("JConsole: Output");
        ta = new JTextArea();
        ta.setEditable(false);
        frame.getContentPane().add(new JScrollPane(ta));
        ta.setFont(new Font("Monospaced", Font.BOLD, 14));
        frame.setSize(500, 600);
        frame.setLocation(1024-500, 768-600);
        // Exit JConsole if no window remains.
        // e.g. jconsole -version only creates the OutputViewer
        // but no other window.
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                if (JFrame.getFrames().length == 1) {
                    System.exit(0);
                }
            }
        });
    }
    ta.append(s);
    ta.setCaretPosition(ta.getText().length());
    frame.setVisible(true);
}
 
源代码28 项目: jdk8u60   文件: Font2DTest.java
private void loadComparisonPNG( String fileName ) {
    try {
        BufferedImage image =
            javax.imageio.ImageIO.read(new File(fileName));
        JFrame f = new JFrame( "Comparison PNG" );
        ImagePanel ip = new ImagePanel( image );
        f.setResizable( false );
        f.getContentPane().add( ip );
        f.addWindowListener( new WindowAdapter() {
            public void windowClosing( WindowEvent e ) {
                ( (JFrame) e.getSource() ).dispose();
            }
        });
        f.pack();
        f.show();
    }
    catch ( Exception ex ) {
        fireChangeStatus( "ERROR: Failed to Load PNG File; See Stack Trace", true );
        ex.printStackTrace();
    }
}
 
源代码29 项目: jdk8u60   文件: OutputViewer.java
private static void append(String s) {
    if (frame == null) {
        // FIXME: The frame title should be a localized string.
        frame = new JFrame("JConsole: Output");
        ta = new JTextArea();
        ta.setEditable(false);
        frame.getContentPane().add(new JScrollPane(ta));
        ta.setFont(new Font("Monospaced", Font.BOLD, 14));
        frame.setSize(500, 600);
        frame.setLocation(1024-500, 768-600);
        // Exit JConsole if no window remains.
        // e.g. jconsole -version only creates the OutputViewer
        // but no other window.
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                if (JFrame.getFrames().length == 1) {
                    System.exit(0);
                }
            }
        });
    }
    ta.append(s);
    ta.setCaretPosition(ta.getText().length());
    frame.setVisible(true);
}
 
public GLVisualProcessorDemo() {
    frame = new Frame("JOGL Tester");
    frame.setSize(1920, 1080);
    frame.setResizable(false);
    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            frame.dispose();
            System.exit(0);
        }
    });
}
 
源代码评论
动弹
沙发等你来抢
 方法所在类