List of usage examples for javax.swing JDialog setDefaultCloseOperation
@BeanProperty(preferred = true, enumerationValues = { "WindowConstants.DO_NOTHING_ON_CLOSE", "WindowConstants.HIDE_ON_CLOSE", "WindowConstants.DISPOSE_ON_CLOSE" }, description = "The dialog's default close operation.") public void setDefaultCloseOperation(int operation)
From source file:Main.java
Main() { Object[][] data = { { "A", "B", "Snowboarding", new Integer(5) }, { "C", "D", "Pool", new Integer(10) } }; Object[] columnNames = { "firstname", "lastname", "age" }; final JTable table = new JTable(data, columnNames) { @Override/* w w w . ja va 2s . c o m*/ public Dimension getPreferredScrollableViewportSize() { Dimension d = getPreferredSize(); int n = getRowHeight(); return new Dimension(d.width, (n * ROWS)); } }; JPanel jPanel = new JPanel(); jPanel.setLayout(new GridLayout()); JScrollPane sp = new JScrollPane(table); jPanel.add(sp); JDialog jdialog = new JDialog(); jdialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); jdialog.setContentPane(jPanel); jdialog.pack(); jdialog.setVisible(true); }
From source file:org.nekorp.workflow.desktop.view.resource.imp.EvidenciaViewDialogFactory.java
@Override public JDialog createDialog(Frame frame, boolean modal) { JDialog dialog = new JDialog(mainFrame, true); dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); dialog.setTitle("Evidencia"); evidenciaView.iniciaVista();/*from w w w . j av a 2 s .com*/ dialog.add(evidenciaView); dialog.setSize(980, 640);//hardcode para que no cresca en medida de imagenes en el preview dialog.validate(); //dialog.pack(); dialog.setLocationRelativeTo(mainFrame); return dialog; }
From source file:org.nekorp.workflow.desktop.view.resource.imp.ParametrosReporteGlobalDialogFactory.java
@Override public JDialog createDialog(Frame frame, boolean modal) { JDialog dialog = new JDialog(mainFrame, true); dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); dialog.setTitle("Reporte Global"); datePickView.setParent(dialog);/*from w w w . j av a 2s.c om*/ datePickView.iniciaVista(); dialog.add(datePickView); dialog.validate(); dialog.pack(); dialog.setLocationRelativeTo(mainFrame); return dialog; }
From source file:org.nekorp.workflow.desktop.view.resource.imp.DamageCaptureDetailDialogFactory.java
@Override public JDialog createDialog(Frame frame, boolean modal) { JDialog dialog = new JDialog(mainFrame, true); dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); dialog.setTitle("Descripcin del Dao"); view.setParentWindow(dialog);/*from ww w . ja va2 s.c o m*/ view.iniciaVista(); dialog.add(view); dialog.validate(); dialog.pack(); dialog.setLocationRelativeTo(mainFrame); return dialog; }
From source file:org.nekorp.workflow.desktop.view.resource.imp.ServicioPreviewDialogFactory.java
@Override public JDialog createDialog(Frame frame, boolean modal) { JDialog dialog = new JDialog(mainFrame, true); dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); dialog.setTitle("Consulta Servicio " + " Nmero: " + viewServicioModel.getId()); servicioPreview.setParent(dialog);/*from ww w . j a v a 2s . com*/ servicioPreview.iniciaVista(); servicioPreview.setEditableStatus(false); dialog.add(servicioPreview); dialog.validate(); dialog.pack(); dialog.setLocationRelativeTo(mainFrame); return dialog; }
From source file:org.nekorp.workflow.desktop.view.resource.imp.HistorialServicioDialogFactory.java
@Override public JDialog createDialog(Frame frame, boolean modal) { HistorialServiciosJTableModel model = new HistorialServiciosJTableModel(); model.setDatos(historialController.getHistorial()); JDialog dialog = new JDialog(mainFrame, true); dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); dialog.setTitle("Historial Servicio"); historialView.setParent(dialog);/*www. j a v a2 s .com*/ historialView.iniciaVista(); historialView.setHistoricoModel(model); dialog.add(historialView); dialog.validate(); dialog.pack(); dialog.setLocationRelativeTo(mainFrame); return dialog; }
From source file:org.nekorp.workflow.desktop.view.resource.imp.WizardDialogFactory.java
@Override public JDialog createDialog(Frame frame, boolean modal) { JDialog dialog = new JDialog(mainFrame, true); dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); dialog.setTitle("Nuevo Servicio"); wizard.setParentWindow(dialog);// ww w . j av a 2 s . c o m wizard.iniciaVista(); dialog.add(wizard); dialog.validate(); dialog.pack(); dialog.setLocationRelativeTo(mainFrame); return dialog; }
From source file:Main.java
public void launchDialog() { JButton findButton = new JButton("Find"); findButton.addActionListener(e -> { int start = text.getText().indexOf("is"); int end = start + "is".length(); if (start != -1) { text.requestFocus();/*from w w w.jav a2 s .co m*/ text.select(start, end); } }); JButton cancelButton = new JButton("Cancel"); JOptionPane optionPane = new JOptionPane("Do you understand?", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null, new Object[] { findButton, cancelButton }); JDialog dialog = new JDialog(frame, "Click a button", false); cancelButton.addActionListener(e -> dialog.setVisible(false)); dialog.setContentPane(optionPane); dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); dialog.setLocation(100, 100); dialog.pack(); dialog.setVisible(true); }
From source file:br.org.acessobrasil.silvinha.vista.panels.PainelSenha.java
private void getPassword() { JDialog dialog = op.createDialog(this, GERAL.SENHA_SOLICITADA_SERVIDOR); dialog.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); dialog.setVisible(true);/*from ww w. j av a 2 s.co m*/ Object opcao = op.getValue(); if (opcao != null) { if (opcao.equals(JOptionPane.OK_OPTION)) { this.user = txtName.getText(); this.password = String.valueOf(txtPass.getPassword()); } else if (opcao.equals(JOptionPane.CANCEL_OPTION)) { this.cancelAuth = true; } } }
From source file:IHM.GialogGraph.java
public void Show() { VisualizationViewer<String, String> vv; vv = new VisualizationViewer<>(new CircleLayout<String, String>(JungGraph), dim); Transformer<String, String> transformer = new Transformer<String, String>() { @Override//w w w. j av a 2 s. com public String transform(String arg0) { return arg0; } }; vv.getRenderContext().setVertexLabelTransformer(transformer); transformer = new Transformer<String, String>() { @Override public String transform(String arg0) { return arg0; } }; vv.getRenderContext().setEdgeLabelTransformer(transformer); vv.getRenderer().setVertexRenderer(new MyRenderer()); DefaultModalGraphMouse<String, Number> graphMouse = new DefaultModalGraphMouse<String, Number>(); vv.setGraphMouse(graphMouse); graphMouse.setMode(ModalGraphMouse.Mode.PICKING); JDialog frame = new JDialog(MymainWidow); frame.getContentPane().add(vv); frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); frame.addWindowListener(new WindowListener() { @Override public void windowOpened(WindowEvent e) { } @Override public void windowClosing(WindowEvent e) { MymainWidow.enable(); } @Override public void windowClosed(WindowEvent e) { MymainWidow.enable(); } @Override public void windowIconified(WindowEvent e) { } @Override public void windowDeiconified(WindowEvent e) { } @Override public void windowActivated(WindowEvent e) { } @Override public void windowDeactivated(WindowEvent e) { } }); frame.pack(); frame.setLocationRelativeTo(MymainWidow); frame.setResizable(true); frame.setVisible(true); }