javax.swing.JOptionPane.setMessage()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中javax.swing.JOptionPane.setMessage()方法的一些代码示例,展示了JOptionPane.setMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JOptionPane.setMessage()方法的具体详情如下:
包路径:javax.swing.JOptionPane
类名称:JOptionPane
方法名:setMessage

JOptionPane.setMessage介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

encodingPanel.add(Box.createVerticalStrut(5));
final JOptionPane fileFilterDialog = new JOptionPane();
fileFilterDialog.setMessage(encodingPanel);
JButton[] options = new JButton[3];
JButton useNewEncoding = new JButton("Use " + encoding);

代码示例来源:origin: stackoverflow.com

frame.setLocationByPlatform(true);
timer.setCoalesce(false);
optPane.setMessage(message());
optPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
optPane.setOptionType(JOptionPane.DEFAULT_OPTION);
optPane.setMessage(message());
if (count == 0) {
  thatsAllFolks();

代码示例来源:origin: stackoverflow.com

String htmlMsg = "<html>You can use</b>HTML here</html>";

JOptionPane dialogBox = new JOptionPane();
dialogBox.setMessage(msg);
dialogBox.setMessageType(JOptionPane.INFORMATION_MESSAGE);
//....

代码示例来源:origin: stanfordnlp/CoreNLP

fileFilterDialog.setMessage(fileFilterPanel);
JButton[] options = new JButton[3];
JButton okay = new JButton("Okay");

代码示例来源:origin: ontop/ontop

public static void showPrettyMessageDialog(Component parent, Object message, String title, int type) {
  class PrettyOptionPane extends JOptionPane {
    PrettyOptionPane() {
    }
    @Override
    public int getMaxCharactersPerLineCount() {
      return maxCharactersPerLineCount;
    }
  }
  JOptionPane narrowPane = new PrettyOptionPane();
  narrowPane.setMessage(message);
  narrowPane.setMessageType(type);
  JDialog errorDialog = narrowPane.createDialog(parent, title);
  errorDialog.setVisible(true);
}

代码示例来源:origin: stanfordnlp/CoreNLP

prefPane.setMessage(prefPanel);

代码示例来源:origin: stackoverflow.com

JDialog dialog = null;
 JOptionPane optionPane = new JOptionPane();
 optionPane.setMessage("Set Message");
 optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
 JPanel panel = new JPanel();
 panel.setLayout(new GridLayout(3,1));
 String[] buttonTxt = {"Need Help","Help Me","Counting"};
 JButton[] buttons = new JButton[buttonTxt.length];
 for (int i = 0; i < buttonTxt.length; i++)
 {
   buttons[i] = new JButton(buttonTxt[i]);
   panel.add(buttons[i]);
 }
 optionPane.setOptionType(JOptionPane.DEFAULT_OPTION);
 optionPane.add(panel);
 dialog = optionPane.createDialog(null, "Icon/Text Button");
 dialog.setVisible(true);

代码示例来源:origin: violetumleditor/violetumleditor

public void showInformationDialog(String message)
{
  JOptionPane optionPane = new JOptionPane();
  JLabel label = new JLabel(message);
  label.setFont(label.getFont().deriveFont(Font.PLAIN));
  optionPane.setIcon(this.genericInfoImageIcon);
  optionPane.setMessage(label);
  showDialog(optionPane, this.genericInfoTitle, true);
}

代码示例来源:origin: stackoverflow.com

JDialog dialog = null;
   JOptionPane optionPane = new JOptionPane();
   optionPane.setMessage("Set Message");
   optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
   JPanel panel = new JPanel();
   panel.setLayout(new GridLayout(3,1));
   String[] buttonTxt = {"Need Help","Help Me","Counting"};
   JButton[] buttons = new JButton[buttonTxt.length];
   for (int i = 0; i < buttonTxt.length; i++)
   {
     buttons[i] = new JButton(buttonTxt[i]);
     panel.add(buttons[i]);
   }
   optionPane.setOptionType(JOptionPane.DEFAULT_OPTION);
   optionPane.add(panel,1);
   dialog = optionPane.createDialog(null, "Icon/Text Button");
   dialog.setVisible(true);

代码示例来源:origin: violetumleditor/violetumleditor

public void showErrorDialog(String message)
{
  JOptionPane optionPane = new JOptionPane();
  JLabel label = new JLabel(message);
  label.setFont(label.getFont().deriveFont(Font.PLAIN));
  optionPane.setIcon(this.genericErrorImageIcon);
  optionPane.setMessage(label);
  showDialog(optionPane, this.genericErrorTitle, true);
}

代码示例来源:origin: org.apache.axis/axis

/**
 * Get the server-config.wsdd as a document to retrieve deployed services
 * 
 * @return 
 */
private Document getServerWSDD() {
  Document doc = null;
  try {
    String[] param = new String[]{"-u" + axisUser, "-w" + axisPass,
                   "-l " + axisURL, "list"};
    String ret = adminClient.process(param);
    doc = XMLUtils.newDocument(
        new ByteArrayInputStream(ret.getBytes()));
  } catch (Exception e) {
    JOptionPane pane = new JOptionPane();
    String msg = e.toString();
    pane.setMessageType(JOptionPane.WARNING_MESSAGE);
    pane.setMessage(msg);
    pane.setOptions(new String[]{"OK"});
    JDialog dlg = pane.createDialog(null, "Login status");
    dlg.setVisible(true);
  }
  return doc;
}

代码示例来源:origin: violetumleditor/violetumleditor

public void showWarningDialog(String message)
{
  JOptionPane optionPane = new JOptionPane();
  JLabel label = new JLabel(message);
  label.setFont(label.getFont().deriveFont(Font.PLAIN));
  optionPane.setIcon(this.genericWarningImageIcon);
  optionPane.setMessage(label);
  showDialog(optionPane, this.genericWarningTitle, true);
}

代码示例来源:origin: axis/axis

/**
 * Get the server-config.wsdd as a document to retrieve deployed services
 * 
 * @return 
 */
private Document getServerWSDD() {
  Document doc = null;
  try {
    String[] param = new String[]{"-u" + axisUser, "-w" + axisPass,
                   "-l " + axisURL, "list"};
    String ret = adminClient.process(param);
    doc = XMLUtils.newDocument(
        new ByteArrayInputStream(ret.getBytes()));
  } catch (Exception e) {
    JOptionPane pane = new JOptionPane();
    String msg = e.toString();
    pane.setMessageType(JOptionPane.WARNING_MESSAGE);
    pane.setMessage(msg);
    pane.setOptions(new String[]{"OK"});
    JDialog dlg = pane.createDialog(null, "Login status");
    dlg.setVisible(true);
  }
  return doc;
}

代码示例来源:origin: MrCrayfish/ModelCreator

private static boolean isUrl(String url)
{
  if(url == null | (url != null && url.equals("null")))
  {
    JOptionPane message = new JOptionPane();
    message.setMessage("Failed to upload screenshot. Check your internet connection then try again.");
    JDialog dialog = message.createDialog(null, "Error");
    dialog.setLocationRelativeTo(null);
    dialog.setModal(false);
    dialog.setVisible(true);
    return false;
  }
  return true;
}

代码示例来源:origin: org.apache.axis/com.springsource.org.apache.axis

/**
 * Get the server-config.wsdd as a document to retrieve deployed services
 * 
 * @return 
 */
private Document getServerWSDD() {
  Document doc = null;
  try {
    String[] param = new String[]{"-u" + axisUser, "-w" + axisPass,
                   "-l " + axisURL, "list"};
    String ret = adminClient.process(param);
    doc = XMLUtils.newDocument(
        new ByteArrayInputStream(ret.getBytes()));
  } catch (Exception e) {
    JOptionPane pane = new JOptionPane();
    String msg = e.toString();
    pane.setMessageType(JOptionPane.WARNING_MESSAGE);
    pane.setMessage(msg);
    pane.setOptions(new String[]{"OK"});
    JDialog dlg = pane.createDialog(null, "Login status");
    dlg.setVisible(true);
  }
  return doc;
}

代码示例来源:origin: violetumleditor/violetumleditor

String title = resources.getString("dialog.error_version.title");
JOptionPane optionPane = new JOptionPane();
optionPane.setMessage(message);
this.dialogFactory.showDialog(optionPane, title, true);
System.exit(1);

代码示例来源:origin: stackoverflow.com

JOptionPane optionPane = new JOptionPane();
JTextField field = getField();
optionPane.setMessage(new Object[]{"Type something: ", field});
optionPane.setMessageType(JOptionPane.QUESTION_MESSAGE);
optionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);

