Java Code Examples for com.sun.swingset3.codeview.CodeViewer

The following examples show how to use com.sun.swingset3.codeview.CodeViewer. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: littleluck   Source File: SwingSet3.java    License: Apache License 2.0 4 votes vote down vote up
protected JComponent createMainPanel() {
    
    // Create main panel with demo selection on left and demo/source on right
    mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
   
    // Create demo selector panel on left
    demoSelectorPanel = new DemoSelectorPanel(demoListTitle, demoList);
    demoSelectorPanel.setPreferredSize(new Dimension(DEMO_SELECTOR_WIDTH, MAIN_FRAME_HEIGHT));
    demoSelectorPanel.addPropertyChangeListener(new DemoSelectionListener());
    mainPanel.add(demoSelectorPanel, BorderLayout.WEST);
    
    // Create splitpane on right to hold demo and source code
    demoSplitPane = new AnimatingSplitPane(JSplitPane.VERTICAL_SPLIT);
    demoSplitPane.setBorder(EMPTY_BORDER);
    mainPanel.add(demoSplitPane, BorderLayout.CENTER);
    
    // Create panel to contain currently running demo
    demoContainer = new JPanel();
    demoContainer.setLayout(new BorderLayout());
    demoContainer.setBorder(PANEL_BORDER);
    demoContainer.setPreferredSize(new Dimension(DEMO_PANEL_WIDTH, DEMO_PANEL_HEIGHT));
    demoSplitPane.setTopComponent(demoContainer);

    currentDemoPanel = demoPlaceholder;
    demoContainer.add(demoPlaceholder, BorderLayout.CENTER);
            
    // Create collapsible source code pane

    codeViewer = new CodeViewer();
    codeContainer = new JPanel(new BorderLayout());
    codeContainer.add(codeViewer);
    codeContainer.setBorder(PANEL_BORDER);
    codeContainer.setMinimumSize(new Dimension(0,0));
    demoSplitPane.setBottomComponent(codeContainer);
    
    addPropertyChangeListener(new SwingSetPropertyListener());        
    
    // Create shareable popup menu for demo actions
    popup = new JPopupMenu();
    popup.add(new EditPropertiesAction());
    popup.add(new ViewCodeSnippetAction());

    return mainPanel;
}
 
Example 2
Source Project: beautyeye   Source File: SwingSet3.java    License: Apache License 2.0 4 votes vote down vote up
protected JComponent createMainPanel() {
    
    // Create main panel with demo selection on left and demo/source on right
    mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
   
    // Create demo selector panel on left
    demoSelectorPanel = new DemoSelectorPanel(demoListTitle, demoList);
    demoSelectorPanel.setPreferredSize(new Dimension(DEMO_SELECTOR_WIDTH, MAIN_FRAME_HEIGHT));
    demoSelectorPanel.addPropertyChangeListener(new DemoSelectionListener());
    mainPanel.add(demoSelectorPanel, BorderLayout.WEST);
    
    // Create splitpane on right to hold demo and source code
    demoSplitPane = new AnimatingSplitPane(JSplitPane.VERTICAL_SPLIT);
    demoSplitPane.setBorder(EMPTY_BORDER);
    mainPanel.add(demoSplitPane, BorderLayout.CENTER);
    
    // Create panel to contain currently running demo
    demoContainer = new JPanel();
    demoContainer.setLayout(new BorderLayout());
    demoContainer.setBorder(PANEL_BORDER);
    demoContainer.setPreferredSize(new Dimension(DEMO_PANEL_WIDTH, DEMO_PANEL_HEIGHT));
    demoSplitPane.setTopComponent(demoContainer);

    currentDemoPanel = demoPlaceholder;
    demoContainer.add(demoPlaceholder, BorderLayout.CENTER);
            
    // Create collapsible source code pane

    codeViewer = new CodeViewer();
    codeContainer = new JPanel(new BorderLayout());
    codeContainer.add(codeViewer);
    codeContainer.setBorder(PANEL_BORDER);
    codeContainer.setMinimumSize(new Dimension(0,0));
    demoSplitPane.setBottomComponent(codeContainer);
    
    addPropertyChangeListener(new SwingSetPropertyListener());        
    
    // Create shareable popup menu for demo actions
    popup = new JPopupMenu();
    popup.add(new EditPropertiesAction());
    popup.add(new ViewCodeSnippetAction());

    return mainPanel;
}
 
Example 3
Source Project: Darcula   Source File: SwingSet3.java    License: Apache License 2.0 4 votes vote down vote up
protected JComponent createMainPanel() {
    
    // Create main panel with demo selection on left and demo/source on right
    mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
   
    // Create demo selector panel on left
    demoSelectorPanel = new DemoSelectorPanel(demoListTitle, demoList);
    demoSelectorPanel.setPreferredSize(new Dimension(DEMO_SELECTOR_WIDTH, MAIN_FRAME_HEIGHT));
    demoSelectorPanel.addPropertyChangeListener(new DemoSelectionListener());
    mainPanel.add(demoSelectorPanel, BorderLayout.WEST);
    
    // Create splitpane on right to hold demo and source code
    demoSplitPane = new AnimatingSplitPane(JSplitPane.VERTICAL_SPLIT);
    demoSplitPane.setBorder(EMPTY_BORDER);
    mainPanel.add(demoSplitPane, BorderLayout.CENTER);
    
    // Create panel to contain currently running demo
    demoContainer = new JPanel();
    demoContainer.setLayout(new BorderLayout());
    demoContainer.setBorder(PANEL_BORDER);
    demoContainer.setPreferredSize(new Dimension(DEMO_PANEL_WIDTH, DEMO_PANEL_HEIGHT));
    demoSplitPane.setTopComponent(demoContainer);

    currentDemoPanel = demoPlaceholder;
    demoContainer.add(demoPlaceholder, BorderLayout.CENTER);
            
    // Create collapsible source code pane

    codeViewer = new CodeViewer();
    codeContainer = new JPanel(new BorderLayout());
    codeContainer.add(codeViewer);
    codeContainer.setBorder(PANEL_BORDER);
    codeContainer.setMinimumSize(new Dimension(0,0));
    demoSplitPane.setBottomComponent(codeContainer);
    
    addPropertyChangeListener(new SwingSetPropertyListener());        
    
    // Create shareable popup menu for demo actions
    popup = new JPopupMenu();
    popup.add(new EditPropertiesAction());
    popup.add(new ViewCodeSnippetAction());

    return mainPanel;
}