Here you can find the source of showTextboxDialog(javax.swing.JFrame frame, String texto, String title, String valorInicial, int type)
Parameter | Description |
---|---|
frame | a parameter |
texto | a parameter |
title | a parameter |
valorInicial | a parameter |
type | a parameter |
public static String showTextboxDialog(javax.swing.JFrame frame, String texto, String title, String valorInicial, int type)
//package com.java2s; import java.awt.Frame; import javax.swing.JDialog; import javax.swing.JOptionPane; public class Main { /**/*ww w .j av a 2 s .com*/ * Mostra uma caixa de menssagem para que seja ensirido um valor. * @param frame * @param texto * @param title * @param valorInicial * @param type * @return * @author Thiago Benega * @since 13/04/2009 */ public static String showTextboxDialog(javax.swing.JFrame frame, String texto, String title, String valorInicial, int type) { Object txt = null; JDialog jDialog = new JDialog(); jDialog.setTitle(title); jDialog.setFocusableWindowState(true); if (frame != null) { frame.setExtendedState(Frame.ICONIFIED); frame.pack(); frame.setExtendedState(Frame.MAXIMIZED_BOTH); } switch (type) { case JOptionPane.OK_CANCEL_OPTION: txt = JOptionPane.showInputDialog(jDialog, texto, title, type, null, null, valorInicial);//.toString(); break; case JOptionPane.YES_NO_OPTION: txt = JOptionPane.showConfirmDialog(jDialog, texto, title, type, JOptionPane.INFORMATION_MESSAGE); break; default: JOptionPane.showMessageDialog(jDialog, texto, title, type); break; } jDialog = null; return txt != null ? txt.toString() : null; } }