Java Swing - Dock
package jlib5.swing; import javax.swing.Icon; import javax.swing.JComponent; import net.infonode.docking.DockingWindow; import net.infonode.docking.RootWindow; import net.infonode.docking.SplitWindow; import net.infonode.docking.TabWindow; import net.infonode.docking.View; import net.infonode.docking.mouse.DockingWindowActionMouseButtonListener; import net.infonode.docking.properties.RootWindowProperties; import net.infonode.docking.theme.DockingWindowsTheme; import net.infonode.docking.theme.ShapedGradientDockingTheme; import net.infonode.docking.util.DockingUtil; import net.infonode.docking.util.ViewMap; import net.infonode.util.Direction; public class Dock { static ViewMap viewMap = new ViewMap(); RootWindowProperties properties; DockingWindowsTheme currentTheme; RootWindow rootWindow; Integer viewIndex = 0; public Dock() { properties = new RootWindowProperties(); currentTheme = new ShapedGradientDockingTheme(); } public RootWindow getRootWindow() { return rootWindow; } public SplitWindow getHSplit(float pos, DockingWindow left, DockingWindow right) { return new SplitWindow(true, pos, left, right); } public SplitWindow getVSplit(float pos, DockingWindow left, DockingWindow right) { return new SplitWindow(false, pos, left, right); } public TabWindow getTab(DockingWindow...views) { return new TabWindow(views); } public View addToViewMap(String title, Icon icon, JComponent node) { View view = new View(title, icon, node); viewMap.addView(viewIndex++, view); return view; } public void createRootWindow() { rootWindow = DockingUtil.createRootWindow(viewMap, null, true); properties.addSuperObject(currentTheme.getRootWindowProperties()); properties.getDockingWindowProperties().setCloseEnabled(false); rootWindow.getRootWindowProperties().addSuperObject(properties); rootWindow.getWindowBar(Direction.DOWN).setEnabled(true); rootWindow.addTabMouseButtonListener(DockingWindowActionMouseButtonListener.MIDDLE_BUTTON_CLOSE_LISTENER); } /* private void showFrame() { frame = new JFrame("InfoNode Docking Windows Example"); //frame.getContentPane().add(createToolBar(), BorderLayout.NORTH); frame.getContentPane().add(rootWindow, BorderLayout.CENTER); frame.setJMenuBar(createMenuBar()); frame.setSize(900, 700); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } void setDefaultLayout() { TabWindow tabWindow = new TabWindow(views); rootWindow.setWindow(new SplitWindow(true, 0.3f, new SplitWindow(false, 0.7f, new TabWindow(new View[]{views[0], views[1]}), views[2]), tabWindow)); WindowBar windowBar = rootWindow.getWindowBar(Direction.DOWN); while (windowBar.getChildWindowCount() > 0) windowBar.getChildWindow(0).close(); windowBar.addTab(views[3]); } */ }
댓글 없음:
댓글 쓰기