本文整理汇总了Java中org.jdesktop.swingx.JXMultiSplitPane类的典型用法代码示例。如果您正苦于以下问题:Java JXMultiSplitPane类的具体用法?Java JXMultiSplitPane怎么用?Java JXMultiSplitPane使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JXMultiSplitPane类属于org.jdesktop.swingx包,在下文中一共展示了JXMultiSplitPane类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMultiSplitPaneDemo
import org.jdesktop.swingx.JXMultiSplitPane; //导入依赖的package包/类
private void createMultiSplitPaneDemo() {
setLayout( new BorderLayout());
JXMultiSplitPane msp = new JXMultiSplitPane();
String layoutDef = "(COLUMN (ROW weight=0.8 (COLUMN weight=0.25 " +
"(LEAF name=left.top weight=0.5) (LEAF name=left.middle weight=0.5))" +
"(LEAF name=editor weight=0.75)) (LEAF name=bottom weight=0.2))";
MultiSplitLayout.Node modelRoot = MultiSplitLayout.parseModel( layoutDef );
msp.getMultiSplitLayout().setModel( modelRoot );
msp.add( new JButton( "Left Top" ), "left.top" );
msp.add( new JButton( "Left Middle" ), "left.middle" );
msp.add( new JButton( "Editor" ), "editor" );
msp.add( new JButton( "Bottom" ), "bottom" );
// ADDING A BORDER TO THE MULTISPLITPANE CAUSES ALL SORTS OF ISSUES
msp.setBorder( BorderFactory.createEmptyBorder( 4, 4, 4, 4 ) );
add( msp, BorderLayout.CENTER );
}
示例2: createSplitPane
import org.jdesktop.swingx.JXMultiSplitPane; //导入依赖的package包/类
private JComponent createSplitPane() {
final JComponent demoContainer = new JXPanel();
demoContainer.setLayout(new BorderLayout()); //BoxLayout(demoContainer, BoxLayout.LINE_AXIS));
demoContainer.setBorder(BorderFactory.createLineBorder(Color.RED));
// <snip> MultiSplit layout declaration
String layout =
"(ROW " +
"(LEAF name=selector weight=0.3)" +
"(COLUMN weight=0.7 " +
"(LEAF name= demo weight=0.7)" +
"(LEAF name=source weight=0.3)" +
")" +
")";
MultiSplitLayout multiSplitLayout = new MultiSplitLayout(MultiSplitLayout.parseModel(layout));
// </snip>
JXMultiSplitPane splitPane = new JXMultiSplitPane();
splitPane.setLayout(multiSplitLayout);
splitPane.add("selector", createButtonStack(demoContainer));
splitPane.add("demo", demoContainer);
return splitPane;
}
示例3: createTextAction
import org.jdesktop.swingx.JXMultiSplitPane; //导入依赖的package包/类
/**
* @param demoContainer
* @return
*/
private Action createTextAction(final JComponent demoContainer) {
Action action = new AbstractAction("add editor - setText") {
@Override
public void actionPerformed(ActionEvent e) {
demoContainer.removeAll();
demoContainer.add(new JScrollPane(createEditorSetText()));
JXMultiSplitPane pane = SwingXUtilities.getAncestor(JXMultiSplitPane.class, demoContainer);
if (pane != null) {
pane.revalidate();
} else {
demoContainer.revalidate();
}
}
};
return action;
}
示例4: createEditorSetPage
import org.jdesktop.swingx.JXMultiSplitPane; //导入依赖的package包/类
/**
* @return
*/
protected JComponent createEditorSetPage() {
final JEditorPane editor = createEditor();
URL descriptionURL = getHTMLDescription();
try {
editor.setPage(descriptionURL);
} catch (IOException e) {
System.err.println("couldn't load description from URL:" + descriptionURL);
}
PropertyChangeListener l = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
JXMultiSplitPane pane = SwingXUtilities.getAncestor(JXMultiSplitPane.class, editor);
if (pane != null) {
MultiSplitLayout layout = pane.getMultiSplitLayout();
layout.layoutByWeight(pane.getParent());
}
}
};
editor.addPropertyChangeListener("page", l);
return editor;
}
示例5: createMultiColums
import org.jdesktop.swingx.JXMultiSplitPane; //导入依赖的package包/类
/**
* This method creates a pane split into resizeable columns, containing its
* arguments. The original column widths are weighted according to the
* getWeight functions of each element handler.
* @param elemHandlers
* @return a freshly created split pane containing the elements
*/
private JXMultiSplitPane createMultiColums(ElementHandler... elemHandlers) {
/*
* allocate one column for each real column and each divider
* -> elemHandlers.length columns
* -> elemHandlers.length - 1 dividers
*/
MultiSplitLayout.Node[] columns = new MultiSplitLayout.Node[elemHandlers.length*2 - 1];
/*
* The sum of the weights in a MultiSplitLayout has to be <= 1.0,
* divide each arbitrary weight by the sum of all weights to get there.
*/
double totalWeight = 0;
for(ElementHandler elemHandler : elemHandlers)
totalWeight += elemHandler.getWeight();
for(int i=0; i<elemHandlers.length; ++i) {
MultiSplitLayout.Leaf leaf = new MultiSplitLayout.Leaf(Integer.toString(i));
columns[2*i] = leaf;
leaf.setWeight(elemHandlers[i].getWeight() / totalWeight);
}
for(int i=0; i<columns.length; ++i)
if(columns[i] == null)
columns[i] = new MultiSplitLayout.Divider();
MultiSplitLayout.Node layoutRoot = new MultiSplitLayout.RowSplit(columns);
MultiSplitLayout layout = new MultiSplitLayout(layoutRoot);
layout.setLayoutByWeight(true);
JXMultiSplitPane pane = new JXMultiSplitPane(layout);
for(int i=0; i<elemHandlers.length; ++i)
pane.add(Integer.toString(i), elemHandlers[i].toComponent());
return pane;
}
示例6: positionRequirementPanelElements
import org.jdesktop.swingx.JXMultiSplitPane; //导入依赖的package包/类
private void positionRequirementPanelElements() {
Requirement_HandlerRequirementTab = new Requirement_ElementHandler();
Requirement_Detail_Handler = new Requirement_Detail_ElementHandler();
JXMultiSplitPane pane = createMultiColums(Requirement_HandlerRequirementTab, Requirement_Detail_Handler);
requirementModificationPanel.add(pane, BorderLayout.CENTER);
}
示例7: MainWindow
import org.jdesktop.swingx.JXMultiSplitPane; //导入依赖的package包/类
/**
* Creates new form MainFrame
*/
public MainWindow() {
initComponents();
menuItemCopy.addActionListener(new DefaultEditorKit.CopyAction());
menuItemCut.addActionListener(new DefaultEditorKit.CutAction());
menuItemPaste.addActionListener(new DefaultEditorKit.PasteAction());
setActionCommands();
filterManager = new FilterManager();
actionHandler = new ActionHandler(this, tmData, filterManager);
actionHandler.setModelMediator(this);
tmView = new TmView(actionHandler);
alignToolBar = new AlignToolBar(actionHandler);
editToolBar = new EditToolBar(actionHandler);
editLeftSegment.setModelMediator(this);
editRightSegment.setModelMediator(this);
labelStatusBar = new JXLabel(" ");
panelStatusBar = new JXStatusBar();
msp = new JXMultiSplitPane();
tableRows = new JXLabel(" ");
makeUi();
getContentPane().add(toolBar, BorderLayout.NORTH);
getContentPane().add(msp);
getContentPane().add(panelStatusBar, BorderLayout.SOUTH);
setTitle(AppConstants.getDisplayNameAndVersion());
if (Platform.isMacOsx()) {
setMacProxy();
}
setCloseHandler();
setMainFrameSize();
}
示例8: createContents
import org.jdesktop.swingx.JXMultiSplitPane; //导入依赖的package包/类
private Component createContents() {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
JXMultiSplitPane msp = new JXMultiSplitPane();
// @formatter:off
TestProperty.propertyStore.setIfNull("ui.layout", "(COLUMN (ROW (LEAF name=componentTree weight=1.0) "
+ "(LEAF name=editor )) " + "(ROW (LEAF name=properties weight=0.8) " + "(LEAF name=preview weight=0.05)))");
String layoutDef = TestProperty.propertyStore.get("ui.layout");
// @formatter:on
MultiSplitLayout.Node modelRoot = MultiSplitLayout.parseModel(layoutDef);
msp.getMultiSplitLayout().setModel(modelRoot);
componentTreePane = new ComponentTreePane(this);
editorPane = new EditorPane(this);
propertyPane = new PropertyPane(this);
previewPane = new PreviewPane(this);
msp.add(componentTreePane, "componentTree");
msp.add(editorPane, "editor");
msp.add(propertyPane, "properties");
msp.add(previewPane, "preview");
// adding a border to the multiplane causes all sorts of issues
msp.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
panel.add(msp, BorderLayout.CENTER);
pack();
return panel;
}
示例9: positionRequirementManagementPanelElements
import org.jdesktop.swingx.JXMultiSplitPane; //导入依赖的package包/类
private void positionRequirementManagementPanelElements() {
JXMultiSplitPane pane = createMultiColums(Requirement_Handler_ManagementTab, Commit_Handler_ManagementTab, Linkage_Handler);
LinkageManagmentPanel.add(pane, BorderLayout.CENTER);
}
示例10: createMainPanel
import org.jdesktop.swingx.JXMultiSplitPane; //导入依赖的package包/类
protected JComponent createMainPanel() {
// <snip> MultiSplit layout declaration
String layout =
"(ROW " +
"(LEAF name=selector weight=0.25)" +
"(COLUMN weight=0.75 " +
"(LEAF name= demo weight=0.7)" +
"(LEAF name=source weight=0.3)" +
")" +
")";
multiSplitLayout = new MultiSplitLayout(MultiSplitLayout.parseModel(layout));
// </snip>
JXMultiSplitPane splitPane = new JXMultiSplitPane();
splitPane.setLayout(multiSplitLayout);
// Create demo selector panel on left
JComponent demoSelectorPanel = demoSelector.getSelectorComponent();
demoSelectorPanel.setBorder(PANEL_BORDER);
splitPane.add(demoSelectorPanel, "selector");
// Create panel to contain currently running demo
JComponent demoContainer = new JXPanel();
demoContainer.setLayout(new BorderLayout());
demoContainer.setBorder(PANEL_BORDER);
splitPane.add(demoContainer, "demo");
// Create source code pane
codeViewer = new CodeViewer();
// Font font = codeViewer.getFont();
// codeViewer.setFont(font.deriveFont(Font.BOLD, 20.f));
JComponent codeContainer = new JPanel(new BorderLayout());
codeContainer.add(codeViewer);
codeContainer.setBorder(PANEL_BORDER);
splitPane.add(codeContainer, "source");
// Create shareable popup menu for demo actions
popup = new JPopupMenu();
popup.add(new EditPropertiesAction());
popup.add(new ViewCodeSnippetAction());
return splitPane;
}