Home
Categories
Dictionary
Download
Project Details
Changes Log
Tutorials
FAQ
License

Message area type



The AbstractMDIApplication.preparePanels(int, int, boolean, boolean, MDIMenuFactory) method in the GUI application specifies the type of the message area.

Overview

The int parameter specifying the message area type is an OR of the following elements: For example, if you use the following parameter values:
  • The MessageAreaType.MESSAGEAREA_GLOBAL value will create one message area global to all tabs
  • The MessageAreaType.MESSAGEAREA_PER_TAB | MessageAreaType.MESSAGEAREA_EDITABLE_GLOBAL value will create one editable message area specific for each tab. Each message area will be editablle
  • The MessageAreaType.MESSAGEAREA_PER_TAB | MessageAreaType.MESSAGEAREA_SAVE_AS_TEXT | MessageAreaType.MESSAGEAREA_EDITABLE_PER_TAB value will create one message area global specific for each tab. The message area for a tab will be editable if the

Message area editability


By default the message area is not editable. It is possible to specify:
The MessageAreaType.MESSAGEAREA_EDITABLE_PER_TAB value will only be honored if there is one specific message area per each tab.

Examples

Global message area

The following example initializes the GUI with a global message area:
   public class TestMDIApplication extends AbstractMDIApplication {
      public TestMDIApplication() {
        super("TestMDIApplication");

        this.initConfiguration();

        mfactory = new SimpleMenuFactory();
        super.preparePanels(4, MessageAreaType.MESSAGEAREA_GLOBAL, true, true, mfactory);
        this.setSize(500, 500);
        this.getStatusBar().setMessage("Hello World!");
      }
   }

Per-tab message area

The following example initializes the GUI with a per-tab message area:
   public class TestMDIApplication extends AbstractMDIApplication {
      public TestMDIApplication() {
        super("TestMDIApplication");

        this.initConfiguration();

        mfactory = new SimpleMenuFactory();
        super.preparePanels(4, MessageAreaType.MESSAGEAREA_PER_TAB, true, true, mfactory);
        this.setSize(500, 500);
        this.getStatusBar().setMessage("Hello World!");
      }
   }

Editable global message area

The following example initializes the GUI with a global editable message area:
   public class TestMDIApplication extends AbstractMDIApplication {
      public TestMDIApplication() {
        super("TestMDIApplication");

        this.initConfiguration();

        mfactory = new SimpleMenuFactory();
        super.preparePanels(4, MessageAreaType.MESSAGEAREA_GLOBAL | MessageAreaType.MESSAGEAREA_EDITABLE_GLOBAL, true, true, mfactory);
        this.setSize(500, 500);
        this.getStatusBar().setMessage("Hello World!");
      
        this.getMessageArea().addHandler(new MessageAreaHandler() {
          @Override
          public void handleEditText(String theText) {
            System.out.println(theText);
          }
        });      
      }
   }

Editable per-tab message area

The following example initializes the GUI with a per-tab message area which is editable depending on the value of the FileProperties.isEditable() method:
   public class TestMDIApplication extends AbstractMDIApplication {
      public TestMDIApplication() {
        super("TestMDIApplication");

        this.initConfiguration();

        mfactory = new SimpleMenuFactory();
        super.preparePanels(4, MessageAreaType.MESSAGEAREA_PER_TAB | MessageAreaType.MESSAGEAREA_EDITABLE_PER_TAB, true, true, mfactory);
        this.setSize(500, 500);
        this.getStatusBar().setMessage("Hello World!");
      }
   }

See also


Categories: General | Gui | Swing

Copyright 2006-2023 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences