/** * Wrap a text at a given line length. Doesn't to word wrap, just inserts * linebreaks every nth character. If the string already contains * linebreaks, these are handled properly (extra linebreaks will only be * inserted when needed). * * @param text The text to wrap. */ public static String wrapText(String text) { return wrapText(text, 80); }
public void run() { String msg = SUtil.wrapText("No integer concurrency: "+e.getMessage()); JOptionPane.showMessageDialog(SGUI.getWindowParent(TestCenterPanel.this), msg, "Settings problem", JOptionPane.INFORMATION_MESSAGE); } });
public void run() { String msg = SUtil.wrapText("No integer timeout: "+e.getMessage()); JOptionPane.showMessageDialog(SGUI.getWindowParent(TestCenterPanel.this), msg, "Settings problem", JOptionPane.INFORMATION_MESSAGE); } });
public void run() { String msg = SUtil.wrapText("No integer concurrency: "+e.getMessage()); JOptionPane.showMessageDialog(SGUI.getWindowParent(TestCenterPanel.this), msg, "Settings problem", JOptionPane.INFORMATION_MESSAGE); } });
/** * Show error when no receiver is specified. */ protected void noReceiverSpecified() { String text = SUtil.wrapText("Cannot not send message, no receiver specified."); JOptionPane.showMessageDialog(SGUI.getWindowParent(ConversationPanel.this), text, "Message Error", JOptionPane.INFORMATION_MESSAGE); }
public void run() { String msg = SUtil.wrapText("No integer timeout: "+e.getMessage()); JOptionPane.showMessageDialog(SGUI.getWindowParent(TestCenterPanel.this), msg, "Settings problem", JOptionPane.INFORMATION_MESSAGE); } });
public void run() { String msg = SUtil.wrapText("Concurrency must be greater zero."); JOptionPane.showMessageDialog(SGUI.getWindowParent(TestCenterPanel.this), msg, "Settings problem", JOptionPane.INFORMATION_MESSAGE); } });
public void run() { String msg = SUtil.wrapText("Concurrency must be greater zero."); JOptionPane.showMessageDialog(SGUI.getWindowParent(TestCenterPanel.this), msg, "Settings problem", JOptionPane.INFORMATION_MESSAGE); } });
/** * Show error when no receiver is specified. */ protected void noReceiverSpecified() { String text = SUtil.wrapText("Cannot not send message, no receiver specified."); JOptionPane.showMessageDialog(SGUI.getWindowParent(ConversationPanel.this), text, "Message Error", JOptionPane.INFORMATION_MESSAGE); }
public void actionPerformed(ActionEvent e) { try { BrowserLauncher2.openURL("http://www.activecomponents.org/"); } catch(java.io.IOException ex) { String txt = SUtil.wrapText("Could not open URL in browser\n\n"+ex.getMessage()); JOptionPane.showMessageDialog(SGUI.getWindowParent(tb), txt, "Browser Error", JOptionPane.ERROR_MESSAGE); //ex.printStackTrace(); } } });
public void run() { File file = f; if(file!=null) { if(file.exists()) { String msg = SUtil.wrapText("The file: "+file.getAbsolutePath()+" exists.\n"+ " Do you want to overwrite the file?"); int o = JOptionPane.showConfirmDialog(ControlCenterWindow.this, msg, "Overwrite Warning", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if(JOptionPane.NO_OPTION==o) return; } else if(!file.getName().toLowerCase().endsWith(ControlCenter.SETTINGS_EXTENSION)) { file = new File(file.getAbsolutePath()+ControlCenter.SETTINGS_EXTENSION); getFileChooser().setSelectedFile(file); } controlcenter.saveSettings(file); } } });
public void run() { File file = f; if(file!=null) { if(file.exists()) { String msg = SUtil.wrapText("The file: "+file.getAbsolutePath()+" exists.\n"+ " Do you want to overwrite the file?"); int o = JOptionPane.showConfirmDialog(ControlCenterWindow.this, msg, "Overwrite Warning", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if(JOptionPane.NO_OPTION==o) return; } else if(!file.getName().toLowerCase().endsWith(ControlCenter.SETTINGS_EXTENSION)) { file = new File(file.getAbsolutePath()+ControlCenter.SETTINGS_EXTENSION); getFileChooser().setSelectedFile(file); } controlcenter.saveSettings(file); } } });
Object message = SUtil.wrapText(text); if(exception!=null)
String msg = SUtil.wrapText("Cannot find file or directory:\n"+file); JOptionPane.showMessageDialog(SGUI.getWindowParent(treepanel.getTree()), msg, "Cannot find file or directory", JOptionPane.ERROR_MESSAGE);
public void action(Object obj) { if(ModelTreePanel.this.getModel().getNode(obj)==null && ModelTreePanel.this.getModel().getNode(obj.toString())==null) { // treepanel.addTopLevelNode(result); ModelTreePanel.this.addTopLevelNodeMeta(obj); } else { // Todo: already added to library service (remove?) String msg = SUtil.wrapText("Path can not be added twice:\n"+obj); JOptionPane.showMessageDialog(SGUI.getWindowParent(getTree()), msg, "Duplicate path", JOptionPane.INFORMATION_MESSAGE); } } };
final String text = SUtil.wrapText("Could not decode stored message: "+e.getMessage()); SwingUtilities.invokeLater(new Runnable()
final String text = SUtil.wrapText("Could not decode stored message: "+e.getMessage()); SwingUtilities.invokeLater(new Runnable()
/** * The body method is called on the * instantiated plan instance from the scheduler. */ @PlanBody public void body() { Alarm alarm = goal.getAlarm(); final Component parent = scope.getGui(); // Hack! final String message = alarm.getMessage()!=null ? SUtil.wrapText(alarm.getMessage()) : null; SwingUtilities.invokeLater(new Runnable() { public void run() { Toolkit.getDefaultToolkit().beep(); JOptionPane.showMessageDialog(parent, message, "Alarm is due", JOptionPane.INFORMATION_MESSAGE); } }); } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { Alarm alarm = (Alarm)getParameter("alarm").getValue(); final Component parent = ((GuiCreator)getBeliefbase().getBelief("gui").getFact()).getGui(); // Hack! final String message = alarm.getMessage()!=null ? SUtil.wrapText(alarm.getMessage()) : null; SwingUtilities.invokeLater(new Runnable() { public void run() { Toolkit.getDefaultToolkit().beep(); JOptionPane.showMessageDialog(parent, message, "Alarm is due", JOptionPane.INFORMATION_MESSAGE); } }); } }