search my bushy blog


Saturday, May 26, 2012


Try to code uniformly and efficiently. Use fast image loading methods like BufferedImages as much as possible. For example, my gui framework uses only a single timer, for unlimited number of buttons per application. You will only find two timers in my rich applications; one for all buttons used, and another for all menu animations that take place.


In developing another gta iv tool, It engendered the creation of dual menu technology. I don't think this has been done. Dual menus mean that two menus are existing in one context, and react together based on interactions with each menu.

Also added spinning animation capability to gui framework Spinning a menu is as easy as:

perform_axis_animation ( menua, 1200, 824, 2.2f, 0.756f, 0.3f, "clockwise", "anti-clockwise", menub, 1200, 800, 2.4f, 0.756f, 0.3f, "anti-clockwise", "clockwise", 0.03f, 2.2f, 5.5f, rotation_animation_timer );

The spinning is based on the dual menu system. You need to pass two sister menus to function, along with some rotation specifics.

You can see it here:
Menu Animation Demonstration


Wednesday, May 23, 2012


After much research, and some experimentation, I have come up with a brain dead easy way to rotate
something at its center, with little lines. Plus it works!!!! I did not find one valid solution for this online!!! Off course, this solution is java oriented, this is a java blog after all. I will use AffineTransform to perform rotation. This assumes that one already has a paintComponent setup,
and graphics and graphics2d contexts have been properly initialized in such a paintComponent ( ) function.

//first import AffineTransform
import java.awt.geom.AffineTransform;

//then establish a variable to hold graphics2d's initial context
AffineTransform old_transform = null;

//then, you have a variable to control the rotation direction
int rot_dir = 1; //1 will imply clockwise rotation, -1 anti.

//you then need an angle to rotate with
double pie = 3.14;
double angle =  pie / 7;

//next you get the old transform (in your paintComponent)
old_transform = graphics2d.getTransform ( );

//now do the dang rotation!
graphics2d.transform ( AffineTransform.getRotateInstance (rot_dir*angle,objectX+objectWidth/2, objectY+objectHeight/2) );

//draw object you desire to rotate HERE

//now reset transform so other objects that follow wont be affected by rotation
graphics2d.setTransform ( old_transform );

//draw other objects HERE

all you need to do now is first set the rotation direction integer to either -1 or 1, then change the angle to your desire, and rotate about its origin.

the getRotateInstance ( ) above takes the angle of rotation, and anchor coordinates.
Now the tricky part was to determine what the anchor would be. I myself came up with this special anchor enlisted above. It gets the job done!!!!

Sunday, May 20, 2012

How to check if an integer is incrementing

I never thought this could be done, but I attempted to write a function that checked whether an integer was incrementing. This came about as I was writing a software tool for one of my projects.

Here goes:
        public boolean getIntegerIncrementEnquiry ( int integer, int max )
            boolean flag = false;
            int previous = integer;
            int next = integer + 1;
            if ( next < max )
                if ( next > previous )
                    flag = true;
                    flag = false;
            return flag;

It just takes an integer and a maximum.

Thursday, May 10, 2012


This download is a backup should incase something goes wrong. It is a backup of the shader folder which this software modifies.

Wednesday, May 9, 2012


Decided to share the folder duplication code from the latest addition to my gui kit.
Thanks to myKong for his code. The code also has timers that perform loading animations, but that was deleted for simplicity's sake.

            //function to duplicate files.

            //Thanks to mkYong :

            public void folderDuplicationFunction ( File source_directory, File destination_directory ) throws IOException


                //if the source entered is a valid file

                if ( source_directory.isDirectory ( ) )


                    //establish destination directory - create if non-existent!

                    if ( !destination_directory.exists ( ) )

                        destination_directory.mkdir ( );


                    //next, get the list of files in source directory

                    String [ ] source_files = source_directory.list ( );


                    //now generate that same list of source file name directories

                    //for the new file directory

                    for ( String source_file : source_files )


                        File source_dir_gen = new File ( source_directory, source_file );

                        File destination_dir_gen = new File ( destination_directory, source_file );

                        //recursively generate source names, so new destination names can be created per source

                        folderDuplicationFunction ( source_dir_gen, destination_dir_gen );



                //above I duplicated directories inclusive of file names, NOT the actual files.

                //this is what this else block is for.



                    InputStream source_is = new FileInputStream ( source_directory );

                    OutputStream destination_os = new FileOutputStream ( destination_directory );

                    byte [ ] buffer = new byte [ 1024 ];

                    int length = 0;

                    while ( ( length = ( buffer ) ) > 0 )


                        destination_os.write ( buffer, 0, length );


                    source_is.close ( );

                    destination_os.close ( );





            public void duplicateFolder ( String source_name, String destination_name )


                //establish directories

                File source_directory = new File ( source_name );

                File destination_directory = new File ( destination_name );




                    folderDuplicationFunction ( source_directory, destination_directory );


                catch ( Exception error )





Now, As it stands, It seems to be pain in the arse to properly distribute your java jar project.

Now, although I only used BlueJ, I attempted to use netbeans to create a running jar executable,
However this didn't work.

Follow these instructions:
1.CREATE YOUR JAR FILE via blueJ or netbeans. DO NOT USE COMMAND PROMPT. As your project gets more complexed, Using cmd's various java invocations may fail to produce an APPROPIATE MANIFEST file, which has information regarding the main class of your project.
In blueJ, you when you create jar file, you don't have to include source or project files. Just select the class with "public static void main" in it.

2.CREATE A BATCH FILE TO RUN THAT JAR FILE. I know it sounds retarded to create a batch file to run your jar file, but it seems it is better to let java handle your application launching.
     1.Open notepad or any other text editor.
     2.In text file, write this: java -jar myJarFile.jar
     3.Save as a .bat file in the same directory.

3.If you have folders or other resources you used to run your project, PLEASE ENSURE that the jar file
and bat file is in the directory of those folders/resources. You do not have to include any source files from that project directory.

4.Next use a batch converter to give users more familiar executable format. In other words users probably prefer o use and run an exe rather than a batch file.
SEND ME AN EMAIL IF THEY DELETED THE ABOVE LINK. I will personnaly send you the copy i have. - JordanMicahBennett @ gmail (dot) com.

5. You can actually test to see if the jar files are running before all the steps above.
You just need to navigate to your project directory, and tell windows where you have jdk or jre.
In you project directory, do this:
path c:\Program Files\Java\jdk1.7.0_01\bin; %path%
path c:\Program Files\Java\jre7\bin; %path%

Of course this applies to me, because that is where I have jdk7 and jre installed.
Use any one of those. THEY BOTH WORK!!!!!!!
 Next, invoke java to run your jar file. Again i state, if you use folders or images, make sure the jar file is in that same directory.
Now, do this:
java -jar myJarFile.jar
in that same project directory where your jar file is located.

You should see your jar file run nicely with all things included!!!!

Now you need to consider that not all users will have java runtime installed to their systems. You need to direct them to an appropriate link to attain this file. You can direct them here: