Example usage for javax.swing JDialog JDialog

List of usage examples for javax.swing JDialog JDialog

Introduction

In this page you can find the example usage for javax.swing JDialog JDialog.

Prototype

public JDialog(Window owner, String title, Dialog.ModalityType modalityType) 

Source Link

Document

Creates a dialog with the specified title, owner Window and modality.

Usage

From source file:com.biosis.biosislite.vistas.AsignarPermiso.java

private void imprimirBoletaViaje(AsignacionPermiso asignacion) {
    File reporte = new File("reportes/permiso_comision-servicios.jasper");

    List<AsignacionPermiso> listadoReporteAsignacion = new ArrayList();
    listadoReporteAsignacion.add(asignacion);

    Map<String, Object> parametros = new HashMap<>();
    parametros.put("reporte_ususario", UsuarioActivo.getUsuario().getLogin());

    Departamento area = asignacion.getEmpleado().getAreaEmpleadoList().get(0).getDepartamento();
    if (area != null) {
        parametros.put("area", area.getNombre());
    }//  www.  jav a 2 s. c o  m

    //        AsignarVacacion vac = new AsignarVacacion();
    long dias = this.fechasAlong(asignacion.getPermiso().getFechaInicio(),
            asignacion.getPermiso().getFechaFin());
    parametros.put("dias", dias);

    //Parametros del viaje
    Viaje viaje = vsc.buscarPorPermiso(asignacion.getPermiso());

    if (viaje != null) {
        parametros.put("alimentacion", viaje.getAlimentacion());
        parametros.put("alojamiento", viaje.getAlojamiento());
        parametros.put("movilidad", viaje.getMovilidad());
        parametros.put("combustible", viaje.getCombustible());
        parametros.put("dias_alimentacion", viaje.getDiasAlimentacion());
        parametros.put("dias_alojamiento", viaje.getDiasAlojamiento());
        parametros.put("dias_movilidad", viaje.getDiasMovLocal());
        //            if (asignacion.getEmpleado().getAreaEmpleadoList().get(0).getDepartamento().getDepartamento().getNombre() != null) {
        //                parametros.put("gerencia", asignacion.getEmpleado().getAreaEmpleadoList().get(0).getDepartamento().getDepartamento().getNombre());
        //            } else {
        parametros.put("gerencia",
                asignacion.getEmpleado().getAreaEmpleadoList().get(0).getGerencia().getNombre());
        //            }
        parametros.put("centro_costo", viaje.getCentroCosto());
        parametros.put("ubigeo", viaje.getDestino());
        parametros.put("cargo", asignacion.getEmpleado().getPuestoList().get(0).getPuesto().getNombre());

        double total = (viaje.getAlimentacion() * viaje.getDiasAlimentacion())
                + (viaje.getAlojamiento() * viaje.getDiasAlojamiento())
                + (viaje.getMovilidad() * viaje.getDiasMovLocal()) + viaje.getCombustible();

        parametros.put("total", total);
    }

    //Fin de parametros del viaje
    Component contentPane = reporteador.obtenerReporte(listadoReporteAsignacion, reporte, parametros);
    Frame principal = JOptionPane.getRootFrame();
    JDialog visor = new JDialog(principal, "Reporte", true);
    visor.setSize(contentPane.getSize());
    //        visor.setSize(ventana.getSize().width, ventana.getSize().height);
    visor.getContentPane().add(contentPane);
    visor.setLocationRelativeTo(this);

    //            visor.setUndecorated(true);
    visor.setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds());
    visor.setVisible(true);
    visor.setAlwaysOnTop(true);
    //        reporteador.getReporte(reporte, parametros, listado) //        reporteador.setConn(controlador.getDao().getConexion());
    //        reporteador.generarReporte(reporte, parametros, JOptionPane.getFrameForComponent(this));
}

From source file:com.marginallyclever.makelangelo.MainGUI.java

