微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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);
    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,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,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,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,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);
    }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。