Example usage for javax.swing JComponent setRequestFocusEnabled

List of usage examples for javax.swing JComponent setRequestFocusEnabled

Introduction

In this page you can find the example usage for javax.swing JComponent setRequestFocusEnabled.

Prototype

public void setRequestFocusEnabled(boolean requestFocusEnabled) 

Source Link

Document

Provides a hint as to whether or not this JComponent should get focus.

Usage

From source file:com.brainflow.application.toplevel.Brainflow.java

private void initializeWorkspace() throws Exception {
    log.info("initializing workspace");
    brainFrame.getDockingManager().getWorkspace().setLayout(new BorderLayout());
    brainFrame.getDockingManager().getWorkspace().add(documentPane, "Center");

    JComponent canvas = DisplayManager.getInstance().getSelectedCanvas().getComponent();
    canvas.setRequestFocusEnabled(true);
    canvas.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));

    documentPane.setTabPlacement(DocumentPane.BOTTOM);
    documentPane.openDocument(new DocumentComponent(new JScrollPane(canvas), "Canvas-1"));
    documentPane.setActiveDocument("Canvas-1");

    log.info("initializing loading dock");
    initLoadingDock();//from w  w  w . ja v  a  2s .c o m
    log.info("initializing project view");
    initProjectView();
    log.info("initializing image table view");
    initLoadableImageTableView();
    log.info("initializing control panel");
    initControlPanel();
    log.info("initializing event monitor");
    initEventBusMonitor();
    log.info("initializing log monitor");
    initLogMonitor();

    brainFrame.getDockingManager().beginLoadLayoutData();
    brainFrame.getDockingManager().setInitSplitPriority(DefaultDockingManager.SPLIT_EAST_WEST_SOUTH_NORTH);
    brainFrame.getDockingManager().loadLayoutData();

    brainFrame.toFront();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    brainFrame.setSize((int) screenSize.getWidth(), (int) screenSize.getHeight() - 50);
    brainFrame.setVisible(true);

    CanvasBar2 cbar = new CanvasBar2();

    /// TODO add automatic updating of canvas to Canvas Bar via EventBus
    //cbar.setImageCanvas(canvas);
    ////////////////////////////////////////////////////////////////////
    canvas.add(cbar.getComponent(), BorderLayout.NORTH);

}

From source file:brainflow.app.toplevel.BrainFlow.java

public void addCanvas(IBrainCanvas canvas) {
    //todo sync with DisplayManager?
    JComponent comp = canvas.getComponent();
    comp.setRequestFocusEnabled(true);
    comp.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    BrainCanvasTransferHandler handler = new BrainCanvasTransferHandler();
    comp.setTransferHandler(handler);//from  ww w  .j a  va  2  s  .  c o m
    CanvasBar cbar = new CanvasBar();

    canvas.getComponent().add(cbar.getComponent(), BorderLayout.NORTH);
    String canvasName = "Canvas-" + (documentPane.getDocumentCount() + 1);
    documentPane.openDocument(createCanvasDocument(canvas, canvasName));
    documentPane.setActiveDocument(canvasName);
    DisplayManager.get().setSelectedCanvas(canvas);

}

From source file:brainflow.app.toplevel.BrainFlow.java

private void initializeWorkspace() throws Exception {
    StopWatch watch = new StopWatch();

    watch.start("laying out workspace");
    log.info("initializing workspace");

    //_frame.getDockableBarManager().getMainContainer().setLayout(new BorderLayout());
    //_frame.getDockableBarManager().getMainContainer().add(_tabbedPane, BorderLayout.CENTER);

    //brainFrame.getMainPanel().add(documentPane, BorderLayout.CENTER);
    brainFrame.getDockingManager().getWorkspace().setLayout(new BorderLayout());
    brainFrame.getDockingManager().getWorkspace().add(documentPane, BorderLayout.CENTER);

    brainFrame.getDockingManager().beginLoadLayoutData();
    brainFrame.getDockingManager().setInitSplitPriority(DefaultDockingManager.SPLIT_EAST_WEST_SOUTH_NORTH);

    JComponent canvas = DisplayManager.get().getSelectedCanvas().getComponent();
    canvas.setRequestFocusEnabled(true);
    canvas.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    watch.stopAndReport("laying out workspace");
    watch.start("opening document");
    documentPane.setTabPlacement(DocumentPane.BOTTOM);
    documentPane.openDocument(createCanvasDocument(DisplayManager.get().getSelectedCanvas(), "Canvas-1"));
    documentPane.setActiveDocument("Canvas-1");
    watch.stopAndReport("opening document");

    log.info("initializing loading dock");
    watch.start("init loading dock");
    initLoadingDock();//  w  w  w  . j  av a 2s  .c o  m
    watch.stopAndReport("init loading dock");
    log.info("initializing project view");
    watch.start("init project view");
    initProjectView();
    watch.stopAndReport("init project view");
    log.info("initializing image table view");
    watch.start("init ploadable image table view");
    initLoadableImageTableView();
    watch.stopAndReport("init ploadable image table view");
    log.info("initializing control panel");
    watch.start("init control panel");
    initControlPanel();
    initCoordinatePanel();
    watch.stopAndReport("init control panel");
    log.info("initializing event monitor");
    watch.start("event bus monitor");
    initEventBusMonitor();
    log.info("initializing log monitor");
    watch.stopAndReport("event bus monitor");

    watch.start("log monitor");
    initLogMonitor();
    watch.stopAndReport("log monitor");

    watch.start("layout docks");

    brainFrame.getDockableBarManager().loadLayoutData();
    // brainFrame.toFront();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    brainFrame.setSize((int) screenSize.getWidth(), (int) screenSize.getHeight() - 50);

    watch.stopAndReport("layout docks");

    watch.start("canvas bar");
    CanvasBar cbar = new CanvasBar();
    canvas.add(cbar.getComponent(), BorderLayout.NORTH);
    watch.stopAndReport("canvas bar");

    brainFrame.getDockingManager().loadLayoutData();

}