Example usage for javax.swing JOptionPane showInputDialog

List of usage examples for javax.swing JOptionPane showInputDialog

Introduction

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

Prototype

public static String showInputDialog(Component parentComponent, Object message) throws HeadlessException 

Source Link

Document

Shows a question-message dialog requesting input from the user parented to parentComponent.

Usage

From source file:pt.lsts.neptus.plugins.sunfish.IridiumComms.java

private void sendIridiumCommand() {
    String cmd = JOptionPane.showInputDialog(getConsole(),
            I18n.textf("Enter command to be sent to %vehicle", getMainVehicleId()));
    if (cmd == null || cmd.isEmpty())
        return;//from www .j  a v a2s .  c o m

    IridiumCommand command = new IridiumCommand();
    command.setCommand(cmd);

    VehicleType vt = VehiclesHolder.getVehicleById(getMainVehicleId());
    if (vt == null) {
        GuiUtils.errorMessage(getConsole(), "Send Iridium Command",
                "Could not calculate destination's IMC identifier");
        return;
    }
    command.setDestination(vt.getImcId().intValue());
    command.setSource(ImcMsgManager.getManager().getLocalId().intValue());
    try {
        IridiumManager.getManager().send(command);
        getConsole().post(Notification.success("Iridium message sent", "1 Iridium messages were sent using "
                + IridiumManager.getManager().getCurrentMessenger().getName()));
    } catch (Exception e) {
        GuiUtils.errorMessage(getConsole(), e);
    }

}

From source file:put.semantic.fcanew.ui.MainWindow.java

private void addNewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addNewButtonActionPerformed
    String uri = JOptionPane.showInputDialog(this, "Enter individual URI");
    addNew(uri);/*  w  w  w .j a  v a 2s .com*/
}