Search in sources :

Example 1 with DockingDesktop

use of com.vlsolutions.swing.docking.DockingDesktop in project omegat by omegat-org.

the class EditorController method createUI.

private void createUI() {
    pane = new DockablePanel("EDITOR", " ", false);
    pane.setComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault()));
    pane.setMinimumSize(new Dimension(100, 100));
    pane.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            updateTitle();
        }
    });
    scrollPane = new JScrollPane(editor);
    Border panelBorder = UIManager.getBorder("OmegaTDockablePanel.border");
    if (panelBorder != null) {
        scrollPane.setBorder(panelBorder);
    }
    Border viewportBorder = UIManager.getBorder("OmegaTDockablePanelViewport.border");
    if (viewportBorder != null) {
        scrollPane.setViewportBorder(viewportBorder);
    }
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.getVerticalScrollBar().addAdjustmentListener(scrollListener);
    pane.setLayout(new BorderLayout());
    pane.add(scrollPane, BorderLayout.CENTER);
    mw.addDockable(pane);
    DockingDesktop desktop = UIDesignManager.getDesktop(pane);
    if (desktop != null) {
        desktop.addDockableSelectionListener(e -> dockableSelected = pane == e.getSelectedDockable());
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) BorderLayout(java.awt.BorderLayout) DockingDesktop(com.vlsolutions.swing.docking.DockingDesktop) Dimension(java.awt.Dimension) ComponentEvent(java.awt.event.ComponentEvent) Border(javax.swing.border.Border) EmptyBorder(javax.swing.border.EmptyBorder) ComponentAdapter(java.awt.event.ComponentAdapter) DockablePanel(org.omegat.gui.main.DockablePanel)

Example 2 with DockingDesktop

use of com.vlsolutions.swing.docking.DockingDesktop in project omegat by omegat-org.

the class MainWindowUI method initDocking.

/**
 * Create docking desktop panel.
 */
public static DockingDesktop initDocking(final MainWindow mainWindow) {
    mainWindow.desktop = new DockingDesktop();
    mainWindow.desktop.addDockableStateWillChangeListener(new DockableStateWillChangeListener() {

        public void dockableStateWillChange(DockableStateWillChangeEvent event) {
            if (event.getFutureState().isClosed()) {
                event.cancel();
            }
        }
    });
    return mainWindow.desktop;
}
Also used : DockableStateWillChangeEvent(com.vlsolutions.swing.docking.event.DockableStateWillChangeEvent) DockingDesktop(com.vlsolutions.swing.docking.DockingDesktop) DockableStateWillChangeListener(com.vlsolutions.swing.docking.event.DockableStateWillChangeListener)

Aggregations

DockingDesktop (com.vlsolutions.swing.docking.DockingDesktop)2 DockableStateWillChangeEvent (com.vlsolutions.swing.docking.event.DockableStateWillChangeEvent)1 DockableStateWillChangeListener (com.vlsolutions.swing.docking.event.DockableStateWillChangeListener)1 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 ComponentAdapter (java.awt.event.ComponentAdapter)1 ComponentEvent (java.awt.event.ComponentEvent)1 JScrollPane (javax.swing.JScrollPane)1 Border (javax.swing.border.Border)1 EmptyBorder (javax.swing.border.EmptyBorder)1 DockablePanel (org.omegat.gui.main.DockablePanel)1