protected void JogMotors() {
    JDialog driver = new JDialog(mainframe, translator.get("JogMotors"), true);
    driver.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();

    final JButton buttonAneg = new JButton(translator.get("JogIn"));
    final JButton buttonApos = new JButton(translator.get("JogOut"));
    final JCheckBox m1i = new JCheckBox(translator.get("Invert"), machineConfiguration.m1invert);

    final JButton buttonBneg = new JButton(translator.get("JogIn"));
    final JButton buttonBpos = new JButton(translator.get("JogOut"));
    final JCheckBox m2i = new JCheckBox(translator.get("Invert"), machineConfiguration.m2invert);

    c.gridx = 0;/*from   w  w  w  .  j av a  2s.  c o m*/
    c.gridy = 0;
    driver.add(new JLabel(translator.get("Left")), c);
    c.gridx = 0;
    c.gridy = 1;
    driver.add(new JLabel(translator.get("Right")), c);

    c.gridx = 1;
    c.gridy = 0;
    driver.add(buttonAneg, c);
    c.gridx = 1;
    c.gridy = 1;
    driver.add(buttonBneg, c);

    c.gridx = 2;
    c.gridy = 0;
    driver.add(buttonApos, c);
    c.gridx = 2;
    c.gridy = 1;
    driver.add(buttonBpos, c);

    c.gridx = 3;
    c.gridy = 0;
    driver.add(m1i, c);
    c.gridx = 3;
    c.gridy = 1;
    driver.add(m2i, c);

    ActionListener driveButtons = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Object subject = e.getSource();
            if (subject == buttonApos)
                sendLineToRobot("D00 L100");
            if (subject == buttonAneg)
                sendLineToRobot("D00 L-100");
            if (subject == buttonBpos)
                sendLineToRobot("D00 R100");
            if (subject == buttonBneg)
                sendLineToRobot("D00 R-100");
            sendLineToRobot("M114");
        }
    };

    ActionListener invertButtons = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            machineConfiguration.m1invert = m1i.isSelected();
            machineConfiguration.m2invert = m2i.isSelected();
            machineConfiguration.SaveConfig();
            SendConfig();
        }
    };

    buttonApos.addActionListener(driveButtons);
    buttonAneg.addActionListener(driveButtons);

    buttonBpos.addActionListener(driveButtons);
    buttonBneg.addActionListener(driveButtons);

    m1i.addActionListener(invertButtons);
    m2i.addActionListener(invertButtons);

    sendLineToRobot("M114");
    driver.pack();
    driver.setVisible(true);
}

From source file:com.lfv.lanzius.application.Controller.java

