1 package net.suberic.pooka.gui; 2 3 import javax.swing.*; 4 5 9 public class ProgressInternalDialog extends ProgressDialogImpl { 10 11 JInternalFrame dialogFrame = null; 12 JDesktopPane desktop = null; 13 14 18 public ProgressInternalDialog(int min, int max, int current, String title, String message, JDesktopPane desktopPane) { 19 initDialog(min, max, current, title, message); 20 desktop = desktopPane; 21 } 22 23 26 protected void createDialog() { 27 dialogFrame = new JInternalFrame(nameLabel.getText(), true, false, false, true); 28 dialogFrame.getContentPane().setLayout(new BoxLayout(dialogFrame.getContentPane(), BoxLayout.Y_AXIS)); 29 30 dialogFrame.getContentPane().add(nameLabel); 31 dialogFrame.getContentPane().add(progressBar); 32 dialogFrame.getContentPane().add(buttonPanel); 33 34 dialogFrame.pack(); 35 36 } 37 38 41 public void show() { 42 Runnable runMe = new Runnable () { 43 public void run() { 44 desktop.add(dialogFrame); 45 if (desktop instanceof MessagePanel) { 46 dialogFrame.setLocation(((MessagePanel) desktop).getNewWindowLocation(dialogFrame, true)); 47 } 48 dialogFrame.setVisible(true); 49 } 50 }; 51 if (SwingUtilities.isEventDispatchThread()) 52 runMe.run(); 53 else 54 SwingUtilities.invokeLater(runMe); 55 } 56 57 60 public void dispose() { 61 Runnable runMe = new Runnable () { 62 public void run() { 63 try { 64 dialogFrame.setClosed(true); 65 } catch (java.beans.PropertyVetoException e) { 66 } 67 } 68 }; 69 70 if (SwingUtilities.isEventDispatchThread()) 71 runMe.run(); 72 else 73 SwingUtilities.invokeLater(runMe); 74 } 75 76 } 77 | Popular Tags |