Simple demo for dockable windows : Dockable « Swing Components « Java

Simple demo for dockable windows

Simple demo for dockable windows
package net.eleritec.docking.demos;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;

import net.eleritec.docking.DockingManager;
import net.eleritec.docking.DockingPort;
import net.eleritec.docking.defaults.DefaultDockingPort;

public class SimpleDemo extends JFrame {
  public static void main(String[] args) {
    JFrame f = new SimpleDemo();
    f.setSize(600, 400);
  public SimpleDemo() {
    super("Simple Docking Demo");
  private JPanel createContentPane() {
    JPanel p = new JPanel(new BorderLayout(5, 5));
    p.add(buildDockingPort(, "Blue"), BorderLayout.NORTH);
    p.add(buildDockingPort(, "Red"), BorderLayout.SOUTH);
    p.add(buildDockingPort(, "Green"), BorderLayout.EAST);
    p.add(buildDockingPort(Color.yellow, "Yellow"), BorderLayout.WEST);
    p.add(createDockingPort(), BorderLayout.CENTER);
    return p;
  private DefaultDockingPort buildDockingPort(Color color, String desc) {
    // create the DockingPort
    DefaultDockingPort port = createDockingPort();
    // create and register the Dockable panel
    JPanel p = new JPanel();
    DockingManager.registerDockable(p, desc, true);
    // dock the panel and return the DockingPort
    port.dock(p, desc, DockingPort.CENTER_REGION, false);
    return port;
  private DefaultDockingPort createDockingPort() {
    DefaultDockingPort port = new DefaultDockingPort();
    port.setPreferredSize(new Dimension(100, 100));
    return port;

       57 k)

Related examples in the same category

1.Swing dockable windowSwing dockable window
2.Compound dockable windowCompound dockable window
3.Cursor indication for dockable componentCursor indication for dockable component
4.SplitPane and dockable componentSplitPane and dockable component
5.Elegant Dockable frameworkElegant Dockable framework
6.Add border for dockable componentAdd border for dockable component
7.TabbedPane and dockable component 2TabbedPane and dockable component 2
8.Swing dock framework