2011-01-05 7 views

Antwort

0

Vielleicht Sie wollen einfach nur eine modale JDialog mit einem JLabel oder einem JTextArea und einem JButton.

+0

ok danke ... wie kann ich einen Knopf und andere zu einem JDialog hinzufügen? – Jisson

+0

Mit add (myButton) oder getContentPane(). Add (myButton). Es ist ein Top-Level-Container, der einem JFrame sehr ähnlich ist. –

4
/* 
* 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); 
    } 
} 

Ausgang:

alt text

Verwandte Themen