Skip to main content

Posts

JavaFX: arranging components on GridPane

JavaFX provides different layout panes for arranging components on them. for example GridPane, BorderPane etc. This article describes about arranging components on GridPane. GridPane layout manager allows arranging components/controls using overloaded method. ie add.                         1. add(controlinstance, colindex, rowindex)                       EX:  GridPane pane = new GridPane();                                pane.add(new Separator(), 0, 0); the above example code puts the separator on 0th row and 0th column of a gridPane.                       2. add(Node controlinstance,int colIndex,int rowIndex,int colSpan,int rowSpan)                          ...

Send SMSs with Java

Through this article I want to share some knowledge that I have on sending bulk SMSs through java and .NET applications. SMSLIB is an open source API which allows the programmers to write java or .NET code to send multiple smss to different phone numbers. It requires Mobile phone or GSM MODEM along with any SIM. Please go through this link to get the SMSLIB API.                                                    http://smslib.org/download/  

JForm: Fill the form with style

After understanding and using swing toolkit, I understood that there is a allot of scope to develop Custom components easily. I have developed a component called JForm which basically a button and its selection pops up a window if it is not visible. Technically the JForm component is a combination of 2 components they are: 1. JButton 2. Window JButton is a API of swing toolkit where as Window is a API of AWT. Behaviour of JForm: JForm is a usual button like JButton. but it is glued to a Window component. this Window takes a JPanel class as an arguments. In the given example has 2 components they are 1. JTextArea  2. JButton [Submit] which are appended to a JPanel.. The below image shows the effect before selecting the JForm: This image shown is the effect after selecting the JForm:                                       the below code is an example which i...

JColorComboBox: JComboBox as Color Chooser

  Swing toolkit provides a component called JColorChooser to choose colors. It allows users to select color from multiple color combinations. Some times our application may need simple component with an option to select only basic colors/ less number of color options unlike sepearate dialog with too may color options[JColorChooser]. This JColorComboBox may serve the need. I wanted my color chooser to behave like JComboBox. The popup shows all 12 colors and their names, among all of them one color can be choosen. see the below image. I created two classes          1. JColorComboBox          2. ColorRenderer JColorComboBox extends the JComboBox and ColorRenderer extends JLabel and implements ListCellRenderer. import java.awt.Color; import java.awt.Component; import java.awt.Font; import java.util.Enumeration; import java.util.Hashtable; import javax.swing.*; /** * * @author sharath */ public class JCol...

Romain guy's blog

If you are interested in designing GUIs and building custom components with Swing toolkit, definitely Romain guy's blog  can be good reference for you, he writes about his work on swing components, custom components, tips and tricks on designing and using components. and you can download the demos of his work. You find more swing articles in 2005, 2006 archives. His URL: http://www.curious-creature.org/

DesignGridLayout: Simple, yet powerful Layoutmanager for arranging swing components

Swing toolkit comes with few standard Layout Managers where none of them serves the need of arranging components in a way that usually developers require. some of them does, but it takes lot of coding time to achieve it. GridBagLayout is the most flexible layout manager available in swing toolkit but their are so many variables that developer has to look after. DesignGridLayout can be a useful LayoutManager to arrange components in less time with very small snippet of code and can still get proper alignment. Layouting with DesignGridLayout is as easy as coding with various GUI Builder tools available in varoius IDEs. Simple program which demonstrates DesignGridLayout: import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import net.java.dev.designgr...

Java IDE for Learners:

           Simple editors like Notepad, Gedit, edit+  definitely allows us to write a program, but it is always difficult to code, debug and manage even smaller applications. and profession IDEs like Eclipse, Netbeans JDeveloper are definitely not suitable for beginners.[They are pretty advanced to students]            What if we have an IDE which allows the learners to understand the basic coding principles of java, Fundamentals of Object Oriented Programming[OOP] with the pictorial representation along with syntax highlighting, scope highlighting and other cool features?.. sounds good right.                                           BlueJ is a simple Java based IDE developed by Kent university for the beginners and students of Java programming language. The coolest thing about BlueJ is it not only allows ...