It is currently 02 Nov 2025, 03:24
   
Text Size

How can I show a message during game startup?

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins

How can I show a message during game startup?

Postby Max mtg » 19 Feb 2012, 20:24

I have a few lines of code in forge.deck.io.DeckReaderBase.readAll()
Code: Select all
            try {
                final T newDeck = read(file);
                if ( null == newDeck )
                {
                    String msg =  "A deck or similiar object at " + file.getPath() + " failed to load.\nPlease submit this as a bug with the mentioned file/directory attached.";
                    // JOptionPane.showMessageDialog(null, msg);
                } else 
                    result.put(newDeck.getName(), newDeck);
            } catch (final NoSuchElementException ex) {
I would love to trace the reason why some decks failed to load, so I want to ask player to submit the file that caused the error.
However, if a pop a JOptionPane.showMessageDialog, I get another exception.

Code: Select all
This is a Crash Report. An error has occurred. Please save this message to a file.
Please follow the instructions at this address to submit this Crash Report, plus what you were doing at the time:
   http://tinyurl.com/3zzrnyb
Reporting bugs in Forge is very important. We thank you for your time.

null


Version:
Forge version SVN

OS: Windows 7 Version: 6.1 Architecture: amd64

Java Version: 1.6.0_24 Vendor: Sun Microsystems Inc.

Detailed error trace:
java.lang.NullPointerException
   at forge.view.Main$1.run(Main.java:87)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$000(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.Dialog$1.run(Unknown Source)
   at java.awt.Dialog$3.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.awt.Dialog.show(Unknown Source)
   at javax.swing.JOptionPane.showOptionDialog(Unknown Source)
   at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
   at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
   at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
   at forge.deck.io.DeckReaderBase.readAll(DeckReaderBase.java:110)
   at forge.util.FolderMapView.<init>(FolderMapView.java:47)
   at forge.util.FolderMap.<init>(FolderMap.java:42)
   at forge.deck.CardCollections.<init>(CardCollections.java:28)
   at forge.AllZone.getDecks(AllZone.java:97)
   at forge.control.home.ControlConstructed.getCustomNames(ControlConstructed.java:325)
   at forge.control.home.ControlConstructed.updateDeckLists(ControlConstructed.java:162)
   at forge.control.home.ControlConstructed.<init>(ControlConstructed.java:96)
   at forge.view.home.ViewConstructed.<init>(ViewConstructed.java:67)
   at forge.view.ViewHomeUI.<init>(ViewHomeUI.java:77)
   at forge.view.FView.instantiateCachedUIStates(FView.java:164)
   at forge.view.FView$2.run(FView.java:103)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$000(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
Do you have any ideas on how I can show user a message?


(Way to reproduce the problem: create an empty dir in /res/decks/sealed or draft, uncomment the showMessage line)
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: How can I show a message during game startup?

Postby Max mtg » 20 Feb 2012, 18:11

This is also affecting other areas - user needs to confirm deck deletion if it has wrong cards there or deletion on orphaned sealed parts.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 9 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 9 guests

Login Form