Archive for the 'components' Category



Setting the Default Button in Swing

Thursday 3 July 2008 @ 7:13 pm

Consider you have a form with several text fields and some buttons. One of the buttons is usually the “default” button , which would get executed if the user pressed enter, while the focus is in any of the text fields in that form. You should have definitely seen this type of buttons. As an example in google.com, you can type you query in the textfield and press enter, which is same as clicking the “Google Search” button.
  While most people who implement this, add a keylistener to each textfield and execute the doClick() method in JButton when the Enter key is pressed, there is an easier way. Also by implementing this by setting up the listener, you will not be able to tell swing to let it do OS level special effects like the “pulsing” effect in a MAC or a border-effect on windows.
Continue Reading »
Setting the Default Button in Swing




Creating a Custom Border

Tuesday 20 May 2008 @ 2:52 pm

In the last article, I showed the use of borders and how you can use the BorderFactory class to create one of the predefined Borders. Now, what if none of the Java-supplied Borders meet your needs?
Continue Reading »
Creating a Custom Border




Borders Line,Etched, Matte and Beveled

Monday 19 May 2008 @ 12:40 am

  Borders in Swing are very useful not only for adding simple border lines to a component but also to add titles, create bevel effects and adding spaces around components. Almost all Java Components [with the exception of Labels and Panels] create there own borders in most Look and Feels.
   In this post, let’s check some of the predefined borders provided by Swing and how to create and use them.
Continue Reading »
Borders Line,Etched, Matte and Beveled








Popular Articles

Blog Categories

Monthly Archives

Resources