本文整理汇总了Java中org.jdesktop.application.SingleFrameApplication.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java SingleFrameApplication.getInstance方法的具体用法?Java SingleFrameApplication.getInstance怎么用?Java SingleFrameApplication.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.application.SingleFrameApplication
的用法示例。
在下文中一共展示了SingleFrameApplication.getInstance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionEvent
import org.jdesktop.application.SingleFrameApplication; //导入方法依赖的package包/类
/**
* Perform the action.
*/
@Override
public void actionEvent(ActionEvent event)
{
ProdEdit app = (ProdEdit) SingleFrameApplication.getInstance();
ProjectService projService = app.getProjectService();
File file = projService.getProject().getFile();
if (file == null)
{
super.actionEvent(event);
return;
}
final JFrame mainWin = app.getMainFrame();
try
{
mainWin.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
projService.saveProject(file);
app.setStatusMessage(I18n.formatMessage("Project.saved", projService.getProject().getName()));
}
finally
{
mainWin.setCursor(Cursor.getDefaultCursor());
}
}
示例2: actionEvent
import org.jdesktop.application.SingleFrameApplication; //导入方法依赖的package包/类
/**
* Perform the action.
*/
@Override
public void actionEvent(ActionEvent e)
{
SingleFrameApplication app = (SingleFrameApplication) SingleFrameApplication.getInstance();
final JFrame mainWin = app.getMainFrame();
try
{
mainWin.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
final Settings dlg = new Settings(mainWin);
dlg.setVisible(true);
}
finally
{
mainWin.setCursor(Cursor.getDefaultCursor());
}
}
示例3: actionEvent
import org.jdesktop.application.SingleFrameApplication; //导入方法依赖的package包/类
/**
* Perform the action.
*/
@Override
public void actionEvent(ActionEvent event)
{
DevTool app = (DevTool) SingleFrameApplication.getInstance();
ProjectService projService = app.getProjectService();
File file = projService.getProject().getFile();
if (file == null)
{
super.actionEvent(event);
return;
}
final JFrame mainWin = app.getMainFrame();
try
{
mainWin.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
projService.saveProject(file);
}
finally
{
mainWin.setCursor(Cursor.getDefaultCursor());
}
}
示例4: actionEvent
import org.jdesktop.application.SingleFrameApplication; //导入方法依赖的package包/类
/**
* Perform the action.
*/
@Override
public void actionEvent(ActionEvent e)
{
ProdEdit app = (ProdEdit) SingleFrameApplication.getInstance();
final JFrame mainWin = app.getMainFrame();
final Config cfg = Config.getInstance();
String lastDir = cfg.getStringValue("project.lastDir");
final JFileChooser dlg = new JFileChooser();
dlg.setCurrentDirectory(new File(lastDir));
final FileFilter fileFilter = new ProjectFileFilter();
dlg.addChoosableFileFilter(fileFilter);
dlg.addChoosableFileFilter(dlg.getAcceptAllFileFilter());
dlg.setFileFilter(fileFilter);
dlg.setDialogTitle(I18n.getMessage("SaveProjectAsAction.title"));
if (dlg.showOpenDialog(mainWin) != JFileChooser.APPROVE_OPTION)
return;
File file = dlg.getSelectedFile();
if (file == null) return;
cfg.put("project.lastDir", file.getParent());
try
{
mainWin.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
app.getProjectService().saveProject(file);
app.setStatusMessage(I18n.formatMessage("Project.saved", app.getProjectService().getProject().getName()));
}
finally
{
mainWin.setCursor(Cursor.getDefaultCursor());
}
}
示例5: actionEvent
import org.jdesktop.application.SingleFrameApplication; //导入方法依赖的package包/类
/**
* Perform the action.
*/
@Override
public void actionEvent(ActionEvent e)
{
ProdEdit app = (ProdEdit) SingleFrameApplication.getInstance();
// final JFrame mainWin = app.getMainFrame();
app.getProjectService().createProject();
}
示例6: actionEvent
import org.jdesktop.application.SingleFrameApplication; //导入方法依赖的package包/类
/**
* Perform the action.
*/
@Override
public void actionEvent(ActionEvent e)
{
SingleFrameApplication app = (SingleFrameApplication) SingleFrameApplication.getInstance();
final JFrame mainWin = app.getMainFrame();
final Config cfg = Config.getInstance();
String lastDir = cfg.getStringValue("project.lastDir");
final JFileChooser dlg = new JFileChooser();
dlg.setCurrentDirectory(new File(lastDir));
final FileFilter fileFilter = new ProjectFileFilter(true);
dlg.addChoosableFileFilter(fileFilter);
dlg.addChoosableFileFilter(dlg.getAcceptAllFileFilter());
dlg.setFileFilter(fileFilter);
dlg.setDialogTitle(I18n.getMessage("OpenProjectAction.title"));
if (dlg.showOpenDialog(mainWin) != JFileChooser.APPROVE_OPTION)
return;
final File file = dlg.getSelectedFile();
if (file == null) return;
cfg.put("project.lastDir", file.getParent());
try
{
mainWin.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
DevTool.getInstance().getProjectService().loadProject(file);
}
finally
{
mainWin.setCursor(Cursor.getDefaultCursor());
}
}
示例7: actionEvent
import org.jdesktop.application.SingleFrameApplication; //导入方法依赖的package包/类
/**
* Perform the action.
*/
@Override
public void actionEvent(ActionEvent e)
{
DevTool app = (DevTool) SingleFrameApplication.getInstance();
final JFrame mainWin = app.getMainFrame();
final Config cfg = Config.getInstance();
String lastDir = cfg.getStringValue("project.lastDir");
final JFileChooser dlg = new JFileChooser();
dlg.setCurrentDirectory(new File(lastDir));
final FileFilter fileFilter = new ProjectFileFilter(false);
dlg.addChoosableFileFilter(fileFilter);
dlg.addChoosableFileFilter(dlg.getAcceptAllFileFilter());
dlg.setFileFilter(fileFilter);
dlg.setDialogTitle(I18n.getMessage("SaveProjectAsAction.title"));
if (dlg.showOpenDialog(mainWin) != JFileChooser.APPROVE_OPTION)
return;
File file = dlg.getSelectedFile();
if (file == null) return;
cfg.put("project.lastDir", file.getParent());
try
{
mainWin.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
app.getProjectService().saveProject(file);
}
finally
{
mainWin.setCursor(Cursor.getDefaultCursor());
}
}
示例8: actionEvent
import org.jdesktop.application.SingleFrameApplication; //导入方法依赖的package包/类
/**
* Perform the action.
*/
@Override
public void actionEvent(ActionEvent e)
{
DevTool app = (DevTool) SingleFrameApplication.getInstance();
// final JFrame mainWin = app.getMainFrame();
app.getProjectService().newProject();
}
示例9: showErrorDialog
import org.jdesktop.application.SingleFrameApplication; //导入方法依赖的package包/类
/**
* Show an error dialog.
*
* @param title - The title of the dialog window
* @param message - Some human readable message (not
* {@link Exception#getMessage}!)
*/
public static void showErrorDialog(String title, String message)
{
SingleFrameApplication app = (SingleFrameApplication) SingleFrameApplication.getInstance();
JFrame appWin = app.getMainFrame();
if (appWin != null)
appWin.setCursor(Cursor.getDefaultCursor());
if (!message.startsWith("<html>"))
message = "<html><body width=\"400px\">" + message.replace("\n", "<br>") + "</body></html>";
JOptionPane.showMessageDialog(appWin, message, title, JOptionPane.ERROR_MESSAGE,
ImageCache.getIcon("error-dialog"));
}