View RSS Feed

Java Swing

Java Swing tutorials.

  1. How to use JTree in Java

    by , 02-29-2012 at 06:14 AM
    JTree is a Swing component that displays hierarchical data in a tree structure. The screen-shot below depicts a tree component:

    Name:  sample tree.png
Views: 6727
Size:  12.3 KB
    Figure: A tree component in Java

    This article will focus on how to implement such a tree component in Java, by walking through basic concepts to develop an interesting sample application.

    Fundamental concepts about Tree component

    • Node: A tree displays data vertically in rows,
    Tags: java, jtree, swing Add / Edit Tags
  2. Swing delegation event model

    by , 01-08-2012 at 12:38 PM
    Registered event listeners are notified for the event received by objects in swing delegation event model. Event receiver is a component in most cases.

    Event Types: ActionEvent, KeyEvent, MouseEvent, WindowEvent etc.
    Event Processors: JButton, JList etc.
    EventListeners: ActionListener, ComponentListener, KeyListener etc.

    Name:  62.JPG
Views: 2557
Size:  15.8 KB

    Swing delegation event model
  3. Swing Action architecture

    by , 01-08-2012 at 12:28 PM
    Shared behavior between different user interfaces components are implemented by “Swing Action Architecture”. Like tool bar buttons and menu items perform same actions. All the components are disabled when an action is disabled.

    Java Code: Swing Action Architecture
    class FileAction extends AbstractAction {
    FileAction(String name) {
    public void actionPerformed(ActionEvent ae){
    //add action logic here
    JMenu fileMenu

    Updated 01-14-2012 at 06:56 PM by Java Swing

    Architecture , Actions
  4. AWT vs. Swing

    by , 01-08-2012 at 12:23 PM
    Swing contains a rich set of components as compared to AWT. They are purely build in Java and has following benefits as compared to AWT.

    • Swing contains extra components like JTree, JTable etc.
    • They can change skin based on current look and feel.
    • They follow the MVC design pattern and are more flexible.
    • Swing provided light weight components.
    • Swing provides double buffering.
    • Swing provides paint debugging.

    Swing has following ...
    Tags: awt, swing Add / Edit Tags
  5. How to use model for your table in Swing application

    by , 12-09-2011 at 09:06 AM
    Swing provides a very flexible widget, it is the JTable. Using the JTable component, you can display tabular data in form of columns and rows, plus allowing the user to edit and save the data if needed.

    Why need to use a model

    The Java Swing architecture separates the view and the model of a UI component. The view is how the component is drawn on the screen and gets changed if the user interacts with the component. The model is how data is structured and organized. The ...

    Updated 12-09-2011 at 03:35 PM by Java Swing

    JTable , Model