Package java.awt.event

Examples of java.awt.event.HierarchyListener


        splitter.setContinuousLayout(true);

        //This little bit of tedium is so we can set our size based on window's size. This listens
        //for when the window is actually shown. It then adds a listen to store the location.
        splitter.addHierarchyListener(new HierarchyListener() {
            public void hierarchyChanged(HierarchyEvent e) {
                if (HierarchyEvent.SHOWING_CHANGED == (e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED)) {
                    splitter.removeHierarchyListener(this); //we only want the first one of these, so remove ourselves as a listener.
                    Window window = SwingUtilities.getWindowAncestor(splitter);
                    if (window != null) {
View Full Code Here


   */
  public static void addWindowListener(final Component source, final WindowListener listener) {
    if (source instanceof Window) {
      ((Window)source).addWindowListener(listener);
    } else {
      source.addHierarchyListener(new HierarchyListener() {
        @Override public void hierarchyChanged(HierarchyEvent e) {
          if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) == HierarchyEvent.SHOWING_CHANGED) {
            SwingUtilities.getWindowAncestor(source).addWindowListener(listener);
          }
        }
View Full Code Here

    _path.getDocument().addDocumentListener(new MyDocumentAdapter());
    if (!_path.getText().isEmpty()) {
      _selectedFile = new File(_path.getText());
    }
    _path.addHierarchyListener(new HierarchyListener() {
      public void hierarchyChanged(final HierarchyEvent e) {
        if (_path.isVisible()) {
          _dialogBuilder.setOkActionEnabled(validateDirectory(_path.getDocument()));
        }
      }
View Full Code Here

      getDetectorTextPanel().setPreferredSize(preferredSize);
      scrollPane.setBorder(null);
      //mainPanel.add(getDetectorTextPanel(), "1, 9, 1, 9");

      final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, detectorPanel, getDetectorTextPanel());
      splitPane.addHierarchyListener(new HierarchyListener() {
        public void hierarchyChanged(final HierarchyEvent e) {
          if (e.getChangeFlags() == HierarchyEvent.SHOWING_CHANGED) {
            if (splitPane.isShowing()) {
              splitPane.setDividerLocation(0.75);
            }
View Full Code Here

    _importFile.getDocument().addDocumentListener(new MyDocumentAdapter());
    if (!_importFile.getText().isEmpty()) {
      _selectedFile = new File(_importFile.getText());
    }
    _importFile.addHierarchyListener(new HierarchyListener() {
      public void hierarchyChanged(final HierarchyEvent e) {
        if (_importFile.isVisible()) {
          _dialogBuilder.setOkActionEnabled(validateFile(_importFile.getDocument()));
        }
      }
View Full Code Here

                });
            }
            else {
                // Hierarchy events are fired in direct response to
                // displayability changes
                w.addHierarchyListener(new HierarchyListener() {
                    public void hierarchyChanged(HierarchyEvent e) {
                        if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0
                            && e.getComponent().isDisplayable()) {
                            e.getComponent().removeHierarchyListener(this);
                            action.run();
View Full Code Here

  public RootMenuPiece( JMenu menu ){
    if( menu == null )
      throw new NullPointerException( "menu must not be null" );
    this.menu = menu;

        menu.addHierarchyListener( new HierarchyListener(){
      public void hierarchyChanged( HierarchyEvent e ){
        if( (e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 ){
          EventQueue.invokeLater( new Runnable(){
            public void run(){
              checkVisibility()
View Full Code Here

            public void actionPerformed(final ActionEvent e) {
                approveButton.getAction().actionPerformed(e);
            }
        });

        fc.addHierarchyListener(new HierarchyListener() {
            public void hierarchyChanged(final HierarchyEvent e) {
                if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0
                    && fc.isShowing()) {
                    fileNameField.requestFocus();
                    fileNameField.selectAll();
View Full Code Here

    }

    protected ComponentView(ViewContext viewContext) {
        this.viewContext = viewContext;
        this.component = initComponent();
        this.component.addHierarchyListener(new HierarchyListener() {
            public void hierarchyChanged(HierarchyEvent e) {
                if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
                    if (!first) {
                        onFirstVisible();
                        first = true;
View Full Code Here

    }

    protected ComponentView(ViewContext viewContext) {
        this.viewContext = viewContext;
        this.component = initComponent();
        this.component.addHierarchyListener(new HierarchyListener() {
            public void hierarchyChanged(HierarchyEvent e) {
                if (e.getChangeFlags() == HierarchyEvent.SHOWING_CHANGED) {
                    if (!first) {
                        onVisible();
                        first = true;
View Full Code Here

TOP

Related Classes of java.awt.event.HierarchyListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.