javax.swing.event.AncestorEvent Java Examples

The following examples show how to use javax.swing.event.AncestorEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DiffResultsView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
    ExplorerManager em = ExplorerManager.find(treeView);
    em.addPropertyChangeListener(this);
    if (dividerSet) {
        if (lastDividerLoc != 0) {
            EventQueue.invokeLater(new Runnable() {
                @Override
                public void run () {
                    diffView.setDividerLocation(lastDividerLoc);
                }
            });
        }
    } else {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                dividerSet = true;
                diffView.setDividerLocation(0.33);
            }
        });
    }
}
 
Example #2
Source File: UpdatePluginListener.java    From leetcode-editor with Apache License 2.0 6 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
    Config config = PersistentConfig.getInstance().getInitConfig();
    if (config == null) {
        return;
    } else {
        //如果存在历史版本,并且为2版本之前,则复制历史数据到新缓存目录下,并且更新版本号
        if (Constant.PLUGIN_CONFIG_VERSION_1.equals(config.getVersion()) || config.getVersion() == null) {
            File oldFile = new File(config.getFilePath() + File.separator + PersistentConfig.OLDPATH + File.separator);
            if (oldFile.getParentFile().exists()) {
                File newFile = new File(config.getFilePath() + File.separator + PersistentConfig.PATH + File.separator);
                if (!newFile.getParentFile().exists()) {
                    newFile.getParentFile().mkdirs();
                }
                try {
                    FileUtils.copyDirectory(oldFile, newFile);
                } catch (IOException e) {

                }
            }
            config.setVersion(Constant.PLUGIN_CONFIG_VERSION_2);
            PersistentConfig.getInstance().setInitConfig(config);
        }
    }

}
 
Example #3
Source File: DiffResultsView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
    ExplorerManager em = ExplorerManager.find(treeView);
    em.addPropertyChangeListener(this);
    if (dividerSet) {
        if (lastDividerLoc != 0) {
            EventQueue.invokeLater(new Runnable() {
                @Override
                public void run () {
                    diffView.setDividerLocation(lastDividerLoc);
                }
            });
        }
    } else {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                dividerSet = true;
                diffView.setDividerLocation(0.33);
            }
        });
    }
}
 
Example #4
Source File: RequestFocusListener.java    From Spark with Apache License 2.0 5 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent e) {
    JComponent component = e.getComponent();
    component.requestFocusInWindow();

    if (removeListener)
        component.removeAncestorListener( this );
}
 
Example #5
Source File: FileTreeView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
    if (!displayed) {
        displayed = true;
        setDefaultColumnSizes();
    }
}
 
Example #6
Source File: AncestorAdapter.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void ancestorMoved ( final AncestorEvent event )
{
    /**
     * Do nothing by default.
     */
}
 
Example #7
Source File: AbstractHoverBehavior.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void ancestorMoved ( @NotNull final AncestorEvent event )
{
    /**
     * Updating hover properly upon component ancestor updates.
     */
    updateHover ();
}
 
Example #8
Source File: EventLogToolWindowFactory.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
  ToolWindow log = EventLog.getEventLog(myProject);
  if (log != null && log.isVisible()) {
    EventLog.getLogModel(myProject).logShown();
  }
}
 
Example #9
Source File: AbstractHoverBehavior.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void ancestorRemoved ( @NotNull final AncestorEvent event )
{
    /**
     * No extra updates required on this event.
     */
}
 
Example #10
Source File: About.java    From Logisim with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent arg0) {
	if (thread == null) {
		thread = new PanelThread(this);
		thread.start();
	}
}
 
Example #11
Source File: ConsoleLogToolWindowFactory.java    From aem-ide-tooling-4-intellij with Apache License 2.0 5 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
    ToolWindow log = ConsoleLog.getLogWindow(myProject);
    if (log != null && log.isVisible()) {
        ConsoleLogModel model = ConsoleLog.getLogModel(myProject);
        if(model != null) {
            model.logShown();
        }
    }
}
 
