Elegant Dockable framework : Dockable « Swing Components « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JavaFX
25.JDK 6
26.JDK 7
27.JNDI LDAP
28.JPA
29.JSP
30.JSTL
31.Language Basics
32.Network Protocol
33.PDF RTF
34.Reflection
35.Regular Expressions
36.Scripting
37.Security
38.Servlets
39.Spring
40.Swing Components
41.Swing JFC
42.SWT JFace Eclipse
43.Threads
44.Tiny Application
45.Velocity
46.Web Services SOA
47.XML
Java » Swing Components » Dockable 




Elegant Dockable framework
Elegant Dockable framework


package net.eleritec.docking.demos.elegant;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicSplitPaneDivider;
import javax.swing.plaf.basic.BasicSplitPaneUI;

import net.eleritec.docking.Dockable;
import net.eleritec.docking.DockingPort;
import net.eleritec.docking.defaults.DefaultDockingPort;
import net.eleritec.docking.defaults.StandardBorderManager;


public class ElegantDemo extends JFrame {
  private JSplitPane horizontalSplit;
  private JSplitPane vertSplitRight;
  private JSplitPane vertSplitLeft;
  
  private ElegantPanel j2eeHierarchyView;
  private ElegantPanel j2eeNavView;
  private ElegantPanel consoleView;
  private ElegantPanel serversView;
  private ElegantPanel tasksView;
  private ElegantPanel searchView;
  private ElegantPanel synchronizeView;
  private ElegantPanel outlineView;
  private ElegantPanel editorView;
  
  private ElegantDockingPort topLeft;
  private ElegantDockingPort bottomLeft;
  private ElegantDockingPort topRight;
  private ElegantDockingPort bottomRight;
  
  public ElegantDemo() {
    super("Elegant Docking Demo");
    init();
  }

  private void init() {
    createViews();
    horizontalSplit = createSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    vertSplitLeft = createSplitPane(JSplitPane.VERTICAL_SPLIT);
    vertSplitRight = createSplitPane(JSplitPane.VERTICAL_SPLIT);
    
    horizontalSplit.setLeftComponent(vertSplitLeft);
    horizontalSplit.setRightComponent(vertSplitRight);
    initDockingPorts();
    
    setContentPane(horizontalSplit);
  }
  
  private void createViews() {
    j2eeHierarchyView = new ElegantPanel("J2EE Hierarchy");
    j2eeNavView = new ElegantPanel("J2EE Navigator");
    consoleView = new ElegantPanel("Console");
    serversView = new ElegantPanel("Servers");
    tasksView = new ElegantPanel("Tasks");
    searchView = new ElegantPanel("Search");
    synchronizeView = new ElegantPanel("Synchronize");
    outlineView = new ElegantPanel("Outline");
    editorView = new ElegantPanel("Editor");
  }
  

  private void initDockingPorts() {
    topLeft = new ElegantDockingPort();
    bottomLeft = new ElegantDockingPort();
    topRight = new ElegantDockingPort();
    bottomRight = new ElegantDockingPort();
    
    topLeft.add(j2eeHierarchyView);
    topLeft.add(j2eeNavView);
    bottomLeft.add(outlineView);
    topRight.add(editorView);
    bottomRight.add(tasksView);
    bottomRight.add(serversView);
    bottomRight.add(consoleView);
    bottomRight.add(searchView);
    bottomRight.add(synchronizeView);    

    vertSplitLeft.setLeftComponent(topLeft);
    vertSplitLeft.setRightComponent(bottomLeft);
    vertSplitRight.setLeftComponent(topRight);
    vertSplitRight.setRightComponent(bottomRight);
  }


  private void postInit() {
    horizontalSplit.setDividerLocation(0.3d);
    vertSplitLeft.setDividerLocation(0.75d);
    vertSplitRight.setDividerLocation(0.75d);
  }

  private static JSplitPane createSplitPane(int orientation) {
    JSplitPane split = new JSplitPane(orientation);
    // remove the border from the split pane
    split.setBorder(null);
         
    // set the divider size for a more reasonable, less bulky look 
    split.setDividerSize(3);

    // check the UI.  If we can't work with the UI any further, then
    // exit here.
    if (!(split.getUI() instanceof BasicSplitPaneUI))
       return split;

    //  grab the divider from the UI and remove the border from it
    BasicSplitPaneDivider divider =
             ((BasicSplitPaneUIsplit.getUI()).getDivider();
    if (divider != null)
       divider.setBorder(null);

    return split;
  }
  
  public static void main(String[] args) {
    ElegantDemo demo = new ElegantDemo();
    demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    demo.setSize(800600);
    demo.setVisible(true);
    
    // now that we're visible and validated, move the split pane
    // dividers to their proper locations.
    demo.postInit();
  }
}

           
       














dockingSrc-0.3.zip( 57 k)
Related examples in the same category
1.Swing dockable windowSwing dockable window
2.Simple demo for dockable windowsSimple demo for dockable windows
3.Compound dockable windowCompound dockable window
4.Cursor indication for dockable componentCursor indication for dockable component
5.SplitPane and dockable componentSplitPane and dockable component
6.Add border for dockable componentAdd border for dockable component
7.TabbedPane and dockable component 2TabbedPane and dockable component 2
8.Swing dock framework
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.