[messages] Edit: Re: [Module Support] Drawing Java Components On Game Pieces

Joe12 j.sheppard88 at gmail.com
Wed May 7 16:08:26 CEST 2014


[This message has been edited.]

Hi,

I'm making a new Vassal game which is based on a free board game I enjoy
playing which is like the Civilisation PC games.

I don't yet want to announce what game I'm working on but when I do I
will create a forum topic for it and I will open source its development.

I want this game's unit pieces to use a AttributesOverlay trait which
will draw attribute labels and icons onto pieces from a JPanel, so that
the attribute icons can be properly aligned with their labels in this
panel before they are drawn on to the game pieces.

I want to create a new trait for displaying unit attributes so that: a)
I can easily align the attribute labels with their icons in a JPanel b)
and because I would prefer to have the attributes be set in my game's
"Unit" enumeration class instead of being defined by property traits in
the Vassal Module editor.

Having not been able to draw this trait's JPanel on pieces, I've been
trying to simply draw a JLabel on them but nothing is being drawn:
[code]
@Override
public void draw(Graphics g, int x, int y, Component obs, double zoom) 
{
         piece.draw(g, x, y, obs, zoom);
         JLabel test = new JLabel("test");
         test.setLocation(x, y);
         test.paint(g);
}
[/code]

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=44851#p44851


More information about the messages mailing list