Java 类javax.swing.WindowConstants 实例源码

项目:trashjam2017    文件:ParticleEditor.java   
/**
     * init the graph editor window
     */
    private void initGraphEditorWindow()
    {
        // create the window
        GraphEditorWindow editor = new GraphEditorWindow();

        whiskasPanel.setEditor(editor);

        graphEditorFrame= new JFrame("Whiskas Gradient Editor");
        graphEditorFrame.getContentPane().add(editor);
        graphEditorFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
        graphEditorFrame.pack();
        graphEditorFrame.setSize(600, 300);
        graphEditorFrame.setLocation(this.getX(), this.getY()+this.getHeight());
        graphEditorFrame.setVisible(true);

//      try {
//          InputStream in = ParticleEditor.class.getClassLoader().getResourceAsStream("org/newdawn/slick/tools/peditor/data/icon.gif");
//          
//          //graphEditorFrame.setIconImage(ImageIO.read(in));
//      } catch (IOException e) {
//          e.printStackTrace();
//      }
    }
项目:AgentWorkbench    文件:JadeSetupNewPort.java   
/**
 * This method initialises this
 */
private void initialize() {

    this.setSize(new Dimension(420, 46));
    this.setUndecorated(true);
    this.setTitle("Set Jade-LocalPort ...");
    this.setModal(true);
    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.setResizable(false);
    this.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent evt) {
            canceled = true;
            setVisible(false);
        }
    });
    this.setContentPane(getJContentPane());

    // --- ESCAPE abfangen --------------------------------------
    this.getRootPane().registerKeyboardAction(this, "KeyESCAPE", keyStrokeESCAPE, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    this.getRootPane().registerKeyboardAction(this, "KeyENTER", keyStrokeENTER,JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

    // --- Position des Dialogs einstellen ----------------------
    this.setLocation(currPosition.x, currPosition.y-11);

}
项目:AgentWorkbench    文件:BenchmarkMonitor.java   
/**
 * Initialize.
 */
private void initialize() {

    this.setSize(506, 185);
    this.setContentPane(getJContentPane());

    this.setTitle(Application.getGlobalInfo().getApplicationTitle() + ": SciMark 2.0 - Benchmark");
    this.setIconImage(imageAgentGUI);

    this.setLookAndFeel();

    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.getContentPane().setPreferredSize(this.getSize());
    this.setLocationRelativeTo(null);

    // --- Translations ----
    jLabelBenchmark.setText(Language.translate("Bitte warten! Der Benchmark wird durchgeführt ..."));
    jLabelBenchmarkOldCaption.setText(Language.translate("Alter Wert: "));
    jButtonSkip.setText(Language.translate("Überspringen"));
    jButtonSkipAlways.setText(Language.translate("Immer überspringen"));

}
项目:AgentWorkbench    文件:BasicGraphGuiProperties.java   
/**
 * This method initializes this
 * @return void
 */
private void initialize() {

    this.setAutoscrolls(true);
    this.setMaximizable(true);
    this.setResizable(true);
    this.setIconifiable(true);

    this.setClosable(true);
    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    this.setTitle("Component");

    // --- Remove Frame menu ----------------
    BasicInternalFrameUI ui = (BasicInternalFrameUI)this.getUI();
    ui.getNorthPane().remove(0);

    this.addInternalFrameListener(new InternalFrameAdapter() {
        @Override
        public void internalFrameClosing(InternalFrameEvent ife) {
            doClose();
        }
    });

    this.configureForGraphObject();
    this.setContentPane(this.getJContentPane());
    this.setSize(this.defaultWidth, this.defaultHeight);
    this.setInitialSizeAndPosition();

    // --- Call to the super-class ----------
    this.registerAtDesktopAndSetVisible();

}
项目:AgentWorkbench    文件:SystemLoadDialog.java   
/**
 * This method initialises this.
 */
private void initialize() {

    this.setSize(620, 120);
    this.setIconImage(GlobalInfo.getInternalImage("AgentGUI.png"));
    this.setTitle(Application.getGlobalInfo().getApplicationTitle() + ": " + Language.translate("Load Monitor"));
    this.setLookAndFeel();
    this.setContentPane(this.getSystemLoadPanel());     

    // --- Add a WindowsListener --------------------------------
    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            setVisible(false);
        }
    });
}
项目:jdk8u-jdk    文件:TexturePaintPrintingTest.java   
private static void printTexture() {
    f = new JFrame("Texture Printing Test");
    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    final TexturePaintPrintingTest gpt = new TexturePaintPrintingTest();
    Container c = f.getContentPane();
    c.add(BorderLayout.CENTER, gpt);

    final JButton print = new JButton("Print");
    print.addActionListener(new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            PrinterJob job = PrinterJob.getPrinterJob();
            job.setPrintable(gpt);
            final boolean doPrint = job.printDialog();
            if (doPrint) {
                try {
                    job.print();
                } catch (PrinterException ex) {
                    throw new RuntimeException(ex);
                }
            }
        }
    });
    c.add(print, BorderLayout.SOUTH);

    f.pack();
    f.setVisible(true);
}
项目:AgentWorkbench    文件:AgentSelector.java   
/**
 * This method initializes this.
 */
