List of usage examples for javax.swing WindowConstants DISPOSE_ON_CLOSE
int DISPOSE_ON_CLOSE
To view the source code for javax.swing WindowConstants DISPOSE_ON_CLOSE.
Click Source Link
From source file:statechum.analysis.learning.Visualiser.java
public void construct(Graph g, LayoutOptions options) { if (!globalConfig.isAssertEnabled() && Boolean.getBoolean(globalConfig.getProperty(G_PROPERTIES.ASSERT_ENABLED))) { System.err.println("Pass the -ea argument to JVM to enable assertions"); }/*from www. j a va 2 s . com*/ // if (Boolean.valueOf(GlobalConfiguration.getConfiguration() .getProperty(GlobalConfiguration.G_PROPERTIES.CLOSE_TERMINATE))) this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); else if (Boolean.valueOf( GlobalConfiguration.getConfiguration().getProperty(GlobalConfiguration.G_PROPERTIES.ESC_TERMINATE))) this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); else this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.addWindowListener(new WindowEventHandler()); /* this.addComponentListener(new ComponentListener() { @Override public void componentShown(@SuppressWarnings("unused") ComponentEvent e) {} @Override public void componentResized(@SuppressWarnings("unused") ComponentEvent e) { if (viewer != null) viewer.getModel().getGraphLayout().resize(getSize()); } @Override public void componentMoved(@SuppressWarnings("unused") ComponentEvent e) {} @Override public void componentHidden(@SuppressWarnings("unused") ComponentEvent e) {} });*/ this.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent arg0) { Action act = keyToActionMap.get(arg0.getKeyCode()); if (act != null) { act.actionPerformed(null); } } @Override public void keyReleased(@SuppressWarnings("unused") KeyEvent arg0) {// this method is intentionally left blank - keypresses/releases are handled by the keyPressed method. } @Override public void keyTyped(@SuppressWarnings("unused") KeyEvent key) {// this method is intentionally left blank - keypresses/releases are handled by the keyPressed method. } }); popupMenu = new JPopupMenu(); // Icon loading is from http://www.javaworld.com/javaworld/javaqa/2000-06/03-qa-0616-icon.html Image icon = Toolkit.getDefaultToolkit() .getImage(GlobalConfiguration.getConfiguration().getProperty(G_PROPERTIES.RESOURCES) + File.separator + "icon.jpg"); if (icon != null) { setIconImage(icon); } setVisualiserKeyBindings(); setStateChumKeyBindings(this, propName, keyToActionMap); updatePopupMenu(popupMenu, keyToActionMap); //getContentPane().removeAll(); WindowPosition framePosition = globalConfig.loadFrame(propName); viewer = new VisualizationViewer( new DefaultVisualizationModel( new XMLPersistingLayout(propName >= 0 ? new FRLayout(g) : new KKLayout(g))), constructRenderer(g, options)); viewer.setBackground(Color.WHITE); final DefaultModalGraphMouse graphMouse = new XMLModalGraphMouse(); graphMouse.setMode(ModalGraphMouse.Mode.PICKING); graphMouse.add(new PickingGraphMousePlugin()); viewer.setGraphMouse(graphMouse); viewer.setPickSupport(new ShapePickSupport()); viewer.addMouseListener(this); final GraphZoomScrollPane panel = new GraphZoomScrollPane(viewer); getContentPane().add(panel); pack(); viewer.setPreferredSize(getSize()); //viewer.getModel().getGraphLayout().initialize(getSize()); restoreLayout(true, currentGraph); setBounds(framePosition.getRect()); framesVisible.add(this);// register as an active frame. setVisible(true); }
From source file:Store.HealthSMS.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./*from w ww. j av a2 s. c om*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jToolBar1 = new javax.swing.JToolBar(); jButton2 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); txt_msg = new javax.swing.JTextArea(); jLabel2 = new javax.swing.JLabel(); Send = new javax.swing.JButton(); clr = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); spno = new javax.swing.JTextField(); txt_no = new javax.swing.JTextField(); src_btn = new javax.swing.JButton(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); hdate = new javax.swing.JMenu(); htime = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("SEND SMS TO PATIENTS"); setBackground(new java.awt.Color(0, 153, 51)); setFont(new java.awt.Font("Agency FB", 1, 10)); // NOI18N setResizable(false); jToolBar1.setRollover(true); jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Store/icons/lightbox-prev.png"))); // NOI18N jButton2.setToolTipText("Back"); jButton2.setFocusable(false); jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jToolBar1.add(jButton2); jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Store/icons/logout-icon_small.png"))); // NOI18N jButton1.setToolTipText("Log Out"); jButton1.setFocusable(false); jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jToolBar1.add(jButton1); txt_msg.setColumns(20); txt_msg.setRows(5); txt_msg.setText("Type The Message..."); txt_msg.setToolTipText("Type The Message..."); txt_msg.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { txt_msgMouseClicked(evt); } }); jScrollPane1.setViewportView(txt_msg); jLabel2.setText("Message"); Send.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Store/icons/messages-icon2.png"))); // NOI18N Send.setText("Send"); Send.setToolTipText("Send SMS to Patients"); Send.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { SendActionPerformed(evt); } }); clr.setText("Clear"); clr.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { clrActionPerformed(evt); } }); jLabel1.setText("Phone Number"); spno.setEditable(false); spno.setToolTipText("Enter The Phone Number,start +254..."); spno.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { spnoMouseClicked(evt); } }); spno.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { spnoKeyTyped(evt); } }); txt_no.setText("Enter Patient's Admittion Number to Search"); src_btn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Store/icons/search-icon.png"))); // NOI18N src_btn.setText("Search"); src_btn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { src_btnActionPerformed(evt); } }); jMenu1.setText("File"); jMenu1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenu1ActionPerformed(evt); } }); jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Store/icons/logout-icon_small.png"))); // NOI18N jMenuItem1.setText("Log Out"); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); jMenu1.add(jMenuItem1); jMenuBar1.add(jMenu1); hdate.setText("Date"); jMenuBar1.add(hdate); htime.setText("Time"); jMenuBar1.add(htime); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout.createSequentialGroup().addGap(115, 115, 115).addComponent(jLabel1)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 497, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup().addGap(35, 35, 35).addComponent( jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(txt_no, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(spno, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)) .addGap(30, 30, 30).addComponent(src_btn)))) .addGroup(layout.createSequentialGroup().addGap(272, 272, 272).addComponent(Send) .addGap(43, 43, 43).addComponent(clr))) .addContainerGap(154, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 106, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(src_btn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txt_no, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(spno, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(32, 32, 32) .addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 232, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(clr, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Send))) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18))); setSize(new java.awt.Dimension(870, 630)); setLocationRelativeTo(null); }
From source file:studio.ui.Studio.java
public Studio(AppConfig config, String... args) { super(AppInformation.getInformation().getTitle()); setIconImage(IconsItem.IMAGE_APP);/*w w w .j a v a 2s .c o m*/ enableEvents(AWTEvent.WINDOW_EVENT_MASK); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setSize((int) (0.9 * screenSize.width), (int) (0.9 * screenSize.height)); setLocation(((int) Math.max(0, (screenSize.width - getWidth()) / 2.0)), (int) (Math.max(0, (screenSize.height - getHeight()) / 2.0))); this.studioConfig = config; if (studioConfig.isMaximized()) { setExtendedState(JFrame.MAXIMIZED_BOTH); //Maximizing the frame } addWindowStateListener(this); registerForMacOSXEvents(); splitViewer = new JSplitPane(); splitTopViewer = new JSplitPane(); tabConsoles = new ConsolesTabbedPane(); tabConsoles.addFireDataListener(this); tabEditors = new EditorsTabbedPane(tabConsoles); tabEditors.addFireDataListener(this); if (tabConsoles instanceof DataListener) { tabEditors.addFireDataListener((DataListener) tabConsoles); } tools = new ToolsPanel(); splitViewer.setOrientation(JSplitPane.VERTICAL_SPLIT); splitViewer.setDividerSize(0); splitViewer.setTopComponent(splitTopViewer); splitViewer.setBottomComponent(tabConsoles); splitViewer.setOneTouchExpandable(true); splitTopViewer.setOrientation(JSplitPane.HORIZONTAL_SPLIT); splitTopViewer.setDividerSize(9); splitTopViewer.setTopComponent(tools); splitTopViewer.setBottomComponent(tabEditors); splitTopViewer.setOneTouchExpandable(true); createConnectionsTree(); createProjectsTree(); rebuildMenus(null); getContentPane().add(splitViewer, BorderLayout.CENTER); splitViewer.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent event) { if (event.getComponent() instanceof JSplitPane) { if (((JSplitPane) event.getComponent()).getDividerSize() == 0) { ((JSplitPane) event.getComponent()).setDividerLocation(1d); } } } }); this.setVisible(true); splitTopViewer.setDividerLocation(.2d); splitViewer.setDividerLocation(1d); NewFileAction newAction = null; OpenFileAction openAction = null; ToolBarActions toolbar = appToolbar != null ? appToolbar.getToolBar("File") : null; if (toolbar != null) { for (int count = 0; count < toolbar.getComponentCount(); count++) { if (toolbar.getComponent(count) instanceof JButton) { if (((JButton) toolbar.getComponent(count)).getAction().getClass() == OpenFileAction.class) { openAction = (OpenFileAction) ((JButton) toolbar.getComponent(count)).getAction(); } else { if (((JButton) toolbar.getComponent(count)).getAction().getClass() == NewFileAction.class) { newAction = (NewFileAction) ((JButton) toolbar.getComponent(count)).getAction(); } } if (openAction != null && newAction != null) { break; } } } } EditorFile last = null; if (config.getLastFiles() != null && !config.getLastFiles().isEmpty()) { for (EditorFile file : config.getLastFiles()) { if (file.isActive()) { last = file; } try { openAction.initDocument(file); } catch (FileException ex) { JOptionPane.showMessageDialog(this, ex.getMessage(), "File", JOptionPane.WARNING_MESSAGE); } } } else { if (args == null || args.length == 0) { newAction.actionPerformed(null); } } if (args != null && args.length > 0) { for (String arg : args) { File file = new File(arg); if (file.exists() && file.canRead()) { try { openAction.initDocument(new EditorFile(file)); } catch (FileException ex) { JOptionPane.showMessageDialog(this, ex.getMessage(), "File", JOptionPane.WARNING_MESSAGE); } } } } if (tabEditors.getTabCount() > 0) { if (last == null) { tabEditors.setSelectedIndex(0); } else { for (int count = 0; count < tabEditors.getTabCount(); count++) { if (tabEditors.getEditor(count).getFile().equals(last)) { tabEditors.setSelectedIndex(count); } } } tabEditors.getEditor().requestFocusInWindow(); } ActionBase action = new ActionBase(null, (char) 0, null, null, null, null) { private static final long serialVersionUID = -1752094455650906542L; @Override public void actionPerformed(ActionEvent event) { treeConnections.requestFocus(); } }; splitViewer.registerKeyboardAction(action, KeyStroke.getKeyStroke("F5"), JComponent.WHEN_IN_FOCUSED_WINDOW); splitViewer.registerKeyboardAction(action, KeyStroke.getKeyStroke("control F5"), JComponent.WHEN_IN_FOCUSED_WINDOW); action = new ActionBase(null, (char) 0, null, null, null, null) { private static final long serialVersionUID = -1752094455650906542L; @Override public void actionPerformed(ActionEvent event) { if (tabEditors.getTabCount() > 0) { tabEditors.requestFocus(); tabEditors.getEditor().requestFocus(); } } }; splitViewer.registerKeyboardAction(action, KeyStroke.getKeyStroke("F3"), JComponent.WHEN_IN_FOCUSED_WINDOW); splitViewer.registerKeyboardAction(action, KeyStroke.getKeyStroke("control F3"), JComponent.WHEN_IN_FOCUSED_WINDOW); action = new ActionBase(null, (char) 0, null, null, null, null) { private static final long serialVersionUID = -7472441241172668338L; @Override public void actionPerformed(ActionEvent event) { treeProjects.requestFocus(); } }; splitViewer.registerKeyboardAction(action, KeyStroke.getKeyStroke("F6"), JComponent.WHEN_IN_FOCUSED_WINDOW); splitViewer.registerKeyboardAction(action, KeyStroke.getKeyStroke("control F6"), JComponent.WHEN_IN_FOCUSED_WINDOW); action = new ActionBase(null, (char) 0, null, null, null, null) { private static final long serialVersionUID = -1752094455650906542L; @Override public void actionPerformed(ActionEvent event) { if (tabConsoles.getTabCount() > 0) { tabConsoles.requestFocus(); if (tabConsoles.getSelectedIndex() != -1) { tabConsoles.getComponentAt(tabConsoles.getSelectedIndex()).requestFocus(); } } } }; splitViewer.registerKeyboardAction(action, KeyStroke.getKeyStroke("F4"), JComponent.WHEN_IN_FOCUSED_WINDOW); splitViewer.registerKeyboardAction(action, KeyStroke.getKeyStroke("control F4"), JComponent.WHEN_IN_FOCUSED_WINDOW); action = new WindowsListAction(tabEditors); splitViewer.registerKeyboardAction(action, action.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); }
From source file:uk.ac.liverpool.narrative.SolutionGraphics.java
public void createVisualStateGraph(boolean dynamic, int iterations) { KKLayout<STRIPSState, Action> layout = new KKLayout<STRIPSState, Action>(sg.ggraph);// , new SDist<STRIPSState, Action>(ggraph)); layout.setLengthFactor(1.7);/*from w ww . j a v a 2s . co m*/ layout.setAdjustForGravity(false); // layout.setDisconnectedDistanceMultiplier(1.5); // layout.setExchangeVertices(true); layout.setSize(new Dimension(2000, 1200)); // sets the initial size of int i = 0; if (!dynamic) { layout.setMaxIterations(iterations); while (!layout.done() && i++ < iterations) { layout.step(); } layout.lock(true); } final VisualizationViewer<STRIPSState, Action> vv = new VisualizationViewer<STRIPSState, Action>(layout); vvv = vv; vv.setPreferredSize(new Dimension(2000, 1200)); // Sets the viewing area final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse(); graphMouse.setMode(ModalGraphMouse.Mode.PICKING); vv.setGraphMouse(graphMouse); vv.setBackground(Color.white); vv.getRenderContext().setVertexLabelTransformer(new ConstantTransformer("")); vv.getRenderContext().setEdgeFontTransformer(new Transformer<Action, Font>() { @Override public Font transform(Action s) { Action ra = sg.realActions.get(s); Collection<Action> set = sg.actionToEdges.get(template.apply_template(ra)); if (set != null && set.size() > 1) return DERIVE_FONT; return DERIVE_FONT2; } }); vv.getRenderContext().setEdgeLabelTransformer(new Transformer<Action, String>() { @Override public String transform(Action a) { try { return sg.actionToString(template, a); } catch (IOException e) { e.printStackTrace(); return ""; } } }); vv.getRenderContext().setEdgeDrawPaintTransformer(new Transformer<Action, Paint>() { @Override public Paint transform(Action s) { sg.realActions.get(s); EdgeColor v = sg.edgeColors.get(s); if (v == null) return Color.yellow; if (v == EdgeColor.black) return Color.red; else return Color.lightGray; } }); vv.getRenderContext().setVertexStrokeTransformer(new ConstantTransformer(new BasicStroke(0))); vv.getRenderContext().setVertexFillPaintTransformer(new Transformer<STRIPSState, Paint>() { @Override public Paint transform(STRIPSState s) { if (vv.getPickedVertexState().isPicked(s)) return new Color(250, 250, 0, 207); Color c = cm.get(s); if (c != null) return c; if (sg.start.equals(s)) return new Color(10, 200, 10, 197); else if (sg.ends.contains(s)) return new Color(220, 10, 10, 197); return new Color(255, 210, 40, 197); } }); vv.getRenderContext().setVertexShapeTransformer(new StoryStateTransformer()); vv.getRenderContext() .setEdgeArrowTransformer(new DirectionalEdgeArrowTransformer<STRIPSState, Action>(10, 8, 1) { @Override public Shape transform(Context<Graph<STRIPSState, Action>, Action> context) { if (sg.frequency.get(sg.ggraph.getEndpoints(context.element).getFirst()) != null) { double c = Math.log( sg.frequency.get(sg.ggraph.getEndpoints(context.element).getFirst())) * 0.8; if (c > 1) { Shape ss = AffineTransform.getScaleInstance(c, c) .createTransformedShape(super.transform(context)); return ss; } } return super.transform(context); } }); vv.setRenderer(new LabelsLastRenderer()); vv.getRenderer().getVertexLabelRenderer().setPosition(Position.AUTO); vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Action, Stroke>() { @Override public Stroke transform(Action a) { if (false) return new BasicStroke( (sg.actionToEdges.get(template.apply_template(sg.realActions.get(a))).size()), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); if (sg.frequency.get(sg.ggraph.getEndpoints(a).getFirst()) != null) return new BasicStroke( (float) (Math.log(sg.frequency.get(sg.ggraph.getEndpoints(a).getFirst())) * 6.0), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); else return new BasicStroke(1); } }); vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.gray, false)); vv.getRenderContext().setLabelOffset(20); vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray)); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); JPanel jp = new JPanel(); jp.setBackground(Color.WHITE); jp.setLayout(new BorderLayout()); jp.add(panel, BorderLayout.CENTER); JPanel top = new JPanel(new FlowLayout()); jp.add(top, BorderLayout.NORTH); JFrame frame = new JFrame("Story state graph"); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.getContentPane().add(jp); frame.pack(); frame.setVisible(true); }
From source file:ve.zoonosis.controller.modulos.novdedades.NuevoClienteController.java
private void iniciarDialogo() { dialog = new MDialog((Dialog) SwingUtilities.getWindowAncestor(novedadController)); dialog.setTitle("Nuevo"); dialog.setResizable(false);// w w w. ja va 2s . com dialog.showPanel(this); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { cancelar(); } }); }