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

The following examples show how to use javax.swing.JFrame#setName() . 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
/**
 * 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
/**
 * Report the selection dialog to be displayed to the user
 *
 * @return the dialog frame
 */
public static JFrame getComponent ()
{
    final JFrame frame = new JFrame();
    frame.setName("topicsFrame");
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    JComponent framePane = (JComponent) frame.getContentPane();

    Panel panel = new Panel();
    FormLayout layout = new FormLayout("pref", "pref, 1dlu, pref, 1dlu, pref");
    PanelBuilder builder = new PanelBuilder(layout, panel);
    CellConstraints cst = new CellConstraints();
    int r = 1;
    builder.add(new EarlyPane(), cst.xy(1, r));

    r += 2;
    builder.add(new PluginPane(), cst.xy(1, r));

    r += 2;
    builder.add(new AllTopicsPane(), cst.xy(1, r));

    framePane.add(panel);

    // Resources injection
    ResourceMap resource = Application.getInstance().getContext().getResourceMap(
            AdvancedTopics.class);
    resource.injectComponents(frame);

    return frame;
}
 
Example 3
/**
 * Define the layout of components within the provided frame.
 *
 * @param frame the bare frame
 * @return the populated frame
 */
private JFrame defineLayout (final JFrame frame)
{
    frame.setName("TrainerFrame"); // For SAF life cycle

    // +=============================+
    // | . . . . . . . . . . . . . . |
    // | . Selection . . . . . . . . |
    // | . . . . . . . . . . . . . . |
    // |-----------------------------|
    // | . . . . . . . . . . . . . . |
    // | . Training. . . . . . . . . |
    // | . . . . . . . . . . . . . . |
    // |-----------------------------|
    // | . . . . . . . . . . . . . . |
    // | . Validation [train set]. . |
    // | . . . . . . . . . . . . . . |
    // |-----------------------------|
    // | . . . . . . . . . . . . . . |
    // | . Validation [test set] . . |
    // | . . . . . . . . . . . . . . |
    // +=============================+
    //
    FormLayout layout = new FormLayout("pref, 10dlu, pref", "pref, 10dlu, pref");
    CellConstraints cst = new CellConstraints();
    PanelBuilder builder = new PanelBuilder(layout, new Panel());

    int r = 1; // --------------------------------
    builder.add(selectionPanel.getComponent(), cst.xyw(1, r, 3, "center, fill"));

    r += 2; // --------------------------------
    builder.add(definePanel(ShapeClassifier.getInstance()), cst.xy(1, r));
    //        builder.add(definePanel(ShapeClassifier.getSecondInstance()), cst.xy(3, r));
    //
    frame.add(builder.getPanel());

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

    return frame;
}
 
Example 4
/**
 * 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 5
/**
 * Creates a new Options object.
 */
public Options ()
{
    // Preload constant units
    UnitManager.getInstance().preLoadUnits();

    frame = new JFrame();
    frame.setName("optionsFrame");
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    JComponent framePane = (JComponent) frame.getContentPane();
    framePane.setLayout(new BorderLayout());

    InputMap inputMap = framePane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    ActionMap actionMap = framePane.getActionMap();

    JToolBar toolBar = new JToolBar(JToolBar.HORIZONTAL);
    framePane.add(toolBar, BorderLayout.NORTH);

    // Dump button
    JButton dumpButton = new JButton(dumping);
    dumpButton.setName("optionsDumpButton");
    toolBar.add(dumpButton);

    // Check button
    JButton checkButton = new JButton(checking);
    checkButton.setName("optionsCheckButton");
    toolBar.add(checkButton);

    // Reset button
    JButton resetButton = new JButton(resetting);
    resetButton.setName("optionsResetButton");
    toolBar.add(resetButton);

    // Some space
    toolBar.add(Box.createHorizontalStrut(100));

    toolBar.add(new JLabel("Search:"));

    // Back button
    JButton backButton = new JButton(backSearch);
    backButton.setName("optionsBackButton");
    toolBar.add(backButton);
    inputMap.put(KeyStroke.getKeyStroke("shift F3"), "backSearch");
    actionMap.put("backSearch", backSearch);

    // Search entry
    searchField = new JTextField();
    searchField.setMaximumSize(new Dimension(200, 28));
    searchField.setName("optionsSearchField");
    searchField.setHorizontalAlignment(JTextField.LEFT);
    toolBar.add(searchField);
    inputMap.put(KeyStroke.getKeyStroke("ctrl F"), "find");
    actionMap.put("find", find);
    searchField.getDocument().addDocumentListener(docListener);

    // Forward button
    JButton forwardButton = new JButton(forwardSearch);
    forwardButton.setName("optionsForwardButton");
    toolBar.add(forwardButton);

    // Some space, message field
    toolBar.add(Box.createHorizontalStrut(10));
    toolBar.add(msgLabel);

    // TreeTable
    UnitModel unitModel = new UnitModel();
    unitTreeTable = new UnitTreeTable(unitModel);
    framePane.add(new JScrollPane(unitTreeTable), BorderLayout.CENTER);

    // Needed to process user input when RETURN/ENTER is pressed
    inputMap.put(KeyStroke.getKeyStroke("ENTER"), "forwardSearch");
    inputMap.put(KeyStroke.getKeyStroke("F3"), "forwardSearch");
    actionMap.put("forwardSearch", forwardSearch);

    // Resources injection
    ResourceMap resource = Application.getInstance().getContext().getResourceMap(getClass());
    resource.injectComponents(frame);

    // Make sure the search entry field gets the focus at creation time
    frame.addWindowListener(new WindowAdapter()
    {
        @Override
        public void windowOpened (WindowEvent e)
        {
            searchField.requestFocus();
        }
    });
}
 