private void initialize() {

    this.setSize(720, 500);
    this.setTitle("Auswahl - Agenten");
    this.setIconImage(GlobalInfo.getInternalImage("AgentGUI.png"));
    this.setModal(true);
    this.setContentPane(getJContentPane());
    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent evt) {
            canceled = true;
            setVisible(false);
        }
    });
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 
    int top = (screenSize.height - this.getHeight()) / 2; 
    int left = (screenSize.width - this.getWidth()) / 2; 
    this.setLocation(left, top);    

    // --- Translate -----------------------------
    this.setTitle(Language.translate("Auswahl - Agenten"));
    jLabelSearchCaption.setText(Language.translate("Suche"));
    jButtonOk.setText(Language.translate("Hinzufügen"));
    jButtonCancel.setText(Language.translate("Abbrechen"));
}
项目:AgentWorkbench    文件:ZipperMonitor.java   
/**
 * Initialize
 */
private void initialize() {

    this.setSize(542, 194);
    this.setContentPane(getJContentPane());

    if (this.appName!=null) {
        this.setTitle(this.appName + ": Zip-Monitor");  
    } else {
        this.setTitle("Zip-Monitor");
    }
    this.setIconImage(this.iconImage);
    this.setLookAndFeel();

    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.getContentPane().setPreferredSize(this.getSize());
    this.setLocationRelativeTo(null);
    this.setAlwaysOnTop(true);

    // --- Translate ----
    this.getJButtonCancel().setText(Language.translate("Abbruch"));

}
项目:AgentWorkbench    文件:ClassSelectionDialog.java   
/**
     * This method initializes this dialog.
     */
    private void initialize() {

        this.setSize(730, 606);
        this.setContentPane(this.getClassSelectionPanel());
        this.setTitle("Class-Selector");
        this.setModal(true);        
        this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        this.registerEscapeKeyStroke();
        this.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent evt) {
                setCanceled(true);
                setVisible(false);
            }
        });

        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 
        int top = (screenSize.height - this.getHeight()) / 2; 
        int left = (screenSize.width - this.getWidth()) / 2; 
        this.setLocation(left, top);

        // --- Add this dialog as a listener to the ClassSelectorPanel -------- 
//      this.classSelectionPanel.addClassSelectionListener(this);

    }
