We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I am using the G4P library to implement a control panel for my app, but I would like to change the GButton functionality to draw buttons slightly differently.
I know nothing about Java but it looks like the source code creates a .jar file somehow.
Can anyone point me to a reference site or tutorial where I will be able to learn how to create a .jar file from the overall source code plus my amendments?
Thanks for your help.
Answers
In the next update of G4P GButton will have slightly rounded corners by default although you can still select the square-corners that are used currently.
SInce you 'know nothing about Java' then compiling the source code and creating the jar file is a serious challenge. I believe there is an easier way to do what you want without leaving the Processing IDE but I need to test it before I say more.
What are you trying to do? If it is something I think others might like then I will consider including it as an option in the next update.
I was hoping it wouldn't be too hard - oh, well.
Essentially, I'm using an image button, and by default they seem to be surrounded by a rectangle in one of the define colour scheme options. I want to be able to create a button without that rectangle so that all I see is the image on my button.
I guess the alternative is to be able to specify a colour for the rectangle itself so that I can override it to be whatever my background colour is.
As the author of that excellent library you're best placed to determine whether this is a worthwhile change and how best to implement it.
Use the GImageButton control,instead. You can specify up to 3 images for mouse-off, mouse-over and mouse-down .
(If you specify just 1 image it will be used for all three button states. If you specify 2 images the second one is used for both the mouse-over and mouse-down states).
If you use gif or png images (which support transparency) you can make parts of the button invisible. Try the G4P_ImageButtons example that comes with the library the ghost and coin buttons demonstrate what I mean.
The GButton is different in that it supports buttons that have text and/or an icon on its face. Even if the icon has transparent parts the button will always be coloured.
G4P uses colour schemes to give a consistent look and feel. It is possible to modify the colour schemes or even create new ones. This webpage describes two methods of changing the colour scheme. Method 1 has always been available to G4P but Method 2 which allows you to do it programmatically will be in the next release.
BTW I always recommend creating a new colour scheme rather than editing an existing one.
Just released a new version of G4P.
Looks like this will fix my problem, so I will have a play around. Thanks for updating this extremely useful tool!