Example 6
/**
 * Creates a new Options object.
 */
public Options ()
{
    // Preload constant units
    UnitManager.getInstance()
            .preLoadUnits(Main.class.getName());

    frame = new JFrame();
    frame.setName("optionsFrame");
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.getContentPane()
            .setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar(JToolBar.HORIZONTAL);
    frame.add(toolBar, BorderLayout.NORTH);

    // Dump button
    JButton dumpButton = new JButton(dumping);
    dumpButton.setName("optionsDumpButton");
    toolBar.add(dumpButton);

    // Check button
    JButton checkButton = new JButton(checking);
    checkButton.setName("optionsCheckButton");
    toolBar.add(checkButton);

    // Reset button
    JButton resetButton = new JButton(resetting);
    resetButton.setName("optionsResetButton");
    toolBar.add(resetButton);

    // Some space
    toolBar.add(Box.createHorizontalStrut(100));

    toolBar.add(new JLabel("Search:"));

    // Back button
    JButton backButton = new JButton(backSearch);
    backButton.setName("optionsBackButton");
    toolBar.add(backButton);

    // Search entry
    searchField = new JTextField();
    searchField.setMaximumSize(new Dimension(200, 28));
    searchField.setName("optionsSearchField");
    searchField.setHorizontalAlignment(JTextField.LEFT);
    toolBar.add(searchField);

    // Forward button
    JButton forwardButton = new JButton(forwardSearch);
    forwardButton.setName("optionsForwardButton");
    toolBar.add(forwardButton);

    // TreeTable
    UnitModel unitModel = new UnitModel();
    unitTreeTable = new UnitTreeTable(unitModel);
    frame.add(new JScrollPane(unitTreeTable), BorderLayout.CENTER);

    // Needed to process user input when RETURN/ENTER is pressed
    toolBar.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
            .put(KeyStroke.getKeyStroke("ENTER"), "EnterAction");
    toolBar.getActionMap()
            .put("EnterAction", forwardSearch);

    // Resources injection
    ResourceMap resource = Application.getInstance()
            .getContext()
            .getResourceMap(getClass());
    resource.injectComponents(frame);

    // Make sure the search entry field gets the focus at creation time
    frame.addWindowListener(
            new WindowAdapter()
    {
        @Override
        public void windowOpened (WindowEvent e)
        {
            searchField.requestFocus();
        }
    });
}
 
Example 7
/**
 * Create an instance of Glyph Trainer (there should be just one)
 */
private GlyphTrainer ()
{
    if (standAlone) {
        // UI Look and Feel
        UILookAndFeel.setUI(null);
    }

    frame = new JFrame();
    frame.setName("trainerFrame");

    // Listener on remaining error
    ChangeListener errorListener = new ChangeListener()
    {
        @Override
        public void stateChanged (ChangeEvent e)
        {
            frame.setTitle(
                    String.format(
                    "%.5f - %s",
                    networkPanel.getBestError(),
                    frameTitle));
        }
    };

    // Create the three companions
    selectionPanel = new SelectionPanel(task, standardWidth);
    networkPanel = new NetworkPanel(
            task,
            standardWidth,
            errorListener,
            selectionPanel);
    selectionPanel.setTrainingPanel(networkPanel);
    validationPanel = new ValidationPanel(
            task,
            standardWidth,
            GlyphNetwork.getInstance(),
            selectionPanel,
            networkPanel);
    regressionPanel = new RegressionPanel(
            task,
            standardWidth,
            selectionPanel);
    frame.add(createGlobalPanel());

    // Initial state
    task.setActivity(Task.Activity.INACTIVE);

    // Specific ending if stand alone
    if (standAlone) {
        frame.addWindowListener(windowCloser);
    }

    // Resource injection
    ResourceMap resource = MainGui.getInstance()
            .getContext()
            .getResourceMap(getClass());
    resource.injectComponents(frame);
    frameTitle = frame.getTitle();
}