项目:openjdk-jdk10    文件:NormalBoundsTest.java   
private static void createUI(String lookAndFeelString) {
    internalFrame = new JInternalFrame("Internal", true, true, true, true);
    internalFrame.setDefaultCloseOperation(
            WindowConstants.DO_NOTHING_ON_CLOSE);
    internalFrame.setSize(200, 200);

    JDesktopPane desktopPane = new JDesktopPane();
    desktopPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
    desktopPane.add(internalFrame);

    mainFrame = new JFrame(lookAndFeelString);
    mainFrame.setSize(640, 480);
    mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    mainFrame.setContentPane(desktopPane);

    mainFrame.setVisible(true);
    internalFrame.setVisible(true);

}
项目:Logisim    文件:Main.java   
private static void showFrame(Drawing model, String title) {
    JFrame frame = new JFrame(title);
    DrawingAttributeSet attrs = new DrawingAttributeSet();

    Canvas canvas = new Canvas();
    Toolbar toolbar = new Toolbar(canvas, attrs);
    canvas.setModel(model, new UndoLogDispatcher(new UndoLog()));
    canvas.setTool(toolbar.getDefaultTool());

    AttrTable table = new AttrTable(frame);
    AttrTableDrawManager manager = new AttrTableDrawManager(canvas, table, attrs);
    manager.attributesSelected();
    HorizontalSplitPane west = new HorizontalSplitPane(toolbar, table, 0.5);
    VerticalSplitPane all = new VerticalSplitPane(west, canvas, 0.3);

    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.getContentPane().add(all, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
}
项目:jmt    文件:DefaultsEditor.java   
/**
 * Initialize parameters of the window (size, title)... Then calls <code>initComponents</code>
 * @param target target application (JMODEL or JSIM)
 */
protected void initWindow(int target) {
    this.target = target;
    // Sets default title, close operation and dimensions
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Editing Default Parameters...");
    int width = 840, height = 600;

    // Centers this dialog on the screen
    Dimension scrDim = Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((scrDim.width - width) / 2, (scrDim.height - height) / 2, width, height);
    // If user closes this window, act as cancel and reloads saved parameters
    addWindowStateListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            Defaults.reload();
        }
    });
    initComponents(target);
}
项目:Progetto-C    文件:ParticleEditor.java   
/**
     * init the graph editor window
     */
    private void initGraphEditorWindow()
    {
        // create the window
        GraphEditorWindow editor = new GraphEditorWindow();

        whiskasPanel.setEditor(editor);

        graphEditorFrame= new JFrame("Whiskas Gradient Editor");
        graphEditorFrame.getContentPane().add(editor);
        graphEditorFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
        graphEditorFrame.pack();
        graphEditorFrame.setSize(600, 300);
        graphEditorFrame.setLocation(this.getX(), this.getY()+this.getHeight());
        graphEditorFrame.setVisible(true);

//      try {
//          InputStream in = ParticleEditor.class.getClassLoader().getResourceAsStream("org/newdawn/slick/tools/peditor/data/icon.gif");
//          
//          //graphEditorFrame.setIconImage(ImageIO.read(in));
//      } catch (IOException e) {
//          e.printStackTrace();
//      }
    }
项目:lazycat    文件:MainFrame.java   
private MainFrame() {
    this.setSize(800, 600);
    this.setTitle("Tomcat ������������� - powered by how2j.cn");
    this.setContentPane(MainPanel.instance);
    this.setLocationRelativeTo(null);
    this.setResizable(false);
    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(MainFrame.instance, "Ҫ�˳���"))
                System.exit(1);
            else
                MainFrame.this.setState(JFrame.ICONIFIED);
        }
    });

}
项目:openjdk-jdk10    文件:bug8136998.java   
private void setupUI() {
    frame = new JFrame();
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    comboBox = new JComboBox<>(ITEMS);

    JPanel scrollable = new JPanel();
    scrollable.setLayout(new BoxLayout(scrollable, BoxLayout.Y_AXIS));

    scrollable.add(Box.createVerticalStrut(200));
    scrollable.add(comboBox);
    scrollable.add(Box.createVerticalStrut(200));

    scrollPane = new JScrollPane(scrollable);

    frame.add(scrollPane);

    frame.setSize(100, 200);
    frame.setVisible(true);
}
项目:hy.common.ui    文件:JDateTimeTest.java   
public static void main(String [] args)
{
    JFrame    v_Frame    = new JFrame(); 
    JButton   v_Button   = new JButton("设置时间");
       JDateTime v_DateTime = new JDateTime();

    v_DateTime.addActionListener(new JDateTimeActionListener(v_DateTime));
    v_Button.addActionListener(new ButtonActionListener(v_DateTime ,v_Button));

    v_Frame.getContentPane().setLayout(new BorderLayout());
    v_Frame.getContentPane().add(v_Button ,BorderLayout.NORTH);

    v_Frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    v_Frame.setSize(800, 600);
    v_Frame.setVisible(true);
}
项目:QN-ACTR-Release    文件:DefaultsEditor.java   
/**
 * Initialize parameters of the window (size, title)... Then calls <code>initComponents</code>
 * @param target target application (JMODEL or JSIM)
 */
