Java Code Examples for javax.swing.JSplitPane#setName()

The following examples show how to use javax.swing.JSplitPane#setName() . 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 File: SampleVerifier.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Create an instance of SampleVerifier.
 */
private SampleVerifier ()
{
    // Pane split vertically: selectors then browser
    JSplitPane vertSplitPane = new JSplitPane(
            JSplitPane.VERTICAL_SPLIT,
            getSelectorsPanel(),
            glyphBrowser.getComponent());
    vertSplitPane.setName("SampleVerifierSplitPane");
    vertSplitPane.setDividerSize(1);

    // Hosting frame
    frame = new JFrame();
    frame.setName("SampleVerifierFrame");
    frame.add(vertSplitPane);

    // Resource injection
    ResourceMap resource = MainGui.getInstance().getContext().
            getResourceMap(
            getClass());
    resource.injectComponents(frame);
}
 
Example 2
Source File: SampleBrowser.java    From audiveris with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Define the layout of components within the provided frame.
 *
 * @param frame the bare frame
 * @return the populated frame
 */
private JFrame defineLayout (JFrame frame)
{
    frame.setName("SampleBrowserFrame"); // For SAF life cycle

    // |- left --||-- center ---|--------------- right ---------------|
    //
    // +=========++=============+=====================================+
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | . . . . || . sheet . . | . . . . . . . . shape 1 pane. . . . |
    // | . . . . || . . . . . . | . . sample. . . . . . . . . . . . . |
    // | . . . . || . selector. | . . . . . . . . shape 2 pane. . . . |
    // | . . . . || . . . . . . | . . listing . . . . . . . . . . . . |
    // | . . . . ||=============| . . . . . . . . shape 3 pane. . . . |
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | . . . . || . sample. . |=====================================|
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | . . . . || . board . . | . . . . . . . . . . . . . . . . . . |
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | shape . ||-------------| . . . . . . . . . . . . . . . . . . |
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | selector|| . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | . . . . || . eval. . . | . . . . sample. . . . . . . . . . . |
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | . . . . || . board . . | . . . . context . . . . . . . . . . |
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // | . . . . || . . . . . . | . . . . . . . . . . . . . . . . . . |
    // +=========++=============+=====================================+
    //
    // Left = shapeSelector
    shapeSelector.setName("shapeSelector");

    // Center
    BoardsPane boardsPane = new BoardsPane();
    boardsPane.addBoard(new SampleBoard(sampleController));
    boardsPane.addBoard(
            new SampleEvaluationBoard(sampleController, BasicClassifier.getInstance()));

    //        boardsPane.addBoard(
    //                new SampleEvaluationBoard(sampleController, DeepClassifier.getInstance()));
    //
    JSplitPane centerPane = new JSplitPane(
            VERTICAL_SPLIT,
            sheetSelector,
            boardsPane.getComponent());
    centerPane.setBorder(null);
    centerPane.setOneTouchExpandable(true);
    centerPane.setName("centerPane");

    // Right
    JSplitPane rightPane = new JSplitPane(
            VERTICAL_SPLIT,
            sampleListing,
            sampleContext.getComponent());
    rightPane.setBorder(null);
    rightPane.setOneTouchExpandable(true);
    rightPane.setName("rightPane");

    // Center + Right
    JSplitPane centerPlusRightPane = new JSplitPane(HORIZONTAL_SPLIT, centerPane, rightPane);
    centerPlusRightPane.setBorder(null);
    centerPlusRightPane.setOneTouchExpandable(true);
    centerPlusRightPane.setName("centerPlusRightPane");

    // Global
    JSplitPane mainPane = new JSplitPane(HORIZONTAL_SPLIT, shapeSelector, centerPlusRightPane);
    mainPane.setBorder(null);
    mainPane.setOneTouchExpandable(true);
    mainPane.setResizeWeight(0d); // Give all free space to center+right part
    mainPane.setName("mainPane");

    frame.add(mainPane);

    // Menu bar
    frame.setJMenuBar(buildMenuBar());

    // Resource injection
    ResourceMap resource = OmrGui.getApplication().getContext().getResourceMap(getClass());
    resource.injectComponents(frame);

    // Wiring
    boardsPane.connect();

    // Initialize sheet selector with all repository sheet names
    sheetSelector.stateChanged(null);

    return frame;
}
 
Example 3
Source File: BookBrowser.java    From audiveris with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new {@code BookBrowser} object.
 *
 * @param book the related book
 */
public BookBrowser (Book book)
{
    this.book = book;

    component = new JPanel();

    // Set up the tree
    model = new Model(book);

    ///model.addTreeModelListener(new ModelListener()); // Debug
    /** The tree entity */
    JTree tree = new JTree(model);

    // Build left-side view
    JScrollPane treeView = new JScrollPane(tree);

    // Build right-side view
    htmlPane = new JEditorPane("text/html", "");
    htmlPane.setEditable(false);

    JScrollPane htmlView = new JScrollPane(htmlPane);

    // Allow only single selections
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    // Display lines to explicit relationships
    tree.putClientProperty("JTree.lineStyle", "Angled");

    // Wire the two views together. Use a selection listener
    // created with an anonymous inner-class adapter.
    // Listen for when the selection changes.
    tree.addTreeSelectionListener(new SelectionListener());

    // To be notified of expansion / collapse actions (debug ...)
    ///tree.addTreeExpansionListener(new ExpansionListener());
    // Build split-pane view
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeView, htmlView);
    splitPane.setName("treeHtmlSplitPane");
    splitPane.setContinuousLayout(true);
    splitPane.setBorder(null);
    splitPane.setDividerSize(2);

    // Add GUI components
    component.setLayout(new BorderLayout());
    component.add("Center", splitPane);
}
 
Example 4
Source File: ScoreTree.java    From libreveris with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new ScoreTree object.
 *
 * @param score the related score
 */
public ScoreTree (Score score)
{
    this.score = score;

    component = new JPanel();

    // Set up the tree
    model = new Model(score);

    ///model.addTreeModelListener(new ModelListener()); // Debug

    /** The tree entity */
    JTree tree = new JTree(model);

    // Build left-side view
    JScrollPane treeView = new JScrollPane(tree);

    // Build right-side view
    htmlPane = new JEditorPane("text/html", "");
    htmlPane.setEditable(false);

    JScrollPane htmlView = new JScrollPane(htmlPane);

    // Allow only single selections
    tree.getSelectionModel().setSelectionMode(
            TreeSelectionModel.SINGLE_TREE_SELECTION);

    // Display lines to explicit relationships
    tree.putClientProperty("JTree.lineStyle", "Angled");

    // Wire the two views together. Use a selection listener
    // created with an anonymous inner-class adapter.
    // Listen for when the selection changes.
    tree.addTreeSelectionListener(new SelectionListener());

    // To be notified of expansion / collapse actions (debug ...)
    ///tree.addTreeExpansionListener(new ExpansionListener());

    // Build split-pane view
    JSplitPane splitPane = new JSplitPane(
            JSplitPane.HORIZONTAL_SPLIT,
            treeView,
            htmlView);
    splitPane.setName("treeHtmlSplitPane");
    splitPane.setContinuousLayout(true);
    splitPane.setBorder(null);
    splitPane.setDividerSize(2);

    // Add GUI components
    component.setLayout(new BorderLayout());
    component.add("Center", splitPane);
}