當前位置: 首頁>>代碼示例>>Java>>正文


Java SwingWorker.addPropertyChangeListener方法代碼示例

本文整理匯總了Java中javax.swing.SwingWorker.addPropertyChangeListener方法的典型用法代碼示例。如果您正苦於以下問題:Java SwingWorker.addPropertyChangeListener方法的具體用法?Java SwingWorker.addPropertyChangeListener怎麽用?Java SwingWorker.addPropertyChangeListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.SwingWorker的用法示例。


在下文中一共展示了SwingWorker.addPropertyChangeListener方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: DreamHouse

import javax.swing.SwingWorker; //導入方法依賴的package包/類
/**
 * Create the application.
 */
public DreamHouse() {
           
               SwingWorker worker = new SwingWorker() {
                   @Override
                   protected Object doInBackground() throws Exception {
                       c = new Controller();
                       return null;
                   }
               };
               final JDialog dialog = new JDialog();
               
               worker.addPropertyChangeListener(new SwingerWorkerCompletionWaiter(dialog));
               
               final JOptionPane oPane = new JOptionPane("I am learning. Please wait.", JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{}, null);
               dialog.setTitle("Hello Dave");
               dialog.setModal(true);
               dialog.setContentPane(oPane);
               dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
               dialog.pack();
               dialog.setLocationRelativeTo(null);
               worker.execute();
               dialog.setVisible(true);
	initialize();
}
 
開發者ID:matlai17,項目名稱:Zillow-Classification-599,代碼行數:28,代碼來源:DreamHouse.java

示例2: PredictHousePrice

import javax.swing.SwingWorker; //導入方法依賴的package包/類
/**
 * Create the application.
 */
public PredictHousePrice() {
               SwingWorker worker = new SwingWorker() {
                   @Override
                   protected Object doInBackground() throws Exception {
                       c = new Controller();
                       return null;
                   }
               };
               final JDialog dialog = new JDialog();
               
               worker.addPropertyChangeListener(new SwingerWorkerCompletionWaiter(dialog));
               
               final JOptionPane oPane = new JOptionPane("I am learning. Please wait.", JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{}, null);
               dialog.setTitle("Hello Dave");
               dialog.setModal(true);
               dialog.setContentPane(oPane);
               dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
               dialog.pack();
               dialog.setLocationRelativeTo(null);
               worker.execute();
               dialog.setVisible(true);
               
	initialize();
}
 
開發者ID:matlai17,項目名稱:Zillow-Classification-599,代碼行數:28,代碼來源:PredictHousePrice.java

示例3: createAction

import javax.swing.SwingWorker; //導入方法依賴的package包/類
public void createAction() {

        zepui.processing.setText("Starting Conversion...");
        zepui.processing.setForeground(Color.BLACK);

        SwingWorker<Integer, Object> w = new SwingWorker<Integer, Object>() {
            @Override
            protected Integer doInBackground() throws Exception {
                return convertAndSaveImages();
            }
        };

        w.execute();
        w.addPropertyChangeListener(evt -> {
            if (evt.getNewValue() == SwingWorker.StateValue.DONE) {
                try {
                    int result = w.get();
                    switch (result) {
                        case 1 :
                            zepui.setSuccessText("All done! :-)");
                            break;
                        case -1 :
                            zepui.setErrorText("Error: Couldn't create outputfolder :-(");
                            break;
                        case -2 :
                            zepui.setErrorText("Error: Couldn't create outputfolder :-(");
                            break;
                        case -3 :
                            zepui.setErrorText("Error: Select an image first");
                            break;
                    }
                } catch (InterruptedException | ExecutionException e) {
                    zepui.setErrorText("Error: Some unexpected shit happened :-(");
                    e.printStackTrace();
                }
            }
        });
    }
 
開發者ID:wolfposd,項目名稱:ZeppelinIconsMaker,代碼行數:39,代碼來源:ZepController.java

示例4: register

import javax.swing.SwingWorker; //導入方法依賴的package包/類
public void register(SwingWorker<?, ?> worker, String name) {
worker.addPropertyChangeListener(new Starter(this, name));
 }
 
開發者ID:caduandrade,項目名稱:japura-gui,代碼行數:4,代碼來源:SwingWorkerHandler.java


注:本文中的javax.swing.SwingWorker.addPropertyChangeListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。