Replacing the mini-map with a listbox

The RPTools applications are written in Java. If you're interested in contributing to any project here by submitting patches to the source code, this is the forum to ask questions about how to do so. Please put the two-letter tool name abbreviation in your thread Title. To enter this group, go to the Usergroups page of your User Control Panel and join the Java Developer group.

Moderators: dorpond, trevor, Azhrei

Post Reply
User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Replacing the mini-map with a listbox

Post by Azhrei »

(Continued from here.)

Nope, you want net.rptools.maptool.client.ui.zone.ZoneMiniMapPanel.

Since you'll be creating a dialog and show()'ing it, you won't need the paintComponent() method at all. That's where Trevor currently does some custom drawing to cause the list of maps to display. (I think there's a clipping rectangle bug in there somewhere, since any time I access the mini-map with a token selected and the token is partly off the edge of the map, the red selection border on the token is drawn on top of the border outside the map area. That's usually a bug in setting the clipping rectangle. Replacing the mini-map with a dialog will fix that bug, too. :))

What you'll want to do is replace the mini-map with something else. My suggestion would be to create a ZoneMiniMapDialog class that works similar to net.rptools.maptool.client.ui.StartServerDialog. Build the dialog form with Abeille and make it look pretty ( 8) ) then use the StartServerDialog as a template to create your new class. Note that StartServerDialog subclasses Abeille<StartServerDialogPreferences>, and that generic class subclasses JPanel. So the Abeille form can become the content of the main window in the dialog by using this (which is what the StartServerDialog constructor and showDialog() methods do).

Be sure to read the javadoc for Abeille<T> as it describes how to auto-link the fields on the Abeille form to class instance fields for the data model used by the form. This means that the programmer has a lot less work since fields don't need to be copied from/to the form; that's handled automatically. In this regard, the StartServerDialog isn't a good pattern to follow because of all the "get" functions it provides. What should really happen is that the calling code should call getModel() and use the return value to query the form fields...

User avatar
aku
Dragon
Posts: 856
Joined: Wed Nov 15, 2006 9:03 am
Contact:

Re: Replacing the mini-map with a listbox

Post by aku »

:?:

Gimme a few (days/months/years/lifetimes) to try and wrap my head around this, lol...

if someone beats me to it, feel free to.

Post Reply

Return to “Java Programming Info”