Java Code Examples for javax.swing.event.AncestorEvent

The following examples show how to use javax.swing.event.AncestorEvent. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: leetcode-editor   Source File: UpdatePluginListener.java    License: 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 2
Source Project: netbeans   Source File: DiffResultsView.java    License: 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 3
Source Project: netbeans   Source File: DiffResultsView.java    License: 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 Project: weblaf   Source File: AncestorAdapter.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void ancestorAdded ( final AncestorEvent event )
{
    /**
     * Do nothing by default.
     */
}
 
Example 5
Source Project: Logisim   Source File: About.java    License: 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 6
Source Project: consulo   Source File: EventLogToolWindowFactory.java    License: 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 7
Source Project: weblaf   Source File: AncestorAdapter.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void ancestorMoved ( final AncestorEvent event )
{
    /**
     * Do nothing by default.
     */
}
 
Example 8
@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 9
Source Project: Spark   Source File: RequestFocusListener.java    License: 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 10
Source Project: netbeans   Source File: EditorRegistry.java    License: 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 11
Source Project: weblaf   Source File: WebFileBreadcrumb.java    License: 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 12
Source Project: weblaf   Source File: AbstractHoverBehavior.java    License: 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 13
Source Project: weblaf   Source File: AbstractHoverBehavior.java    License: 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 14
Source Project: netbeans   Source File: FileTreeView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
    if (!displayed) {
        displayed = true;
        setDefaultColumnSizes();
    }
}
 
Example 15
Source Project: visualvm   Source File: BarChart.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void ancestorMoved(AncestorEvent event) {
}
 
Example 16
Source Project: darklaf   Source File: AncestorAdapter.java    License: MIT License 4 votes vote down vote up
@Override
public void ancestorMoved(final AncestorEvent event) {}
 
Example 17
Source Project: netbeans   Source File: PropertiesTable.java    License: Apache License 2.0 4 votes vote down vote up
public void ancestorMoved(AncestorEvent arg0) {
}
 
Example 18
Source Project: java-swing-tips   Source File: MainPanel.java    License: MIT License 4 votes vote down vote up
@Override public void ancestorMoved(AncestorEvent e) {
  /* not needed */
}
 
Example 19
Source Project: darklaf   Source File: TabFrameContentPane.java    License: MIT License 4 votes vote down vote up
public TabFrameContentPane() {
    super(new BorderLayout());
    cont.setBackground(Color.YELLOW);

    PopupContainer leftBottomPanel = new PopupContainer();
    PopupContainer rightTopPanel = new PopupContainer();
    PopupContainer rightBottomPanel = new PopupContainer();
    PopupContainer topLeftPanel = new PopupContainer();
    PopupContainer topRightPanel = new PopupContainer();
    PopupContainer bottomLeftPanel = new PopupContainer();
    PopupContainer bottomRightPanel = new PopupContainer();
    PopupContainer leftTopPanel = new PopupContainer();

    rightSplitter = createSplitPane("rightSplitter");
    rightSplitter.setOrientation(JSplitPane.VERTICAL_SPLIT);
    rightSplitter.setTopComponent(rightTopPanel);
    rightSplitter.setBottomComponent(rightBottomPanel);

    leftSplitter = createSplitPane("leftSplitter");
    leftSplitter.setOrientation(JSplitPane.VERTICAL_SPLIT);
    leftSplitter.setTopComponent(leftTopPanel);
    leftSplitter.setBottomComponent(leftBottomPanel);

    topSplitter = createSplitPane("topSplitter");
    topSplitter.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    topSplitter.setLeftComponent(topLeftPanel);
    topSplitter.setRightComponent(topRightPanel);

    bottomSplitter = createSplitPane("bottomSplitter");
    bottomSplitter.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    bottomSplitter.setLeftComponent(bottomLeftPanel);
    bottomSplitter.setRightComponent(bottomRightPanel);

    topSplit = createSplitPane("topSplit");
    bottomSplit = createSplitPane("bottomSplit");
    topSplit.setOrientation(JSplitPane.VERTICAL_SPLIT);
    bottomSplit.setOrientation(JSplitPane.VERTICAL_SPLIT);

    topSplit.setTopComponent(topSplitter);
    topSplit.setBottomComponent(bottomSplit);
    bottomSplit.setBottomComponent(bottomSplitter);

    leftSplit = createSplitPane("leftSplit");
    rightSplit = createSplitPane("rightSplit");
    leftSplit.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    rightSplit.setOrientation(JSplitPane.HORIZONTAL_SPLIT);

    bottomSplit.setTopComponent(leftSplit);
    leftSplit.setLeftComponent(leftSplitter);
    leftSplit.setRightComponent(rightSplit);
    rightSplit.setRightComponent(rightSplitter);
    rightSplit.setLeftComponent(cont);

    topSplit.setResizeWeight(0.0d);
    leftSplit.setResizeWeight(0.0d);
    bottomSplit.setResizeWeight(1.0d);
    rightSplit.setResizeWeight(1.0d);
    setupSplitterPanes(JSplitPane::setResizeWeight, 0.5d);

    setupSplitPanes(JSplitPane::setEnabled, false);
    setupSplitPanes(ToggleSplitPane::setResizable, false);
    setupSplitterPanes(JSplitPane::setEnabled, false);
    setupSplitterPanes(ToggleSplitPane::setResizable, false);

    add(topSplit, BorderLayout.CENTER);

    addAncestorListener(new AncestorAdapter() {
        @Override
        public void ancestorAdded(final AncestorEvent event) {
            removeAncestorListener(this);
            SwingUtilities.invokeLater(() -> init());
        }
    });
}
 
Example 20
Source Project: java-swing-tips   Source File: MainPanel.java    License: MIT License 4 votes vote down vote up
@Override public void ancestorAdded(AncestorEvent e) {
  e.getComponent().requestFocusInWindow();
}
 
Example 21
Source Project: java-swing-tips   Source File: MainPanel.java    License: MIT License 4 votes vote down vote up
@Override public void ancestorAdded(AncestorEvent e) {
  e.getComponent().requestFocusInWindow();
}
 
Example 22
Source Project: pumpernickel   Source File: TextHighlightSheet.java    License: MIT License 4 votes vote down vote up
public void ancestorRemoved(AncestorEvent event) {
	makeHighlightsDirty();
}
 
Example 23
Source Project: netbeans   Source File: CheckBoxUpdater.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorMoved(AncestorEvent event) {
}
 
Example 24
Source Project: netbeans   Source File: ComboBoxUpdater.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
    setComboValue(getValue(), getDefaultValue(), component);
    component.addActionListener(this);
}
 
Example 25
Source Project: netbeans   Source File: ComboBoxUpdater.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorMoved(AncestorEvent event) {
}
 
Example 26
Source Project: Spark   Source File: RequestFocusListener.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorRemoved(AncestorEvent e) {}
 
Example 27
Source Project: netbeans   Source File: TextComponentUpdater.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorRemoved(AncestorEvent event) {
    component.getDocument().removeDocumentListener(this);
}
 
Example 28
Source Project: orbit-image-analysis   Source File: Loupe.java    License: GNU General Public License v3.0 4 votes vote down vote up
public void ancestorAdded(AncestorEvent event) {
}
 
Example 29
Source Project: netbeans   Source File: AddDependencyPanel.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
    loadArtifacts();
}
 
Example 30
Source Project: pumpernickel   Source File: AbstractSearchHighlight.java    License: MIT License 4 votes vote down vote up
public void ancestorAdded(AncestorEvent event) {
}