当前位置: 首页>>代码示例>>Java>>正文


Java SingleFrameApplication.getInstance方法代码示例

本文整理汇总了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());
   }
}
 
开发者ID:selfbus,项目名称:development-tools-incubation,代码行数:29,代码来源:SaveProjectAction.java

示例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());
   }
}
 
开发者ID:selfbus,项目名称:development-tools-incubation,代码行数:20,代码来源:SettingsAction.java

示例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());
   }
}
 
开发者ID:selfbus,项目名称:development-tools-incubation,代码行数:28,代码来源:SaveProjectAction.java

示例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());
   }
}
 
开发者ID:selfbus,项目名称:development-tools-incubation,代码行数:40,代码来源:SaveProjectAsAction.java

示例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();
   }
 
开发者ID:selfbus,项目名称:development-tools-incubation,代码行数:12,代码来源:NewProjectAction.java

示例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());
   }
}
 
开发者ID:selfbus,项目名称:development-tools-incubation,代码行数:39,代码来源:OpenProjectAction.java

示例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());
   }
}
 
开发者ID:selfbus,项目名称:development-tools-incubation,代码行数:39,代码来源:SaveProjectAsAction.java

示例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();
   }
 
开发者ID:selfbus,项目名称:development-tools-incubation,代码行数:12,代码来源:NewProjectAction.java

示例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"));
}
 
开发者ID:selfbus,项目名称:tools-libraries,代码行数:22,代码来源:Dialogs.java


注:本文中的org.jdesktop.application.SingleFrameApplication.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。