Jisson
Jisson

Reputation: 11

a joptionpane with a textbox and a button

I want a joptionpane with a textbox and a button and when click on the button perform my own functions

Upvotes: 1

Views: 4924

Answers (2)

Jigar Joshi
Jigar Joshi

Reputation: 240860

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.life.java.so.questions;

import javax.swing.JOptionPane;

/**
 *
 * @author Jigar
 */
public class InputDialog {
    public static void main(String[] args) {
        String input = JOptionPane.showInputDialog("Enter Input:");
        System.out.println(input);
    }
}

Output :

alt text

Upvotes: 5

Costis Aivalis
Costis Aivalis

Reputation: 13728

Maybe you just want a modal JDialog with a JLabel or a JTextArea and a JButton.

Upvotes: 0

Related Questions