⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialogutils.java

📁 一个很好实用的工作流OSWORKFLOW开发例子.有着非常优秀的灵活性.
💻 JAVA
字号:
package com.opensymphony.workflow.designer.dialogs;import java.awt.*;import java.util.Iterator;import java.util.Map;import java.util.Set;import javax.swing.*;import com.opensymphony.workflow.designer.swing.MapPanel;import com.opensymphony.workflow.designer.swing.JavaTextPane;import com.opensymphony.workflow.designer.ResourceManager;import com.opensymphony.workflow.loader.ArgsAware;/** * @author Gulei */public class DialogUtils{	private static JTextPane textArea = new JavaTextPane();  public static Object getUserSelection(Object[] values, String message, String title, Component parent)  {    return JOptionPane.showInputDialog(parent, // parent component      message, // dialog message      title, // dialog title      JOptionPane.QUESTION_MESSAGE, // question message type      ResourceManager.getIcon("saveas"), // icon      values, // selections      null);							// initial select  }	public static String getTextDialog(String initialValue, Component parent)	{		JPanel panel = new JPanel(new GridLayout(1, 1));		textArea.setText(initialValue!=null ? initialValue.trim() : "");		panel.add(new JScrollPane(textArea));		JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);		JDialog dialog = pane.createDialog(parent, ResourceManager.getString("specify.properties"));		dialog.setSize(450, 190);		dialog.setResizable(true);		dialog.show();		Integer value = (Integer)pane.getValue();		if(value == null)		{		  return null;		}		if(value.intValue() != JOptionPane.OK_OPTION)		{		  return null;		}		return textArea.getText().trim();	}  public static Map getMapDialog(ArgsAware descriptor, String type, String owner, Component parent)  {  	BaseDialog dialog = new BaseDialog((Frame)parent, ResourceManager.getString("specify.properties"), true);    dialog.getBanner().setSubtitle(ResourceManager.getString("specify.properties.long"));    MapPanel panel = new MapPanel(descriptor, type, owner);    dialog.getContentPane().add(panel);    dialog.setResizable(true);        boolean result = dialog.ask(parent);    if(!result) return null;    Map edits = panel.getEdits();    Map args = descriptor.getArgs();    Set keys = args.keySet();    Iterator iter = keys.iterator();    while(iter.hasNext())    {      Object key = iter.next();      JTextField field = (JTextField)edits.get(key);      String newValue = field.getText();      args.put(key, newValue);    }    return args;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -