rubyWhat if programming languages were real persons like you and me? What if they were parts of families and had relations and affairs? Have you ever thought of going to a supermarket and Visual Basic was the young woman waiting in the line in front of you?

Ruby is a good friend of Groovy. She is 20 years old and she is one of the upcoming names in Devel City mainly because of her professional maturity and the way she manages to do a job cleanly and fast. Although Scala, Groovy’s sister, got a big job from Ruby’s hands (case of Twittorix), Ruby is still considered as one of the best professionals out there.

Ruby, became one of the most successful women in City of Devel, after the creation of her Rails company and got a lot of fame. She also inspired many other famous women in Devel City to start their own Rails-like companies with PHP being one of them with Symfoniac LTD.

She is a very calm person and not fond of surprises. When she works, she wants to have everything there as helpful as it can be for her and her co-workers. Most of the time she applies the POLS principle to her job.
Some Devel City residents state that, if Perl goes away one day, Ruby will do the job as good as she does and with more freedom than with Perl.

Ruby believes in one principle: “Divide and Conquer”, this is why she has divided all of her company groups into Gems. Ruby just needs to use a gem to do a particular job.

hostcommandoThere are literally hundreds of hosting sites in the internet today. But people look for cheap and affordable ones yet offer powerful tools that gets a site up and running with just a few clicks. Host Commando provides reliable blog hosting at competitive rates with as little downtime as possible.

WordPress is one of the most powerful content management software that is currently used by many bloggers. At Host Commando, their blog wordpress hosting service delivers cost-effective web site management coupled with highly reliable servers.

That is not all. A variety of WordPress themes are available for you to beautify your site plus step by step video tutorials are on hand to help you maximize your blog site with plugins and tools. Search engine optimization is already included with the package. What you have then is a complete blog hosting package from a hosting provider that will virtually guarantee your blogging success!

Suppose you have a toolbar (of JPanel type) with so many icons embedded in it and when you resize your JFrame to a smaller size, not all the icons in your toolbar get displayed. What should you do? The solution I did was to add a left and right button as shown in the above toolbar image so that when you click either the left or right button, it will scroll sideways to display the next and/or previous icon of the toolbar (whichever button is pressed).

The toolbar container is placed within a scrollable pane while the scrollable pane is placed insider another JPanel class I created called ToolbarScroolablePanel wherein the left and right buttons are also added. I used a BorderLayout to place the toolbar in the center while the 2 buttons would be on the east and west position respectively.

If you look at the code closely, you may notice I used an Observer class called MyObserver. This is a pretty handy class for calling code found in other classes so you are spared the tedious task of calling deep level getParent() methods just to gain access to the container class. Now, this code only contains the panel class for the scrollable toolbar. When you use this class, just create an observer object in a static class and place it in the ToolbarScrollablePanel constructor which the syntax in the code means.

And in your JFrame class, you create a variable and instantiate the observer class like this:

Then from within the JFrame class, you add a ComponentListener and override the componentResized() method so that whenever the JFrame window gets resized, it will check if the toolbar’s visible area can or cannot display all toolbar icons to the screen which will be the basis to display the left and right buttons to scroll your toolbar icons.

Here are the source codes for both the ToolbarScrollablePanel and MyObserver class

Related Posts Plugin for WordPress, Blogger...