public synchronized void settingsDialogOpen() {
    if (state != CLIENT_STATE_STARTED)
        return;/*from w  w  w.  j  av  a  2  s . c o m*/
    // This button is also used to stop the auto tester
    if (autoTesterEnabled) {
        autoTester.stopTester();
        JOptionPane.showMessageDialog(view,
                "The auto tester has been stopped! The settings dialog\n"
                        + "is unaccessible when the auto tester is enabled!",
                "Auto tester", JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    if (settingsDialog == null) {
        boolean full = properties.getUserInterfaceStyle().equalsIgnoreCase("full");
        if (!full)
            JDialog.setDefaultLookAndFeelDecorated(true);

        settingsDialog = new JDialog(view, "Settings", false);
        settingsDialog.setContentPane(new SettingsPane(this));

        if (full) {
            settingsDialog.setResizable(false);
            settingsDialog.setUndecorated(true);
            Rectangle rect = view.getBounds();
            rect.x += rect.width * 0.1;
            rect.y += rect.height * 0.1;
            rect.width *= 0.8;
            rect.height *= 0.8;
            settingsDialog.setBounds(rect);

            // Hide mouse cursor if stated in the properties file
            if (properties.isMouseCursorHidden())
                settingsDialog.setCursor(InvisibleCursor.getCursor());
        } else {
            GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
            Rectangle rect = graphicsEnvironment.getMaximumWindowBounds();
            rect.x += rect.width * 0.25;
            rect.y += rect.height * 0.25;
            rect.width *= 0.5;
            rect.height *= 0.5;
            settingsDialog.setBounds(rect);
            settingsDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
            settingsDialog.addWindowListener(new WindowAdapter() {
                @Override
                public void windowClosing(WindowEvent e) {
                    settingsDialogClose();
                }
            });
        }

        settingsDialog.setVisible(true);
    }
}

From source file:com.lfv.lanzius.application.Controller.java

/**
 * Open the ISA dialog (if the radio has been silent for at least 2 seconds)
 * @return true if the dialog was opened
 */// w w  w  .j a v  a  2 s  .c  om
public boolean isaDialogOpen(int isaNumChoices, boolean isaExtendedMode, String isakeytext[]) {
    final int radioSilentLimit = 500; // Do not show ISA dialog until at least half a second of silence
    if (view == null)
        return true; // This might happen if ISA request when terminal is starting up, don't open ISA dialog
    if (isaDialog == null) {
        // Is radio or phone active?
        boolean codecActive = (radioEncoding || radioDecoding || phoneActive);
        // Wait for 2 seconds of radio silence
        if (codecActive || (System.currentTimeMillis() - radioIdleTime) < radioSilentLimit) {
            // Ignore ISA request if too busy
            return false;
        }

        boolean full = properties.getUserInterfaceStyle().equalsIgnoreCase("full");
        if (!full)
            JDialog.setDefaultLookAndFeelDecorated(true);

        isaDialog = new JDialog(view, "Workload", false);
        isaDialog.setContentPane(
                new ISAPane(Controller.getInstance(), isaNumChoices, isaExtendedMode, isakeytext));

        if (full) {
            isaDialog.setResizable(false);
            isaDialog.setUndecorated(true);
            Rectangle rect = view.getBounds();
            if (isaExtendedMode) {
                rect.x += rect.width * 0.3;
                rect.y += rect.height * 0.3;
                rect.width *= 0.4;
                rect.height *= 0.5;
            } else {
                rect.x += rect.width * 0.2;
                rect.y += rect.height * 0.4;
                rect.width *= 0.6;
                rect.height *= 0.15;
            }
            isaDialog.setBounds(rect);

            // Hide mouse cursor if stated in the properties file
            if (properties.isMouseCursorHidden())
                isaDialog.setCursor(InvisibleCursor.getCursor());
        } else {
            GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
            Rectangle rect = graphicsEnvironment.getMaximumWindowBounds();
            if (isaExtendedMode) {
                rect.x = (int) (rect.width - (rect.width * 0.2));
                rect.y = (int) (rect.height - (rect.height * 0.25));
                rect.width *= 0.2;
                rect.height *= 0.25;
            } else {
                rect.x = (int) (rect.width - (rect.width * 0.3));
                rect.y = (int) (rect.height - (rect.height * 0.1));
                rect.width *= 0.3;
                rect.height *= 0.1;
            }
            isaDialog.setBounds(rect);
            isaDialog.addWindowListener(new WindowAdapter() {
                @Override
                public void windowClosing(WindowEvent e) {
                    isaValueChosen(0);
                }
            });
        }
        isaDialog.setVisible(true);
        isaReqStartTime = System.currentTimeMillis();
        clipNotify.playOnce();
    }
    return true;
}

From source file:com.nikonhacker.gui.EmulatorUI.java

private void showAboutDialog() {
    // for copying style
    JLabel label = new JLabel();
    Font font = label.getFont();/*from  ww  w .  ja  va 2 s.c o  m*/

    // create some css from the label's font
    String style = "font-family:" + font.getFamily() + ";" + "font-weight:"
            + (font.isBold() ? "bold" : "normal") + ";" + "font-size:" + font.getSize() + "pt;";

    // html content
    JEditorPane editorPane = new JEditorPane("text/html", "<html><body style=\"" + style + "\">"
            + "<font size=\"+1\">" + ApplicationInfo.getNameVersion() + "</font><br/>"
            + "<i>A dual (Fujitsu FR + Toshiba TX) microcontroller emulator in Java, aimed at mimicking the behaviour of Nikon DSLRs</i><br/>"
            + "<font size=\"-2\">Built on " + ApplicationInfo.getBuildTime() + "</font><br/><br/>"
            + "This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.<br/>"
            + "This software is provided under the GNU General Public License, version 3 - "
            + makeLink("http://www.gnu.org/licenses/gpl-3.0.txt") + "<br/>"
            + "This software is based on, or makes use of, the following works:<ul>\n"
            + "<li>Simeon Pilgrim's deciphering of firmware encoding and lots of information shared on his blog - "
            + makeLink("http://simeonpilgrim.com/blog/") + "</li>"
            + "<li>Dfr Fujitsu FR diassembler Copyright (c) Kevin Schoedel - "
            + makeLink("http://scratchpad.wikia.com/wiki/Disassemblers/DFR")
            + "<br/>and its port to C# by Simeon Pilgrim</li>"
            + "<li>\"How To Write a Computer Emulator\" article by Marat Fayzullin - "
            + makeLink("http://fms.komkon.org/EMUL8/HOWTO.html") + "</li>"
            + "<li>The PearColator x86 emulator project - "
            + makeLink("http://apt.cs.man.ac.uk/projects/jamaica/tools/PearColator/") + "</li>"
            + "<li>The Jacksum checksum library Copyright (c) Dipl.-Inf. (FH) Johann Nepomuk Lfflmann  - "
            + makeLink("http://www.jonelo.de/java/jacksum/") + "</li>"
            + "<li>HexEditor & RSyntaxTextArea swing components, Copyright (c) Robert Futrell - "
            + makeLink("http://fifesoft.com/hexeditor/") + "</li>"
            + "<li>JGraphX graph drawing library, Copyright (c) JGraph Ltd - "
            + makeLink("http://www.jgraph.com/jgraph.html") + "</li>"
            + "<li>Apache commons libraries, Copyright (c) The Apache Software Foundation - "
            + makeLink("http://commons.apache.org/") + "</li>"
            + "<li>VerticalLayout, Copyright (c) Cellspark - " + makeLink("http://www.cellspark.com/vl.html")
            + "</li>" + "<li>MigLayout, Copyright (c) MigInfoCom - " + makeLink("http://www.miginfocom.com/")
            + "</li>" + "<li>Glazed Lists, Copyright (c) 2003-2006, publicobject.com, O'Dell Engineering Ltd - "
            + makeLink("http://www.glazedlists.com/") + "</li>"
            + "<li>Samples from the Java Tutorial (c) Sun Microsystems / Oracle - "
            + makeLink("http://docs.oracle.com/javase/tutorial") + "</li>"
            + "<li>MARS, MIPS Assembler and Runtime Simulator (c) 2003-2011, Pete Sanderson and Kenneth Vollmar - "
            + makeLink("http://courses.missouristate.edu/KenVollmar/MARS") + "</li>"
            + "<li>SteelSeries (and SteelCheckBox) Swing components (c) 2010, Gerrit Grunwald - "
            + makeLink("http://harmoniccode.blogspot.be/search/label/steelseries") + "</li>" + "</ul>"
            + "License terms for all included code are available in the 'licenses' folder of the distribution."
            + "<p>For more information, help or ideas, please join us at " + makeLink("http://nikonhacker.com")
            + "</p></body></html>");

    // handle link events
    editorPane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
                try {
                    Desktop.getDesktop().browse(e.getURL().toURI());
                } catch (Exception e1) {
                    // noop
                }
            }
        }
    });
    editorPane.setEditable(false);
    Color greyLayer = new Color(label.getBackground().getRed(), label.getBackground().getGreen(),
            label.getBackground().getBlue(), 192);
    editorPane.setBackground(greyLayer);
    //editorPane.setOpaque(false);

    // show
    //        JOptionPane.showMessageDialog(this, editorPane, "About", JOptionPane.PLAIN_MESSAGE);

    final JDialog dialog = new JDialog(this, "About", true);

    JPanel contentPane = new BackgroundImagePanel(new BorderLayout(),
            Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_full.jpg")));
    contentPane.add(editorPane, BorderLayout.CENTER);

    JButton okButton = new JButton("OK");
    okButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            dialog.dispose();
        }
    });
    JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    bottomPanel.add(okButton);
    bottomPanel.setBackground(greyLayer);
    // bottomPanel.setOpaque(false);

    contentPane.add(bottomPanel, BorderLayout.SOUTH);

    dialog.setContentPane(contentPane);
    dialog.pack();
    dialog.setLocationRelativeTo(this);
    dialog.setResizable(false);
    dialog.setVisible(true);
}

