/** * 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(); // } }
/** * 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); }
/** * 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")); }
/** * 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(); }
/** * 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); } }); }
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); }
/** * 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")); }
/** * 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")); }
/** * 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); }
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); }
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); }
/** * 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); }
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); } }); }
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); }
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); }
/** * 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); }
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); }
/** * 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); }
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"); } }
/** * 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; }
/** * 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; }
/** 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(); }
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); } } }
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); }
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; }
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); }); }
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); } }); }
/** * 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); }
@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); }
/** 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); } }); }
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(); }
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); } }
/** * 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); }
/** * 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); } }); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); } }