Ignore:
Timestamp:
2008-10-22T15:15:53+13:00 (16 years ago)
Author:
oranfry
Message:

HCI changes to the installer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release-kits/shared/ant-installer/src/org/tp23/antinstaller/renderer/swing/TargetInputRenderer.java

    r15311 r17569  
    2626import javax.swing.JLabel;
    2727import javax.swing.JCheckBox;
     28import javax.swing.ImageIcon;
     29import javax.swing.JButton;
     30import javax.swing.JOptionPane;
    2831
    2932import org.tp23.antinstaller.input.InputField;
     
    4144    protected JCheckBox targetCheckBox = new JCheckBox();
    4245
    43 
     46    JPanel parent = null;
    4447    public TargetInputRenderer() {
    4548    }
    4649    public void initComponent(JPanel parent){
     50        this.parent = parent;
     51
    4752        try {
    4853            jbInit();
     
    99104
    100105
    101         JLabel hlp = new JLabel("help");
    102         hlp.setToolTipText(outputField.getExplanatoryText());
     106        ImageIcon helpIcon = createImageIcon("/resources/help.png");
     107        JButton hlp = new JButton(org.tp23.antinstaller.Installer.langPack.getString("info"), helpIcon);
     108
     109        hlp.addActionListener(
     110            new ActionListener() {
     111                public void actionPerformed(ActionEvent e) {
     112                    JOptionPane.showMessageDialog(parent, outputField.getExplanatoryText(), outputField.getDisplayText(), JOptionPane.QUESTION_MESSAGE);
     113                }
     114            }
     115        );
     116
     117        //hlp.setToolTipText();
     118
     119        JPanel spacer = new JPanel();
     120        spacer.setPreferredSize(new Dimension(50, 1));
    103121
    104122        JPanel p;
     
    108126        p.add( sizeLabel );
    109127        p.add( targetCheckBox );
     128        p.add( spacer );
    110129        p.add( hlp );
    111130        content.add(p);
     
    121140    public void renderError() {
    122141    }
     142
     143    /** Returns an ImageIcon, or null if the path was invalid. */
     144    protected static ImageIcon createImageIcon(String path) {
     145        java.net.URL imgURL = org.tp23.antinstaller.Installer.class.getResource(path);
     146        if (imgURL != null) {
     147            return new ImageIcon(imgURL);
     148        } else {
     149            //System.err.println("Couldn't find file: " + path);
     150            return null;
     151        }
     152    }
     153
    123154}
Note: See TracChangeset for help on using the changeset viewer.