代码示例来源:origin: violetumleditor/violetumleditor

public void start()
{
  PrintPanel printPanel = new PrintPanel(this.graph);
  JOptionPane optionPane = new JOptionPane();
  optionPane.setOptions(new String[]
  {
    this.printCloseText
  });
  optionPane.setMessage(printPanel);
  optionPane.setBorder(new EmptyBorder(0, 0, 10, 0));
  this.dialogFactory.showDialog(optionPane, this.printTitle, true);
}

代码示例来源:origin: stackoverflow.com

public class Main {

  public static List<Component> getAllComponents(final Container c) {
    Component[] comps = c.getComponents();
    List<Component> compList = new ArrayList<Component>();
    for (Component comp : comps) {
      compList.add(comp);
      if (comp instanceof Container)
        compList.addAll(getAllComponents((Container) comp));
    }
    return compList;
  }

  public static void main(String[] args) {
    JOptionPane optionPane = new JOptionPane();
    optionPane.setMessage("What's your name?");
    optionPane.setMessageType(JOptionPane.QUESTION_MESSAGE);
    optionPane.setWantsInput(true);
    JDialog dialog = optionPane.createDialog("Simple Question");
    for (Component c : getAllComponents(dialog)) {
     if (c instanceof JTextField) {
       c.setToolTipText("I'm a tooltip!");
     }
    }
    dialog.setVisible(true);
    dialog.dispose();
  }
}

代码示例来源:origin: violetumleditor/violetumleditor

@Override
public void exportToClipboard()
{
  FileExportService.exportToclipBoard(this.graph);
  JOptionPane optionPane = new JOptionPane();
  optionPane.setIcon(this.clipBoardDialogIcon);
  optionPane.setMessage(this.clipBoardDialogMessage);
  optionPane.setName(this.clipBoardDialogTitle);
  this.dialogFactory.showDialog(optionPane, this.clipBoardDialogTitle, true);
}

相关文章