protected void initWindow(int target) {
    this.target = target;
    // Sets default title, close operation and dimensions
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setTitle("Editing Default Values...");
    int width = 648, height = 480;

    // Centers this dialog on the screen
    Dimension scrDim = Toolkit.getDefaultToolkit().getScreenSize();
    this.setBounds((scrDim.width - width) / 2, (scrDim.height - height) / 2, width, height);
    // If user closes this window, act as cancel and reloads saved parameters
    this.addWindowStateListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            Defaults.reload();
        }
    });
    initComponents(target);
}
项目:QN-ACTR-Release    文件:StartScreen.java   
public StartScreen() {
    super(true, "JMT - Java Modelling Tools");
    this.centerWindow(WIDTH, HEIGHT);
    //close this window if proper button pressed
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setResizable(false);
    //loads all of the Images that will be shown in this window
    loadImages();
    //add components of this window
    buildWindowComponents();
    //add all of the listeners
    addListeners();
    if (isImageLoaded(IMG_SUITEICON)) {
        Image jmtIcon = imageIcons.get(IMG_SUITEICON).getImage();
        this.setIconImage(jmtIcon.getScaledInstance(16, 16, Image.SCALE_SMOOTH));
    }
    sampleQNAni.start();

    //TODO: ONCE SIMULATOR WILL BE WORKING PERFECTLY, REMOVE THIS LINE.
    simAppl.setEnabled(false);
}
项目:school-game    文件:ToolsLauncher.java   
/**
 * Konstruktor.
 * Erstellt das Fenster.
 */
public ToolsLauncher()
{
    super("School Game Tools");

    int startWidth = Math.round((float)getScreenSize().getWidth() * 0.4f);
    int startHeight = Math.round((float)getScreenSize().getHeight() * 0.4f);

    setSize(startWidth, startHeight);
    setMaximumSize(new Dimension(getScreenSize().width - 50, getScreenSize().height - 80));
    setMinimumSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
    randomPosition();

    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    fillWindow();

    setVisible(true);
}
项目:discord-rpc-java    文件:SimpleGame.java   
public static void main(String[] args)
{
    if (args.length == 0)
        System.err.println("You need to provide a application id");
    else
    {
        JFrame frame = new JFrame("Discord-RPC-Java");

        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

        frame.pack();

        frame.setVisible(true);
        SimpleGame.run(args[0]);

        frame.dispose();

        System.out.println("Exiting");
    }
}
项目:JavaGraph    文件:ConfigDialog.java   
/**
 * Makes the dialog visible, and upon exit, returns the configuration to be started.
 * @return the selected configuration if the dialog was exited by the start action,
 * {@code null} if it was exited in another fashion.
 */
public Object getConfiguration() {
    // construct the window
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Exploration configurations");
    JPanel contentPanel = new JPanel(new BorderLayout(3, 3));
    contentPanel.setBorder(createEmptyBorder());
    contentPanel.add(getListPanel(), BorderLayout.WEST);
    contentPanel.add(getConfigPanel(), BorderLayout.CENTER);
    ToolTipManager.sharedInstance()
        .registerComponent(contentPanel);
    setContentPane(contentPanel);
    pack();
    setVisible(true);
    return isStart() ? getConfigMap().get(getSelectedName()) : null;
}
项目:JavaGraph    文件:ExploreAction.java   
/**
 * Creates a modal dialog that will interrupt this thread, when the
 * cancel button is pressed.
 */
