Java Code Examples for java.awt.dnd.DropTarget#setActive()

The following examples show how to use java.awt.dnd.DropTarget#setActive() . 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: PluginManagerUI.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void postInitComponents () {
    Containers.initNotify ();
    updateTable = createTabForModel(new UpdateTableModel(units));
    availableTable = createTabForModel(new AvailableTableModel (units));
    final LocalDownloadSupport localDownloadSupport = new LocalDownloadSupport();
    final LocallyDownloadedTableModel localTM = new LocallyDownloadedTableModel(localDownloadSupport);
    localTable = createTabForModel(localTM);
    installedTable = createTabForModel(new InstalledTableModel(units));

    DropTargetListener l = new LocallDownloadDnD(localDownloadSupport, localTM, this);
    final DropTarget dt = new DropTarget(null, l);
    dt.setActive(true);
    this.setDropTarget(dt);


    final SettingsTab tab = new SettingsTab(this);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            tpTabs.add(tab, INDEX_OF_SETTINGS_TAB);
            tpTabs.setTitleAt(INDEX_OF_SETTINGS_TAB, tab.getDisplayName());
        }
    });
    setWaitingState(true);
}
 
Example 2
Source File: DarkTabbedPaneUI.java    From darklaf with MIT License 5 votes vote down vote up
protected void installDragSupport() {
    tabPane.setTransferHandler(TRANSFER_HANDLER);
    try {
        DropTarget target = tabPane.getDropTarget();
        if (target != null) {
            target.addDropTargetListener(TRANSFER_HANDLER);
            target.setActive(dndEnabled);
        }
    } catch (TooManyListenersException e) {
        e.printStackTrace();
    }
}
 
Example 3
Source File: DarkTabFrameUI.java    From darklaf with MIT License 5 votes vote down vote up
protected void installDnD() {
    tabFrame.setTransferHandler(TRANSFER_HANDLER);
    try {
        DropTarget dropTarget = tabFrame.getDropTarget();
        if (dropTarget != null) {
            dropTarget.addDropTargetListener(TRANSFER_HANDLER);
            dropTarget.setActive(tabFrame.isDndEnabled());
        }
    } catch (TooManyListenersException e) {
        e.printStackTrace();
    }
}