The Swing framework in Java is built on top of the AWT framework and can be used to create GUI applications just like AWT. JFC is an API that is similar to MFCs (Microsoft Foundation Classes) in C++. The Swing framework in Java is a part of Java Foundation Classes or commonly called JFCs. In this tutorial, we will discuss yet another GUI framework in Java i.e. Another disadvantage of AWT is its heavyweight components. AWT is one of the oldest GUI frameworks in Java and is also platform dependent. We have seen one in our previous tutorial i.e. The code snippet below creates a FlowLayout object and the components it manages.įlowLayoutDemoExample.Java provides many GUI frameworks that help us in developing a variety of GUI applications. Another constructor of the FlowLayout class specifies how much vertical or horizontal padding is put around the components. To specify that the row is to aligned either to the left or right, use a FlowLayout constructor that takes an alignment argument. If the container is wider than necessary for a row of components, the row is, by default, centered horizontally within the container. If the horizontal space in the container is too small to put all the components in one row, the FlowLayout class uses multiple rows. The FlowLayout class puts components in a row, sized at their preferred size. The FlowLayout class provides a very simple layout manager that is used, by default, by the JPanel objects. To learn how to install WindowBuilder tool please visit the Setup section 2.1 of the following link click here. We also need WindowBuilder tool to be installed on Eclipse IDE for the easiness of the work. This example is developed on Eclipse therefore a compatible Eclipse IDE is required to be installed on the system. Eclipse: is also a java IDE developed by the eclipse open source community and can be downloaded from.NetBeans: is a Java IDE that is open source and free which can be downloaded from.Notepad: On Windows machine you can use any simple text editor like Notepad TextPad.But for now, you can consider one of the following: There are even more sophisticated IDE available in the market. To write your java programs you will need a text editor. Pluggable look-and-feel– SWING based GUI Application look and feel can be changed at run time based on available values.Highly Customizable – Swing controls can be customized in very easy way as visual apperance is independent of internal representation.Rich controls – Swing provides a rich set of advanced controls like Tree, TabbedPane, slider, colorpicker, table controls.Light Weight – Swing component are independent of native Operating System’s API as Swing API controls are rendered mostly using pure JAVA code instead of underlying operating system calls.Behavior: These are events which occur when the user interacts with UI elements.Layouts: They define how UI elements should be organized on the screen and provide a final look and feel to the GUI (Graphical User Interface).GWT provides a huge list of widely used and common elements varying from basic to complex. UI elements : These are the core visual elements the user eventually sees and interacts with.Using this way, Swing has pluggable look-and-feel architecture.Įvery user interface considers the following three main aspects: Swing component have Model as a seperate element and View and Controller part are clubbed in User Interface elements.Controller takes the input from the user on the view and reflects the changes in Component’s data. ![]() View represents visual representation of the component’s data.Swing API architecture follows loosely based MVC architecture in the following manner. The javax.swing package provides classes for java swing API such as JButton, JTextField, JTextArea, JRadioButton, JCheckbox, JMenu, JColorChooser etc. Unlike AWT, Java Swing provides platform-independent and lightweight components. API is to use the Java Bean model so that Builder Tools and IDE can provide better services to the developers to use it.API is to model driven so that highest level API is not required to have the data.A single API is to be sufficient to support multiple look and feel.Swing component follows a Model-View-Controller architecture to fulfill the following criteria. It is build upon top of AWT API and acts as replacement of AWT API as it has almost every control corresponding to AWT controls. Swing API is set of extensible GUI Components to ease developer’s life to create JAVA based Front End/ GUI Applications. ![]() JAVA provides a rich set of libraries to create Graphical User Interface in platform independent way. ![]() Swing was developed to provide a more sophisticated set of GUI components than the earlier Abstract Window Toolkit (AWT). It is part of Oracle’s Java Foundation Classes (JFC) – an API for providing a graphical user interface (GUI) for Java programs.
0 Comments
Leave a Reply. |