private void makeWindow() { dialog = new java.awt.Dialog(IJ.getInstance(), "Loading...", false); dialog.setUndecorated(true); bytes = new Label("Loaded: 0 bytes "); speed = new Label("Speed: 0 bytes/s "); time = new Label ("Elapsed time: 0 s "); dialog.setLayout(new GridLayout(3,1)); dialog.addWindowListener(new java.awt.event.WindowAdapter() { public void windowDeactivated(java.awt.event.WindowEvent we) { dialog.toFront(); } }); dialog.add(time); dialog.add(bytes); dialog.add(speed); java.awt.Dimension screen = dialog.getToolkit().getScreenSize(); dialog.pack(); dialog.setLocation(screen.width/2 - dialog.getWidth()/2, screen.height/2 - dialog.getHeight()/2); //dialog.setVisible(true); } Monitor(Connection con) {
/** * Test la version de java. */ public FudaaCommandLineParser() { // Verif version JVM if (System.getProperty("java.version").compareTo("1.2") < 0) { System.err.println("JVM >= 1.2 needed"); final Dialog dlg = new Dialog(new Frame(), "Error", true); dlg.addWindowListener(new WindowAdapter() { public void windowClosing(final WindowEvent _e) { System.exit(-1); // B.M. 27/08/99 Supprim pour cause d'exception disgracieuse l'cran // ((Dialog)e.getSource()).dispose(); } }); dlg.setLayout(new BorderLayout()); dlg.add(new Label("JVM >= 1.2 needed"), BorderLayout.CENTER); final Button okBut = new Button("OK"); okBut.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { System.exit(-1); // B.M. 27/08/99 Supprim pour cause d'exception disgracieuse l'cran // ((Dialog)((Button)e.getSource()).getParent()).dispose(); } }); dlg.add(okBut, BorderLayout.SOUTH); dlg.pack(); dlg.show(); } }
Dialog dialog = new Dialog(); dialog.add(new NewWidget()); dialog.show();
public static void showMessageDialog(Component parentComponent, String message, String title, int messageType) { final Dialog dialog = new Dialog(getFrame(parentComponent), title); dialog.setModal(true); dialog.setLayout(new BorderLayout()); dialog.add(new Label(message), BorderLayout.CENTER); Panel panel = new Panel(); Button btOk = new Button("OK"); panel.add(btOk); dialog.add(panel, BorderLayout.SOUTH); dialog.pack(); dialog.addWindowListener(windowListener); btOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { dialog.hide(); } }); dialog.show(); }
dialog.add(new Label(message), BorderLayout.WEST); dialog.add(tfInput, BorderLayout.CENTER); Panel panel = new Panel(); Button btOk = new Button("OK"); Button btCancel = new Button("Cancel"); panel.add(btCancel); dialog.add(panel, BorderLayout.SOUTH); dialog.pack(); dialog.addWindowListener(windowListener);
mainFrame.add(showFileDialogButton); mainFrame.setVisible(true);
fullscreenDialog = new JDialog(detachedWindow ? oldDialog : frame, titleDialog, ModalityType.APPLICATION_MODAL); fullscreenDialog.add(grid, BorderLayout.CENTER); fullscreenDialog.addWindowListener(new WindowAdapter() {
prompt.addKeyListener(this); northPanel.add(prompt); dialog.add(northPanel, BorderLayout.NORTH); functions = new List(12); functions.addKeyListener(this); populateList(""); dialog.add(functions, BorderLayout.CENTER); Panel buttonPanel = new Panel(); insertButton = new Button("Insert"); closeButton.addActionListener(this); buttonPanel.add(closeButton); dialog.add(buttonPanel, BorderLayout.SOUTH); dialog.pack();
prompt.addKeyListener(this); northPanel.add(prompt); dialog.add(northPanel, BorderLayout.NORTH); functions = new List(12); functions.addKeyListener(this); populateList(""); dialog.add(functions, BorderLayout.CENTER); Panel buttonPanel = new Panel(); insertButton = new Button("Insert"); closeButton.addActionListener(this); buttonPanel.add(closeButton); dialog.add(buttonPanel, BorderLayout.SOUTH); dialog.pack();
help = addButton("Help"); dialog.add(panel); dialog.pack(); if (pos.x < 0 || pos.y < 0) GUI.center(dialog);
text.setBackground(Color.WHITE); text.setFont(new Font("Monospaced", 0, 12)); this._dialog.add(text); Panel buttonPanel = new Panel(); this._abort = new Button("Abort"); buttonPanel.add(this._ignore); buttonPanel.setLayout(new BoxLayout(buttonPanel, 0)); this._dialog.add(buttonPanel); this._dialog.setLayout(new BoxLayout(this._dialog, 1)); this._dialog.pack();
helpButton = addButton("Help"); dialog.add(panel); dialog.pack(); if (position.x < 0 || position.y < 0) GUI.center(dialog);
dialog.add(panel); dialog.pack(); if (position.x < 0 || position.y < 0) GUI.center(dialog);