private JDialog createCancelDialog() {
    JDialog result;
    // create message dialog
    JOptionPane message = new JOptionPane(
        isAnimated() ? getAnimationPanel()
            : new Object[] {getStateCountLabel(), getTransitionCountLabel()},
        JOptionPane.PLAIN_MESSAGE);
    message.setOptions(new Object[] {getCancelButton()});
    result = message.createDialog(getFrame(), "Exploring state space");
    result.pack();
    result.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    result.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            ExploreThread.this.interrupt();
        }
    });
    result.setAlwaysOnTop(true);
    return result;
}
项目:JavaGraph    文件:PdfDialog.java   
/** Creates a new dialog. */
public PdfDialog(JFrame owner) {
    super(owner, "Select graphs to export", true);

    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent we) {
            close();
        }
    });
    ActionListener actionListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    };
    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    this.getRootPane()
        .registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    buildGUI();
}
项目:Dise-o-2017    文件:ControladorGestionarTipoImpuesto.java   
public void mostrarPantallaModificacionEmpresa(Object object,String cuitEmpresa){
    DTOTipoImpuesto dtoTi = obtenerTipoImpuesto((int) object);
    if (dtoTi != null) {
        IUGestionarTipoImpuestoModificarEmpresa pantallaModificarEmpresa = new IUGestionarTipoImpuestoModificarEmpresa(cuitEmpresa);
        pantallaModificarEmpresa.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); // Evito que se cierre al presionar x
        pantallaModificarEmpresa.setVisible(true); // La hago visible
        // Modifico la operación de cierre para volver a la pantalla principal
        pantallaModificarEmpresa.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        pantallaModificarEmpresa.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent ev) {
                iniciar();
            }
        });
        pantallaModificarEmpresa.setNombre_actual(dtoTi.getNombreDTOTipoImpuesto());
        pantallaModificarEmpresa.setTextfield_nombre(dtoTi.getNombreDTOTipoImpuesto());
        pantallaModificarEmpresa.setCheckbox_esEditable(dtoTi.isEsMontoEditableDTOTipoImpuesto());
        if (dtoTi.getFechaHoraInhabilitacionDTOTipoImpuesto() == null) {
            pantallaModificarEmpresa.setCheckbox_Habilitar(true);
        } else {
            pantallaModificarEmpresa.setCheckbox_Habilitar(false);
        }
    }
}
项目:Equella    文件:SecurityTree.java   
public void showDialog(Component parent)
{
    dialog = ComponentHelper.createJDialog(parent);
    dialog.setTitle(CurrentLocale.get(
        "com.tle.admin.security.tree.securitytree.title", Driver.instance().getInstitutionName())); //$NON-NLS-1$
    dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    dialog.setModal(true);
    dialog.setContentPane(content);

    dialog.addWindowListener(new WindowAdapter()
    {
        @Override
        public void windowClosing(WindowEvent e)
        {
            attemptToCloseWindow();
        }
    });

    ComponentHelper.percentageOfScreen(dialog, 0.9f, 0.9f);
    ComponentHelper.centreOnScreen(dialog);

    dialog.setVisible(true);
}
项目:Equella    文件:PartiallyLockedDialog.java   
public boolean askToUnlock(Component parent)
{
    dialog = ComponentHelper.createJDialog(parent);
    dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    dialog.getRootPane().setDefaultButton(close);
    dialog.setTitle(CurrentLocale.get("com.tle.admin.schema.manager.partiallylockeddialog.title")); //$NON-NLS-1$
    dialog.setContentPane(content);
    dialog.setModal(true);

    dialog.setSize(WINDOW_SIZE);
    ComponentHelper.centreOnScreen(dialog);

    dialog.setVisible(true);
    dialog = null;

    return doUnlock;
}
项目:openjdk-jdk10    文件:StyledFontLayoutTest.java   
public static void main(String[] args) {

        interactive = args.length > 0;

        runTest();

        if (!interactive) {
            return;
        }
        SwingUtilities.invokeLater(() -> {
            JFrame frame = new JFrame("Styled Font Layout Test");
            frame.add(new StyledFontLayoutTest());
            frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            frame.setSize(W, H);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        });
    }
