It is currently 16 Jul 2025, 04:22
   
Text Size

DeckImport - some new features

Post MTG Forge Related Programming Questions Here

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

DeckImport - some new features

Postby Max mtg » 30 Sep 2013, 07:04

I have added date filter to deck importer to allow players specify the year when that deck was playing. This will prevent any newer reprints from appearing among recognized cards and reduce the need for external tools.

I have also tried to skin that dialog, but reached only a partial success, since JDialog instances are not supported at FSkin class level. Managed to drop a panel on root level of the dialog and put all the skinnable components inside.

The import dialog can be further improved by adding a preview of recoginzed cards (I still don't know how to catch mouse events from inside JEditorPane)


I also got very surprised by the code in FComboBoxWrapper
Code: Select all
    private static ArrayList<FComboBoxWrapper<?>> allWrappers = new ArrayList<FComboBoxWrapper<?>>();

    public static void refreshAllSkins() {
        for (FComboBoxWrapper<?> wrapper : allWrappers) {
            wrapper.refreshSkin();
        }
    }
that is to say that once created a ComboBoxWrapper will be held in that list forever.
Guess that code can be improved if weak references are applied here.
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: DeckImport - some new features

Postby drdev » 30 Sep 2013, 12:25

Max mtg wrote:I also got very surprised by the code in FComboBoxWrapper
Code: Select all
    private static ArrayList<FComboBoxWrapper<?>> allWrappers = new ArrayList<FComboBoxWrapper<?>>();

    public static void refreshAllSkins() {
        for (FComboBoxWrapper<?> wrapper : allWrappers) {
            wrapper.refreshSkin();
        }
    }
that is to say that once created a ComboBoxWrapper will be held in that list forever.
Guess that code can be improved if weak references are applied here.
Sadly, I had a lot of trouble getting combo boxes to update their skin properly, and this was the only solution I found that worked. I'm definitely open to improving it if anyone knows how.

As for skinning JDialog, what were you trying to skin exactly? The ComponentSkin class and derived classes, along with their corresponding FSkin.get functions, can certainly be expanded if needed.
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: DeckImport - some new features

Postby Max mtg » 30 Sep 2013, 14:23

I was trying to skin the dialog represented by the DeckImport class. Just didn't know which method to call to make it look like the rest of application. The panel I added to the dialog is semitransparent (by skin definition) but the default form background is visible behind the panel - it looks ugly.
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: DeckImport - some new features

Postby drdev » 30 Sep 2013, 14:31

Max mtg wrote:I was trying to skin the dialog represented by the DeckImport class. Just didn't know which method to call to make it look like the rest of application. The panel I added to the dialog is semitransparent (by skin definition) but the default form background is visible behind the panel - it looks ugly.
That's doesn't sound like a problem with FSkin, but rather just a result of frames not supporting transparency easily. You'll need to research how to make a transparent dialog.
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: DeckImport - some new features

Postby spr » 30 Sep 2013, 15:18

Max mtg wrote:I was trying to skin the dialog represented by the DeckImport class. Just didn't know which method to call to make it look like the rest of application. The panel I added to the dialog is semitransparent (by skin definition) but the default form background is visible behind the panel - it looks ugly.
You could try using "setOpaque(true)" on the panel or use CLR_THEME2 instead of CLR_THEME. Utimately though, using UIManager calls should be used to make all dialogs consistent via the setForgeLookAndFeel() method in the FSkin.ForgeLookAndFeel class.

Cheers,
Steve
User avatar
spr
 
Posts: 213
Joined: 06 Jul 2013, 19:31
Has thanked: 28 times
Been thanked: 60 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 48 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 48 users online :: 0 registered, 0 hidden and 48 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 48 guests

Login Form