1 15 16 18 36 package ixenon.free.install; 37 38 import java.awt.*; 39 import java.awt.event.*; 40 import java.beans.*; 41 import java.util.*; import java.io.*; import java.net.*; 45 import javax.swing.*; import javax.swing.event.*; 47 import javax.swing.border.*; 49 import ixenon.free.util.*; import ixenon.free.swing.*; 52 53 62 public class InstallerFrame extends JFrame 63 implements ActionListener, InstallConstants, HyperlinkListener 64 { 65 66 public final static String HELP_BUTTON_PRESSED_PROPERTY="help_button_pressed_property"; 67 68 public final static String INSTALL_BUTTON_PRESSED_PROPERTY="install_button_pressed_property"; 69 70 public final static String QUIT_BUTTON_PRESSED_PROPERTY="quit_button_pressed_property"; 71 72 public final static String BROWSE_BUTTON_PRESSED_PROPERTY="browse_button_pressed_property"; 73 74 75 protected String companyName; 76 77 protected String productName; 78 79 80 protected File prefix; 81 82 83 protected Locale locale=null; 84 85 86 protected int installMode=-1; 87 88 89 protected Locale[] locales = getAvailableLocales(); 90 91 94 public final static String DEFAULT_APPLICATION_CONTENT= 95 "Sorry, no application/license content could be found.\n\n"+ 96 "Please look at the application property file in particular \n"+ 97 "the resource called `FreeInstaller.installerFrame.applicationURL'\n\n"+ 98 "For more information about Free Installer [c] 1999 License\n"+ 99 "and distribution read informational files.\n"; 100 101 102 public final static String DEFAULT_APPLICATION_CONTENT_TYPE="text/plain"; 103 104 private SwingPropertyChangeSupport propertyListeners; 105 106 protected final static String HELP_BUTTON_COMMAND="help"; 107 protected final static String INSTALL_BUTTON_COMMAND="install"; 108 protected final static String QUIT_BUTTON_COMMAND="quit"; 109 protected final static String BROWSE_BUTTON_COMMAND="browse"; 110 111 112 protected JPanel splashPanel; 113 protected JPanel centerArea; protected ImageIcon splashImage; 115 protected JLabel splashLabel; 116 117 protected JComboBox languageCombo; 118 protected JComboBox instModeCombo; 119 120 protected JTextField tf_prefix; 121 protected JButton bt_browse; 122 protected JButton bt_install; 123 protected JButton bt_quit; 124 protected JButton bt_help; 125 126 protected JEditorPane editorPane; 127 128 protected JMenu mb_license; 130 146 public InstallerFrame( String title, String splashImageName, String companyName, String productName ) 147 { 148 super(title); 149 150 ApplicationResources appres = ApplicationResources.getInstance(); 154 155 if (splashImageName == null) 156 splashImageName = appres.getResourceString( "installerFrame.splashImage", "appres/images/M16Crop.jpg" ); 157 158 String frameIconName = appres.getResourceString( "installerFrame.icon", "appres/images/FreeInstaller-icon.gif" ); 159 160 String appURLName = appres.getResourceString( "installerFrame.applicationURL", "appres/docs/FREE-INST-DEFAULT.html" ); 161 String appURLPath = appres.resolvePathname( "docs", appURLName, null ); 162 163 String browseButtonText = appres.getResourceString( "installerFrame.browse.text", "Browse" ); 164 int browseButtonMnemonic = appres.getResourceMnemonic( "installerFrame.browse.mnemonic", 'B' ); 165 String browseButtonToolTip = appres.getResourceString( "installerFrame.browse.toolTipText", "change target directory" ); 166 String installButtonText = appres.getResourceString( "installerFrame.install.text", "Install" ); 167 int installButtonMnemonic = appres.getResourceMnemonic( "installerFrame.install.mnemonic", 'I' ); 168 String installButtonToolTip = appres.getResourceString( "installerFrame.install.toolTipText", "begin installation" ); 169 String quitButtonText = appres.getResourceString( "installerFrame.quit.text", "Quit" ); 170 int quitButtonMnemonic = appres.getResourceMnemonic( "installerFrame.quit.mnemonic", 'Q' ); 171 String quitButtonToolTip = appres.getResourceString( "installerFrame.quit.toolTipText", "quit installation" ); 172 String helpButtonText = appres.getResourceString( "installerFrame.help.text", "Help" ); 173 int helpButtonMnemonic = appres.getResourceMnemonic( "installerFrame.help.mnemonic", 'H' ); 174 String helpButtonToolTip = appres.getResourceString( "installerFrame.help.toolTipText", "get help" ); 175 176 Font entryFont = appres.getFont( "installerFrame.entryFont", 180 new Font( "DialogInput", Font.BOLD, 12 )); 181 Font labelFont = appres.getFont( "installerFrame.labelFont", 182 new Font( "Dialog", Font.BOLD, 12 )); 183 Font textFont = appres.getFont( "installerFrame.textFont", 184 new Font( "Courier", Font.BOLD, 10 )); 185 this.companyName = companyName; 189 this.productName = productName; 190 191 204 String osname = System.getProperty( "os.name"); 205 String osvers = System.getProperty( "os.vers"); 206 String pathSep = System.getProperty( "path.separator" ); String fileSep = System.getProperty( "file.separator" ); if ( osname.startsWith("Windows 95") || 209 osname.startsWith("Windows 98") || 210 osname.startsWith("Windows 2000") || 211 osname.startsWith("Windows NT") ) 212 prefix = new File( "C:"+fileSep+"Program Files"+ 214 fileSep+companyName+fileSep+productName ); 215 else if ( osname.startsWith("OS/2") ) 216 prefix = new File( "C:"+fileSep+"Packages"+ 218 fileSep+companyName+fileSep+productName ); 219 else 220 prefix = new File( fileSep+"usr"+fileSep+"local"+fileSep+companyName+ 222 fileSep+productName ); 223 224 226 getContentPane().setLayout( new BorderLayout(9,9)); 227 228 JMenuBar menubar = new JMenuBar(); 232 setJMenuBar(menubar); 233 234 JMenu info = createMenu( "info", "Info", 'N' ); 236 menubar.add(info); 238 239 JMenuItem mb_license = 240 createMenuItem( "info.viewLicense", 241 "view-license", "FreeInstaller License ...", 'L', null ); 242 mb_license.addActionListener(this); 243 mb_license.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_L, ActionEvent.CTRL_MASK)); 244 info.add(mb_license); 245 246 JMenuItem mb_author = 247 createMenuItem( "info.viewAuthor", 248 "view-author", "FreeInstaller Author ...", 'A', null ); 249 mb_author.addActionListener(this); 250 mb_author.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK)); 251 info.add(mb_author); 252 253 257 splashPanel = new JPanel(); 258 259 Image img1 = appres.getImage( "images", frameIconName, null ); 260 setIconImage( img1 ); 261 262 Image img2 = appres.getImage( "images", splashImageName, null ); 263 splashImage = new ImageIcon( img2 ); 264 if (splashImage != null) 265 splashLabel = new JLabel( splashImage ); 266 else 267 splashLabel = new JLabel( "No Image Icon Loaded" ); 268 CompoundBorder border = new CompoundBorder( 269 new BevelBorder( BevelBorder.RAISED ), 270 new BevelBorder( BevelBorder.LOWERED )); 271 splashLabel.setBorder( border ); 272 273 splashPanel.add( "Center", splashLabel ); 274 splashLabel.setPreferredSize( new Dimension(300, 400)); 275 276 getContentPane().add( "West", splashLabel ); 277 278 279 283 JPanel np = new JPanel(); 285 np.setLayout( new BorderLayout(4,4) ); 286 287 languageCombo = new JComboBox(); 288 languageCombo.setFont( labelFont ); 289 languageCombo.setEditable( false ); 290 languageCombo.setActionCommand( "select-locale" ); 291 languageCombo.addItem("Please choose a locale/language"); 292 languageCombo.addActionListener(this); 293 int q; 294 295 Locale defLocale = Locale.getDefault(); 296 for (q=0; q<locales.length; ++q) { 297 302 languageCombo.addItem( 303 locales[q].getDisplayName() + 304 (defLocale == locales[q] ? " *Default*" : "" ) ); 305 } 306 np.add( "North", languageCombo ); 307 308 instModeCombo = new JComboBox(); 309 instModeCombo.setFont( labelFont ); 310 instModeCombo.setEditable( false ); 311 instModeCombo.setActionCommand("select-install-mode"); 312 instModeCombo.addActionListener(this); 313 instModeCombo.addItem("Please choose an installation mode"); 314 instModeCombo.addItem( BASIC_INSTALLATION_STRING); 315 instModeCombo.addItem( CUSTOM_INSTALLATION_STRING); 316 instModeCombo.addItem( COMPACT_INSTALLATION_STRING); 317 np.add( "Center", instModeCombo ); 318 319 JPanel anyPanel = new JPanel(); 321 anyPanel.setLayout( new BorderLayout(2,2) ); 322 323 JLabel prefixLabel = new JLabel( "Enter The Installation Directory:"); 324 prefixLabel.setFont( labelFont ); 325 anyPanel.add( "North", prefixLabel ); 326 327 tf_prefix = new JTextField( prefix.getPath() ); 328 tf_prefix.setFont( entryFont ); 329 anyPanel.add( "Center", tf_prefix ); 330 331 bt_browse = new JButton( browseButtonText ); 332 bt_browse.setMnemonic( browseButtonMnemonic ); 333 bt_browse.setFont( labelFont ); 334 bt_browse.setActionCommand("browse"); 335 bt_browse.addActionListener(this); 336 anyPanel.add( "East", bt_browse ); 337 np.add( "South", anyPanel ); 338 339 centerArea = new JPanel(); 340 centerArea.setLayout( new BorderLayout(2,2) ); 341 centerArea.add("North",np ); 342 343 345 editorPane = new JEditorPane(); 348 editorPane.setFont( textFont ); 349 editorPane.addHyperlinkListener( this ); 350 editorPane.setToolTipText( "application info text" ); 351 try { 352 File file = new File(appURLPath); 353 if ( file.exists() ) 354 appURLPath = "file:"+file.getAbsolutePath(); 355 editorPane.setPage( appURLPath ); 357 } 358 catch (IOException e) { 359 System.err.println( "I/O Exception failure:"+e ); editorPane.setContentType( DEFAULT_APPLICATION_CONTENT_TYPE ); 361 editorPane.setText( DEFAULT_APPLICATION_CONTENT ); 362 } 363 editorPane.setEditable( false ); 364 365 JScrollPane ta_scrollable_text = new JScrollPane( editorPane ) { 366 public Dimension getPreferredSize() { 367 Dimension size = getSize(); 368 if (size.width < 400 ) 369 size.width = 400; 370 if (size.height < 360 ) 371 size.height = 360; 372 return (size); 373 } 374 }; 375 centerArea.add("Center", ta_scrollable_text ); 376 377 JPanel sp = new JPanel(); 379 sp.setLayout( new FlowLayout( FlowLayout.LEFT, 10, 10 )); 380 bt_install = new JButton( installButtonText ); 381 bt_install.setMnemonic( installButtonMnemonic ); 382 bt_install.setFont(labelFont); 383 bt_install.setActionCommand("install"); 384 bt_install.addActionListener(this); 385 sp.add( bt_install); 386 387 bt_quit = new JButton( quitButtonText); 388 bt_quit.setMnemonic( quitButtonMnemonic ); 389 bt_quit.setFont(labelFont); 390 bt_quit.setActionCommand("quit"); 391 bt_quit.addActionListener(this); 392 sp.add( bt_quit); 393 394 bt_help = new JButton( helpButtonText ); 395 bt_help.setMnemonic( helpButtonMnemonic ); 396 bt_help.setFont(labelFont); 397 bt_help.setActionCommand("help"); 398 bt_help.addActionListener(this); 399 sp.add( bt_help); 400 401 DigitalClock clock = new DigitalClock(); 403 clock.start(); 404 clock.setBorder(new BevelBorder( BevelBorder.LOWERED )); 405 sp.add(clock); 406 407 centerArea.add("South", sp ); 408 409 getContentPane().add("Center", centerArea ); 410 411 setSize( 600, 450 ); 412 413 bt_install.registerKeyboardAction( 416 new DebuggablePrefix(), 417 KeyStroke.getKeyStroke( 418 KeyEvent.VK_D, InputEvent.SHIFT_MASK|InputEvent.CTRL_MASK, true ), 419 JComponent.WHEN_IN_FOCUSED_WINDOW ); 420 } 421 422 protected JMenu createMenu( String resource_name, 423 String default_name, 424 int default_mnemonic ) 425 { 426 JMenu menu; 427 428 ApplicationResources appres = ApplicationResources.getInstance(); 429 String menuLabel = 430 appres.getResourceString( 431 "menubar." + resource_name + ".label", default_name ); 432 int menuMnemonic = 433 appres.getResourceMnemonic( 434 "menubar." + resource_name + ".mnemonic", default_mnemonic ); 435 436 menu = new JMenu( menuLabel ); 437 if (menuMnemonic>0) menu.setMnemonic( menuMnemonic ); 438 return (menu); 439 } 440 441 protected JMenuItem createMenuItem( String resource_name, 442 String action_command, 443 String default_name, 444 int default_mnemonic, 445 String accelerator ) 446 { 447 JMenuItem menuitem; 448 449 ApplicationResources appres = ApplicationResources.getInstance(); 450 String itemLabel = 451 appres.getResourceString( 452 resource_name + ".label", default_name ); 453 int itemMnemonic = 454 appres.getResourceMnemonic( 455 resource_name + ".mnemonic", default_mnemonic ); 456 String itemAccel = 457 appres.getResourceString( 458 resource_name + ".accelerator", accelerator ); 459 460 menuitem = new JMenuItem( itemLabel ); 461 if (itemMnemonic>0) 462 menuitem.setMnemonic( itemMnemonic ); 463 if (action_command != null) 464 menuitem.setActionCommand(action_command); 465 return (menuitem); 466 } 467 468 469 public ImageIcon getSplashImageIcon() 470 { 471 return (splashImage); 472 } 473 474 475 public void setSplashImageIcon( ImageIcon newIcon ) 476 { 477 if (newIcon != null) { 478 splashImage = newIcon; 479 splashLabel.setIcon(splashImage); 480 } 481 } 482 483 484 public File getPrefix() 485 { 486 String tmp = tf_prefix.getText().trim(); 488 prefix = new File(tmp); 489 return (prefix); 490 } 491 492 493 public void setPrefix( File newPrefix ) 494 { 495 if (newPrefix == null) 496 newPrefix = new File( System.getProperty("user.home" )); 497 if (newPrefix.isFile() ) 498 newPrefix = new File( newPrefix.getParent() ); 500 prefix = newPrefix; 501 tf_prefix.setText( prefix.getPath() ); 502 } 503 504 505 public Locale getLocale() 506 { 507 return (locale); 509 } 510 511 512 public void setLocale( Locale newLocale ) 513 { 514 locale = newLocale; 515 516 for (int j=0; j<locales.length; ++j) 518 if ( locales[j] == locale ) 519 languageCombo.setSelectedIndex(j+1); 520 } 521 522 523 public int getInstallMode() 524 { 525 return (installMode); 527 } 528 529 530 public void setInstallMode( int newMode ) 531 { 532 installMode = newMode; 533 if ( newMode >= 0 ) 535 instModeCombo.setSelectedIndex(newMode); 536 } 537 538 541 public Locale[] getAvailableLocales() 542 { 543 Locale [] locales = new Locale[] { 544 Locale.UK, Locale.CANADA, 546 Locale.CANADA_FRENCH, 547 Locale.CHINA, 548 Locale.CHINESE, 549 Locale.ENGLISH, 550 Locale.FRANCE, 551 Locale.FRENCH, 552 Locale.GERMAN, 553 Locale.GERMANY, 554 Locale.ITALIAN, 555 Locale.ITALY, 556 Locale.JAPAN, 557 Locale.JAPANESE, 558 Locale.KOREA, 559 Locale.KOREAN, 560 Locale.PRC, 561 Locale.SIMPLIFIED_CHINESE, 562 Locale.TAIWAN, 563 Locale.TRADITIONAL_CHINESE, 564 Locale.UK, 565 Locale.US }; 566 locales[0] = Locale.getDefault(); 567 return (locales); 568 } 569 570 574 public void setVisible( boolean visible ) 575 { 576 if (visible) { 577 Dimension size = new Dimension(getSize()); 578 Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); 579 580 if (screen.width > 1100 ) { 581 size.width = 1024; 583 size.height = 695; 584 } 585 int x = (screen.width-size.width)/2; 586 int y = (screen.height-size.height)/2; 587 setBounds(x, y, size.width, size.height); 588 } 589 590 super.setVisible(visible); 591 } 592 593 594 600 public static int popupExceptionDialog( Frame frame, Exception ex ) 601 { 602 return popupErrorDialog( frame, 604 "exceptionDialog", "Java Exception Dialog", 605 ex.getMessage() ); 606 } 607 608 609 625 public static int popupInfoDialog( Frame frame, String resource, 626 String def, String errmsg ) 627 { 628 return popupOptionPaneDialog( frame, JOptionPane.INFORMATION_MESSAGE, 629 JOptionPane.OK_CANCEL_OPTION, 630 resource, def, errmsg ); 631 } 632 633 649 public static int popupWarningDialog( Frame frame, String resource, 650 String def, String errmsg ) 651 { 652 return popupOptionPaneDialog( frame, JOptionPane.INFORMATION_MESSAGE, 653 JOptionPane.DEFAULT_OPTION, 654 resource, def, errmsg ); 655 } 656 657 673 public static int popupErrorDialog( Frame frame, String resource, 674 String def, String errmsg ) 675 { 676 return popupOptionPaneDialog( frame, JOptionPane.ERROR_MESSAGE, 677 JOptionPane.DEFAULT_OPTION, 678 resource, def, errmsg ); 679 } 680 681 682 683 703 public static int popupOptionPaneDialog( 704 Frame frame, int dialogType, int dialogOption, 705 String resource, String def, String errmsg ) 706 { 707 JTextArea ta_error_msg; JScrollPane ta_error_msg_scroller; 714 ta_error_msg = new JTextArea( "" ); 715 ta_error_msg.setEditable(false); 716 ta_error_msg.setFont( new Font("Dialog", Font.PLAIN, 10 )); 717 ta_error_msg_scroller = new JScrollPane() { 718 public Dimension getPreferredSize() { 719 Dimension currSize = new Dimension( getSize() ); 720 if (currSize.width < 500 ) 721 currSize.width = 500; 722 if (currSize.height < 200 ) 723 currSize.height = 200; 724 725 return currSize; 726 } 727 public float getAlignmentX() { 728 return LEFT_ALIGNMENT; 729 } 730 }; 731 ta_error_msg_scroller.getViewport().add(ta_error_msg); ta_error_msg.setText( errmsg ); 733 734 Object msg[] = new Object [1]; 735 msg[0] = ta_error_msg_scroller; 736 737 ApplicationResources appres = ApplicationResources.getInstance(); 745 String dialogTitle = 746 appres.getResourceString( resource+".title", def ); 747 Object [] options; 748 if ( dialogType == JOptionPane.DEFAULT_OPTION ) { 749 options = new Object [1]; 750 options[0] = 751 appres.getResourceString( resource+".okButton.label", "Ok" ); 752 } 753 else { 754 options = new Object [2]; 755 options[0] = 756 appres.getResourceString( resource+".okButton.label", "Ok" ); 757 options[1] = 758 appres.getResourceString( resource+".cancelButton.label", "Cancel" ); 759 } 760 761 return JOptionPane.showOptionDialog( frame, msg, dialogTitle, 762 dialogOption, dialogType, 763 null, options, options[0] ); 764 } 765 766 770 public void hyperlinkUpdate( HyperlinkEvent evt ) 771 { 772 if ( evt.getEventType() == HyperlinkEvent.EventType.ENTERED ) 773 editorPane.setToolTipText( evt.getURL().toString() ); 774 } 775 776 780 public void addPropertyChangeListener( PropertyChangeListener listener ) 781 { 782 if (propertyListeners == null) 783 propertyListeners = new SwingPropertyChangeSupport( this ); 784 propertyListeners.addPropertyChangeListener( listener ); 785 } 786 787 791 public void removePropertyChangeListener( PropertyChangeListener listener ) 792 { 793 if (propertyListeners != null) 794 propertyListeners.removePropertyChangeListener( listener ); 795 } 796 797 803 public void firePropertyChange( String propertyName, Object oldValue, Object newValue ) 804 { 805 if (propertyListeners != null) 806 propertyListeners.firePropertyChange( propertyName, oldValue, newValue ); 807 } 808 809 public void actionPerformed( ActionEvent evt ) 810 { 811 String cmd = evt.getActionCommand(); 812 if (cmd.equals("browse")) { 813 814 firePropertyChange( BROWSE_BUTTON_PRESSED_PROPERTY, null, evt ); 815 816 JFileChooser chooser = new JFileChooser(); 817 chooser.setDialogTitle("Select Install Root Directory"); 818 chooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY ); 819 chooser.setCurrentDirectory( prefix ); 820 chooser.setApproveButtonText("Select Dir"); 821 chooser.setApproveButtonToolTipText("prefix directory"); 822 chooser.setApproveButtonMnemonic('S'); 823 824 int answer = chooser.showDialog(this,"Select Dir"); 825 if ( answer == JFileChooser.APPROVE_OPTION ) { 826 File dir = chooser.getSelectedFile(); 828 if (dir != null) { 829 prefix = dir; 831 tf_prefix.setText( prefix.getPath() ); 832 } 833 } 834 } 835 else if (cmd.equals("select-locale")) { 836 int idx = languageCombo.getSelectedIndex(); 837 if (idx <= 0 ) 838 locale = null; 839 else { 840 locale = locales[idx-1]; 841 } 843 } 844 else if (cmd.equals("select-install-mode")) { 845 int idx = instModeCombo.getSelectedIndex(); 846 if (idx <= 0 ) 847 installMode = -1; 848 else { 849 installMode = idx; 850 } 852 } 853 else if (cmd.equals("install")) { 854 prefix = new File( tf_prefix.getText().trim() ); 857 858 int idx1 = languageCombo.getSelectedIndex(); 859 int idx2 = instModeCombo.getSelectedIndex(); 860 if (idx1 <= 0 ) 861 popupErrorDialog( this, "errorDialog", 862 "Error Setting Dialog", 863 "please select an appropiate locale." ); 864 else if (idx2 <= 0 ) 865 popupErrorDialog( this, "errorDialog", 866 "Error Setting Dialog", 867 "please select a genuine installation mode." ); 868 else { 869 firePropertyChange( INSTALL_BUTTON_PRESSED_PROPERTY, null, evt ); 871 } 872 } 873 else if (cmd.equals("help")) { 874 firePropertyChange( HELP_BUTTON_PRESSED_PROPERTY, null, evt ); 875 popupHelpDialog( this, "Help.html" ); 876 } 877 else if (cmd.equals("quit")) { 878 firePropertyChange( QUIT_BUTTON_PRESSED_PROPERTY, null, evt ); 879 } 880 else if (cmd.equals("view-license")) { 881 popupViewLicenseDialog( this, null ); 882 } 883 else if (cmd.equals("view-author")) { 884 popupAuthorDialog( this, "Author.html" ); 885 } 886 887 } 888 889 public static void popupViewLicenseDialog( Frame frame, String url ) 890 { 891 if (url==null) url="appres/docs/FREE-INST-LICENSE.html"; 895 896 898 ApplicationResources appres = ApplicationResources.getInstance(); 899 String title = appres.getResourceString( "viewLicenseDialog.dialogTitle", "View License Dialog" ); 900 String licURLName = appres.getResourceString( "viewLicenseDialog.infoURL", url ); 901 String licURLPath = appres.resolvePathname( "docs", licURLName, null ); 902 903 String approveButtonText = 904 appres.getResourceString( "HTMLViewerDialog.approveButton.label", "Close" ); 905 String backButtonText = 906 appres.getResourceString( "HTMLViewerDialog.backButton.label", "Back" ); 907 String nextButtonText = 908 appres.getResourceString( "HTMLViewerDialog.nextButton.label", "Next" ); 909 910 String backButtonToolTipText = 911 appres.getResourceString( "HTMLViewerDialog.backButton.toolTipText", "go to previous" ); 912 String nextButtonToolTipText = 913 appres.getResourceString( "HTMLViewerDialog.nextButton.toolTipText", "go to next" ); 914 915 try { 916 File file = new File(licURLPath); 917 if ( file.exists() ) 918 licURLPath = "file:"+file.getAbsolutePath(); 919 HTMLViewerDialog dialog = 921 new HTMLViewerDialog( frame, title, licURLPath, approveButtonText ); 922 923 HTMLViewerPane viewer = dialog.getHTMLViewerPane(); 924 viewer.setBackButtonText(backButtonText); 925 viewer.setBackButtonToolTipText(backButtonToolTipText); 926 927 viewer.setNextButtonText(nextButtonText); 928 viewer.setNextButtonToolTipText(nextButtonToolTipText); 929 930 InstallUtilities.centerComponentOnScreen(dialog); 931 dialog.show(); 932 } 933 catch (IOException e) { 934 System.out.println(e); 935 } 936 } 937 938 public static void popupHelpDialog( Frame frame, String url ) 939 { 940 944 946 ApplicationResources appres = ApplicationResources.getInstance(); 947 String title = appres.getResourceString( "helpDialog.dialogTitle", "On-Line Help Dialog" ); 948 String urlPath = appres.resolvePathname( "appres/docs", url, null ); 949 950 String approveButtonText = 951 appres.getResourceString( "helpDialog.approveButton.label", "Close" ); 952 String backButtonText = 953 appres.getResourceString( "helpDialog.backButton.label", "Back" ); 954 String nextButtonText = 955 appres.getResourceString( "helpDialog.nextButton.label", "Next" ); 956 957 String backButtonToolTipText = 958 appres.getResourceString( "helpDialog.backButton.toolTipText", "go to previous" ); 959 String nextButtonToolTipText = 960 appres.getResourceString( "helpDialog.nextButton.toolTipText", "go to next" ); 961 962 try { 963 File file = new File(urlPath); 964 if ( file.exists() ) 965 urlPath = "file:"+file.getAbsolutePath(); 966 HTMLViewerDialog dialog = 968 new HTMLViewerDialog( frame, title, urlPath, approveButtonText ); 969 HTMLViewerPane viewer = dialog.getHTMLViewerPane(); 970 viewer.setBackButtonText(backButtonText); 971 viewer.setBackButtonToolTipText(backButtonToolTipText); 972 973 viewer.setNextButtonText(nextButtonText); 974 viewer.setNextButtonToolTipText(nextButtonToolTipText); 975 976 InstallUtilities.centerComponentOnScreen(dialog); 977 dialog.show(); 978 } 979 catch (IOException e) { 980 System.out.println(e); 981 } 982 } 983 984 public static void popupAuthorDialog( Frame frame, String url ) 985 { 986 991 ApplicationResources appres = ApplicationResources.getInstance(); 992 String title = appres.getResourceString( "authorDialog.dialogTitle", "View Author Dialog" ); 993 String urlPath = appres.resolvePathname( "appres/docs", url, null ); 994 995 String approveButtonText = 996 appres.getResourceString( "authorDialog.approveButton.label", "Close" ); 997 String backButtonText = 998 appres.getResourceString( "authorDialog.backButton.label", "Back" ); 999 String nextButtonText = 1000 appres.getResourceString( "authorDialog.nextButton.label", "Next" ); 1001 1002 String backButtonToolTipText = 1003 appres.getResourceString( "authorDialog.backButton.toolTipText", "go to previous" ); 1004 String nextButtonToolTipText = 1005 appres.getResourceString( "authorDialog.nextButton.toolTipText", "go to next" ); 1006 1007 try { 1008 File file = new File(urlPath); 1009 if ( file.exists() ) 1010 urlPath = "file:"+file.getAbsolutePath(); 1011 HTMLViewerDialog dialog = 1013 new HTMLViewerDialog( frame, title, urlPath, approveButtonText ); 1014 HTMLViewerPane viewer = dialog.getHTMLViewerPane(); 1015 viewer.setBackButtonText(backButtonText); 1016 viewer.setBackButtonToolTipText(backButtonToolTipText); 1017 1018 viewer.setNextButtonText(nextButtonText); 1019 viewer.setNextButtonToolTipText(nextButtonToolTipText); 1020 1021 dialog.setSize( new Dimension( 465, 575 ) ); 1022 InstallUtilities.centerComponentOnScreen(dialog); 1023 dialog.show(); 1024 } 1025 catch (IOException e) { 1026 System.out.println(e); 1027 } 1028 } 1029 1030 1034 public class DebuggablePrefix implements ActionListener 1035 { 1036 public void actionPerformed( ActionEvent evt ) 1037 { 1038 String osname = System.getProperty( "os.name"); 1039 Toolkit.getDefaultToolkit().beep(); 1040 if ( osname.startsWith("Windows 95") || 1041 osname.startsWith("Windows 98") || 1042 osname.startsWith("Windows 2000") || 1043 osname.startsWith("OS/2") || 1044 osname.startsWith("Windows NT") ) 1045 setPrefix( new File("C:\\Temp\\Testing") ); 1046 else 1047 setPrefix( new File("/tmp/testing") ); 1048 setLocale( Locale.getDefault() ); 1049 setInstallMode( BASIC_INSTALLATION ); 1050 } 1051 } 1052 1053} 1054 1055 | Popular Tags |