项目:JPA-Demo    文件:ImageWindow.java   
public void showBlob(final InputStream stream) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            editorFrame = new JFrame("Image Window");
            editorFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
            BufferedImage image = null;
            try {
                image = ImageIO.read(stream);
            } catch (Exception e) {
                e.printStackTrace();
                System.exit(1);
            }
            ImageIcon imageIcon = new ImageIcon(image);
            JLabel jLabel = new JLabel();
            jLabel.setIcon(imageIcon);
            editorFrame.getContentPane().add(jLabel, BorderLayout.CENTER);

            editorFrame.pack();
            editorFrame.setLocationRelativeTo(null);
            editorFrame.setVisible(true);
        }
    });
}
项目:JavaCourse    文件:Main.java   
/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 */
static void createAndShowGUI(JLabel worldLabel, JLabel statusLabel) {
    // Create and set up the window.
    JFrame frame = new JFrame("Blockworld");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    // add both labels in a vertical layout
    Container content = frame.getContentPane();
    content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS));
    content.add(worldLabel);
    content.add(statusLabel);

    // Display the window.
    frame.pack();
    frame.setVisible(true);

}
项目:poi-visualizer    文件:POIMainFrame.java   
@PostConstruct
public void init() {
    if (isInit) {
        return;
    }

    isInit = true;

    topMenu.init();
    setJMenuBar(topMenu);

    contextMenu.init();
    xmlEditor.init();

       contentArea.addTab("binary", codeArea);
       contentArea.addTab("xml", xmlEditor);

       JScrollPane propScroll = new JScrollPane(propertiesArea);
       contentArea.addTab("properties", propScroll);
    add(splitPane);

    treeDir.addTreeSelectionListener(this::loadEntry);
    treeDir.addMouseListener(MLFactory.mousePopup(contextMenu::handleEntryClick));
       treeObservable.addObserver(this::updateCodeArea);
       treeObservable.addObserver(this::updateProperties);
       addWindowListener(WLFactory.windowClosed(this::shutdown));

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setLocationByPlatform(true);
    setSize(1000,600);
   }
项目:incubator-netbeans    文件:GUI.java   
/** Creates a new instance of GUI */
public GUI() {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            ComparePanel p = new ComparePanel();
            f.add(p);
            f.pack();
            f.setVisible(true);
        }
    });
}
项目:incubator-netbeans    文件:NbPresenter.java   
private void initialize(NotifyDescriptor d) {
    //Optimization related to jdk bug 4393857 - on pre 1.5 jdk's an
    //extra repaint is caused by the search for an opaque component up
    //to the component root. Post 1.5, root pane will automatically be
    //opaque.
    getRootPane().setOpaque(true);

    if (d instanceof WizardDescriptor || d.isNoDefaultClose() ) {
        // #81938: wizard close button shouln't work during finish progress
        setDefaultCloseOperation (WindowConstants.DO_NOTHING_ON_CLOSE);
    } else {
        // #55273: Dialogs created by DialogDisplayer are not disposed after close
        setDefaultCloseOperation (WindowConstants.DISPOSE_ON_CLOSE);
    }
    if (!Constants.AUTO_FOCUS) {
        setAutoRequestFocus(false);
    }

    descriptor = d;

    buttonListener = new ButtonListener();
    // set leaf by DialogDescriptor, NotifyDescriptor is leaf as default
    leaf = d instanceof DialogDescriptor ? ((DialogDescriptor)d).isLeaf () : true;

    getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
            KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), ESCAPE_COMMAND);
    getRootPane().getActionMap().put(ESCAPE_COMMAND, new EscapeAction());

    initializePresenter();

    pack();

    initBounds();
}
项目:incubator-netbeans    文件:TargetMappingPanel.java   
public static void main(String[] ignore) {
    boolean[] adv = {false, true};
    for (int j = 0; j < adv.length; j++) {
        JDialog dlg = new JDialog((Frame) null, "advancedMode=" + adv[j], false); // NOI18N
        dlg.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        TargetMappingPanel panel = new TargetMappingPanel(adv[j]);
        panel.setTargetNames(new ArrayList<String>(Arrays.asList("build", "clean", "test")), true); // NOI18N
        dlg.getContentPane().add(panel);
        dlg.pack();
        dlg.setSize(700, 500);
        dlg.setVisible(true);
    }
}
项目:AgentWorkbench    文件:ProjectWindow.java   
/**
 * This method initializes this.
 */
private void initialize() {

    this.setSize(850, 500);
    this.setContentPane(this.getJSplitPaneProjectView());
    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.setClosable(true);
    this.setMaximizable(true);
    this.setResizable(false);
    this.setAutoscrolls(true);
    this.setBorder(null);
    this.setFocusable(true);
    ((BasicInternalFrameUI) this.getUI()).setNorthPane(null);
}
项目:AgentWorkbench    文件:ProjectNewOpen.java   
/**
 * This method initializes this.
 * @return void
 */
