Ignore:
Timestamp:
07/27/06 03:40:19 (18 years ago)
Author:
Nicholas Riley
Message:

About box.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hiptop/pester/net/sabi/pester/AlarmListWindow.java

    r246 r293  
    22
    33import danger.app.Application;
     4import danger.app.Event;
     5import danger.app.Resource;
     6import danger.text.span.SpanUtils;
     7import danger.text.span.SpannableString;
     8import danger.ui.DialogWindow;
     9import danger.ui.LinkTextBox;
    410import danger.ui.ScreenWindow;
    511import danger.ui.Menu;
    612import danger.ui.MenuItem;
     13import danger.ui.Scrollbar;
     14import danger.util.TextBuffer;
    715
    816public class AlarmListWindow extends ScreenWindow
     
    3644        actionMenu.getItemWithID(ID_DISCARD_ITEM).setEnabled(haveFocusedItem);
    3745    }
     46
     47    public boolean receiveEvent(Event e) {
     48        switch (e.type) {
     49        case EVENT_ABOUT:
     50            DialogWindow window = sPester.getDialog(ID_ABOUT_DIALOG, this);
     51            LinkTextBox textBox =
     52                (LinkTextBox)window.getDescendantWithID(ID_ABOUT_TEXT_BOX);
     53            Resource aboutText = sPester.getResource(257, ID_ABOUT_TEXT);
     54            int aboutSize = aboutText.getSize();
     55            byte b[] = new byte[aboutSize];
     56            aboutText.getBytes(b, 0, aboutSize);
     57            String supportEmail = sPester.getString(ID_SUPPORT_EMAIL);
     58            TextBuffer textBuffer =
     59                new TextBuffer(aboutSize + supportEmail.length());
     60            textBuffer.insert(new String(b));
     61            SpannableString urlString = new SpannableString(supportEmail);
     62            SpanUtils.addURL(urlString, 0, urlString.length(),
     63                             "mailto:" + supportEmail);
     64            textBuffer.insert(urlString);
     65            textBuffer.insert(".");
     66            textBox.setText(textBuffer);
     67            Scrollbar scrollbar =
     68                (Scrollbar)window.getDescendantWithID(ID_ABOUT_TEXT_SCROLLBAR);
     69            textBox.attachScrollbar(scrollbar);
     70            window.show();
     71            return true;
     72        }
     73        return super.receiveEvent(e);
     74    }
    3875}
Note: See TracChangeset for help on using the changeset viewer.