当前位置: 首页>>代码示例>>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;未经允许,请勿转载。