From source file:jeplus.JEPlusFrameMain.java

private void jMenuItemConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemConfigActionPerformed
    JDialog ConfigDialog = new JDialog(this, "Configuration file: ", true);
    if (jplProgConfPanel == null) {
        jplProgConfPanel = new JPanelProgConfiguration(ConfigDialog, JEPlusConfig.getDefaultInstance());
    }/* w  w w.j  a  va2 s  .c  o  m*/
    jplProgConfPanel.setHostWindow(ConfigDialog);
    ConfigDialog.getContentPane().add(jplProgConfPanel);
    ConfigDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    ConfigDialog.setTitle(ConfigDialog.getTitle() + jplProgConfPanel.getConfigFile());
    ConfigDialog.pack();
    ConfigDialog.setSize(900, 650);
    ConfigDialog.setLocationRelativeTo(this);
    ConfigDialog.setVisible(true);
}

From source file:com.osparking.osparking.Settings_System.java

private void EBoardSettingsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EBoardSettingsButtonActionPerformed
    int tabIndex = GatesTabbedPane.getSelectedIndex();
    JComboBox typeCBox = (JComboBox) componentMap.get("E_Board" + (tabIndex + 1) + "_TypeCBox");
    E_BoardType eBoardType = (E_BoardType) typeCBox.getSelectedItem();

    eBoardDialog = new JDialog(this, eBoardType + " " + E_BOARD_SETTINGS_FRAME_TITLE.getContent(), true);
    if (eBoardType == E_BoardType.Simulator) {
        getE_BoardDialog().getContentPane().add((new Settings_EBoard(mainForm, this)).getContentPane());
        getE_BoardDialog().setResizable(false);
    } else if (eBoardType == E_BoardType.LEDnotice) {
        Settings_LEDnotice ledNotice = new Settings_LEDnotice(mainForm, this, tabIndex + 1);
        getE_BoardDialog().getContentPane().add(ledNotice.getContentPane());
        getE_BoardDialog().setPreferredSize(ledNotice.getPreferredSize());
        getE_BoardDialog().setResizable(false);
    }/*from  w  w w  .j a v  a2s . com*/
    getE_BoardDialog().pack();

    /**
     * Place E-board settings frame around invoking button and inside monitor.
     */
    Point buttonPoint = EBoardSettingsButton.getLocationOnScreen();
    int idealX = buttonPoint.x + EBoardSettingsButton.getSize().width + 10;
    int moniWidth = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth();
    int maxX = moniWidth - (int) getE_BoardDialog().getSize().getWidth();
    int finalX = idealX;
    int finalY = buttonPoint.y - (int) getE_BoardDialog().getSize().getHeight() / 2;

    if (idealX > maxX) {
        finalX = maxX;
        finalY = buttonPoint.y - (int) getE_BoardDialog().getSize().getHeight() - 10;
    }
    getE_BoardDialog().setLocation(finalX, finalY);

    getE_BoardDialog().setVisible(true);
}

