當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。