Example #12
Source File: WebFileBreadcrumb.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
private void installTip ( final File file, final JComponent component, final boolean showFullName )
{
    final WebPanel panel = new WebPanel ( new VerticalFlowLayout ( 4, 4 ) );
    panel.setOpaque ( false );

    if ( showFullName )
    {
        // Full file name
        panel.add ( new WebLabel ( FileUtils.getDisplayFileName ( file ), FileUtils.getFileIcon ( file ) ) );
        panel.add ( new WebSeparator ( WebSeparator.HORIZONTAL ) );
    }

    // File description
    panel.add ( new WebLabel ( FileUtils.getFileTypeDescription ( file ), typeIcon ) );

    if ( FileUtils.isFile ( file ) )
    {
        // File modification date
        panel.add ( new WebLabel ( FileUtils.getDisplayFileModificationDate ( file ), dateIcon ) );

        // File size
        panel.add ( new WebLabel ( FileUtils.getDisplayFileSize ( file ), sizeIcon ) );
    }

    // Registering tooltip
    TooltipManager.setTooltip ( component, panel );

    // Removing tooltip when component is removed
    component.addAncestorListener ( new AncestorAdapter ()
    {
        @Override
        public void ancestorRemoved ( final AncestorEvent event )
        {
            TooltipManager.removeTooltips ( component );
        }
    } );
}
 
Example #13
Source File: AncestorAdapter.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void ancestorAdded ( final AncestorEvent event )
{
    /**
     * Do nothing by default.
     */
}
 
Example #14
Source File: EditorRegistry.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
    Item item = item(event.getComponent());
    if (item.runningTimer != null) {
        item.runningTimer.stop();
        item.runningTimer = null;
    }
    itemMadeDisplayable(item);
}
 
Example #15
Source File: SyncTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorRemoved(AncestorEvent event) {
}
 
Example #16
Source File: MarqueePanel.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
 *  Get notified when the panel is added to a Window so we can use a
 *  WindowListener to automatically start the scrolling of the components.
 */
public void ancestorAdded(AncestorEvent e)
{
	SwingUtilities.windowForComponent( this ).addWindowListener( this );
}
 
Example #17
Source File: RenderGrid.java    From orbit-image-analysis with GNU General Public License v3.0 4 votes vote down vote up
public void ancestorMoved(AncestorEvent arg0) {
    //  componentResized(null);
}
 
Example #18
Source File: CommitTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorMoved(AncestorEvent event) {
}
 
Example #19
Source File: ParentChangeBehavior.java    From weblaf with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void ancestorAdded ( @NotNull final AncestorEvent event )
{
    ancestorChanged ( event );
}
 
Example #20
Source File: AncestorListenerAdapter.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorRemoved(AncestorEvent event) {
}
 
Example #21
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
@Override public void ancestorMoved(AncestorEvent e) {
  /* not needed */
}
 
Example #22
Source File: PropertiesTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void ancestorAdded(AncestorEvent arg0) {
    setDefaultColumnSize();
}
 
Example #23
Source File: SyncTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorMoved(AncestorEvent event) {
}
 
Example #24
Source File: Loupe.java    From orbit-image-analysis with GNU General Public License v3.0 4 votes vote down vote up
public void ancestorMoved(AncestorEvent event) {
    componentResized(null);
}
 
Example #25
Source File: IssueTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorMoved(AncestorEvent event) { }
 
Example #26
Source File: IssueTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
    setDefaultColumnSizes();
}
 
Example #27
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
@Override public void ancestorRemoved(AncestorEvent e) {
  /* not needed */
}
 
Example #28
Source File: DiffResultsView.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorMoved(AncestorEvent event) {
}
 
Example #29
Source File: EditorRegistry.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorMoved(AncestorEvent event) {
}
 
Example #30
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
@Override public void ancestorRemoved(AncestorEvent e) {
  /* not needed */
}