From source file:com.xilinx.ultrascale.gui.MainScreen.java

private void showDialog(String message) {
    modalDialog = new JDialog(this, "Busy", Dialog.ModalityType.DOCUMENT_MODAL);
    JLabel lmessage = new JLabel(message, JLabel.CENTER);

    //modalDialog.add(limg, BorderLayout.LINE_START);
    modalDialog.add(lmessage, BorderLayout.CENTER);
    modalDialog.setSize(400, 150);/*  w ww .  j a  va  2 s . c o m*/
    modalDialog.setLocationRelativeTo(this);
    modalDialog.setVisible(true);
}

From source file:com.osparking.osparking.Settings_System.java

private void manageDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageDataActionPerformed
    dataManDialog = new JDialog(this, "OsParking Data Management", true);
    dataManDialog.getContentPane().add((new DataGUI(this)).getContentPane());
    dataManDialog.setResizable(false);//from   w ww .  java  2 s  . c  om
    dataManDialog.pack();
    dataManDialog.setVisible(true);
}

From source file:nz.ac.massey.cs.gql4jung.browser.queryviews.GraphBasedQueryView.java

public static void show(JFrame parent, Motif motif, String title) {
    JDialog dlg = new JDialog(parent, title, false);
    GraphBasedQueryView qv = new GraphBasedQueryView();
    qv.display(motif, null);/*from   www  .ja v a2s  . co  m*/
    dlg.add(qv);
    dlg.setTitle(title);
    dlg.setSize(900, 600);
    dlg.setLocation(100, 100);
    dlg.setVisible(true);
}