private void initialize() {
    this.setSize(543, 412);
    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.setResizable(true);
    this.setModal(true);
    this.setContentPane(getJContentPane());
    this.registerEscapeKeyStroke();
    this.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent evt) {
            Canceled = true;
            setVisible(false);
        }
    });
}
项目:AgentWorkbench    文件:ThreadMonitor.java   
/**
 * Initialize.
 */
private void initialize() {

    this.setSize(800, 600);

    this.setIconImage(GlobalInfo.getInternalImage("AgentGUI.png"));
    this.setTitle(Application.getGlobalInfo().getApplicationTitle() + ": Thread Monitor");

    // --- Add a WindowsListener --------------------------------
    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.addWindowListener(new WindowAdapter() {

        /* (non-Javadoc)
         * @see java.awt.event.WindowAdapter#windowClosing(java.awt.event.WindowEvent)
         */
        @Override
        public void windowClosing(WindowEvent e) {
            setVisible(false);
        }
    });

    // --- Set the content pane ---------------------------------
    getContentPane().setLayout(new BorderLayout(0, 0));
    getContentPane().add(getTabbedPane(), BorderLayout.CENTER);
    getContentPane().add(getThreadMeasureToolBar(), BorderLayout.NORTH);

    // --- Set Dialog position ----------------------------------
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 
    int top = (screenSize.height - this.getHeight()) / 2; 
    int left = (screenSize.width - this.getWidth()) / 2; 
    this.setLocation(left, top);            

    this.setVisible(true);
}
项目:AgentWorkbench    文件:OptionDialog.java   
/**
 * This method initialises this.
 */
private void initialize() {

    this.setModal(true);
    if (this.owner==null) {
        this.setAlwaysOnTop(true);
    }

    this.setTitle("Agent.GUI: Optionen");
    this.setIconImage(GlobalInfo.getInternalImage("AgentGUI.png"));
    this.setContentPane(this.getJPanelBase());

    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.registerEscapeKeyStroke();
    this.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent evt) {
            setVisible(false);
        }
    });

    // --- Size and centre dialog -------------------------------
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 

    this.setSize((int) (screenSize.getWidth()*0.7), (int)(screenSize.getHeight()*0.8));

    int top = (screenSize.height - this.getHeight()) / 2; 
    int left = (screenSize.width - this.getWidth()) / 2; 
    this.setLocation(left, top);    

}
项目:rapidminer    文件:CronEditorDialog.java   
/**
 * Creates a new cron editor dialog.
 *
 * @param owner
 *            the parent window for this dialog
 */
public CronEditorDialog(Window owner) {
    super(owner, "cron_editor", ModalityType.APPLICATION_MODAL, new Object[] {});

    setupGUI();

    // misc settings
    setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
}
项目:jmt    文件:JMTFrame.java   
/**
 * Sets default operation to be performed when what-if window is closed.
 * @see WindowConstants#DISPOSE_ON_CLOSE
 * @see WindowConstants#DO_NOTHING_ON_CLOSE
 * @see JFrame#EXIT_ON_CLOSE
 * @see JMTFrame#AUTO_MANAGE_ON_CLOSE
 */
@Override
public void setDefaultCloseOperation(int operation) {
    if (operation == JMTFrame.AUTO_MANAGE_ON_CLOSE) {
        super.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        this.addWindowListener(adapter);
    } else {
        this.removeWindowListener(adapter);
        super.setDefaultCloseOperation(operation);
    }
}
项目:jmt    文件:JMTDialog.java   
/**
 * Sets default operation to be performed when what-if window is closed.
 * @see WindowConstants#DISPOSE_ON_CLOSE
 * @see WindowConstants#DO_NOTHING_ON_CLOSE
 * @see JFrame#EXIT_ON_CLOSE
 * @see JMTFrame#AUTO_MANAGE_ON_CLOSE
 */
@Override
public void setDefaultCloseOperation(int operation) {
    if (operation == JMTFrame.AUTO_MANAGE_ON_CLOSE) {
        super.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        this.addWindowListener(adapter);
    } else {
        this.removeWindowListener(adapter);
        super.setDefaultCloseOperation(operation);
    }
}