Search in sources :

Example 66 with JRootPane

use of javax.swing.JRootPane in project blue by kunstmusik.

the class TreeHilightDropListener method resetGlassPane.

private void resetGlassPane(DropTargetEvent dte) {
    JTree tree = (JTree) dte.getDropTargetContext().getComponent();
    JRootPane rootPane = tree.getRootPane();
    rootPane.setGlassPane(oldGlassPane);
    oldGlassPane.setVisible(false);
    rootPane.repaint();
}
Also used : JTree(javax.swing.JTree) JRootPane(javax.swing.JRootPane)

Example 67 with JRootPane

use of javax.swing.JRootPane in project cytoscape-impl by cytoscape.

the class NetworkViewFrame method init.

private void init() {
    setName("Frame." + networkViewContainer.getName());
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    // To prevent error this error when using multiple monitors:
    // "IllegalArgumentException: adding a container to a container on a different GraphicsDevice".
    networkViewContainer.setRootPane(new JRootPane());
    getContentPane().add(containerRootPane, BorderLayout.CENTER);
    if (toolBar != null) {
        toolBar.setFloatable(false);
        final Properties props = (Properties) serviceRegistrar.getService(CyProperty.class, "(cyPropertyName=cytoscape3.props)").getProperties();
        setToolBarVisible(props.getProperty("showDetachedViewToolBars", "true").equalsIgnoreCase("true"));
        getContentPane().add(toolBar, BorderLayout.NORTH);
    }
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowOpened(WindowEvent e) {
            networkViewContainer.update();
            networkViewContainer.updateViewSize();
        }
    });
    update();
}
Also used : WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) JRootPane(javax.swing.JRootPane) Properties(java.util.Properties)

Example 68 with JRootPane

use of javax.swing.JRootPane in project cytoscape-impl by cytoscape.

the class UiScaffold method start.

void start() {
    MockitoAnnotations.initMocks(this);
    Random random = new Random(0);
    NetworkTestSupport networkTestSupport = new NetworkTestSupport();
    CyNetwork network = networkTestSupport.getNetwork();
    CyTable nodeTable = network.getDefaultNodeTable();
    nodeTable.createColumn("Score", Double.class, false);
    nodeTable.createColumn("IsSpecial", Boolean.class, false);
    for (int i = 0; i < TOTAL_NODES; i++) {
        CyNode node = network.addNode();
        network.getRow(node).set("Score", random.nextGaussian());
        network.getRow(node).set("IsSpecial", i % 2 == 0);
    }
    List<CyNode> nodes = network.getNodeList();
    for (int i = 0; i < TOTAL_EDGES; i++) {
        CyNode source = nodes.get(random.nextInt(nodes.size()));
        CyNode target = nodes.get(random.nextInt(nodes.size()));
        network.addEdge(source, target, false);
    }
    when(applicationManager.getCurrentNetworkView()).thenReturn(networkView);
    when(applicationManager.getCurrentNetwork()).thenReturn(network);
    when(networkView.getModel()).thenReturn(network);
    when(serviceRegistrar.getService(CyApplicationManager.class)).thenReturn(applicationManager);
    when(serviceRegistrar.getService(TaskManager.class)).thenReturn(taskManager);
    when(serviceRegistrar.getService(IconManager.class)).thenReturn(iconManager);
    JFrame frame = new JFrame();
    frame.setTitle("Select");
    Map<String, String> properties = Collections.emptyMap();
    TransformerManagerImpl transformerManager = new TransformerManagerImpl();
    transformerManager.registerFilterFactory(new ColumnFilterFactory(), properties);
    transformerManager.registerFilterFactory(new DegreeFilterFactory(), properties);
    transformerManager.registerFilterFactory(new TopologyFilterFactory(), properties);
    transformerManager.registerElementTransformerFactory(new InteractionTransformerFactory(), properties);
    ModelMonitor modelMonitor = new ModelMonitor();
    modelMonitor.handleEvent(new SetCurrentNetworkEvent(applicationManager, network));
    ValidationManager validationManager = new ValidationManager();
    FilterPanelStyle style = new StandardStyle();
    TransformerViewManager transformerViewManager = new TransformerViewManager(transformerManager);
    // transformerViewManager.registerTransformerViewFactory(new ColumnFilterViewFactory(style, modelMonitor), properties);
    transformerViewManager.registerTransformerViewFactory(new DegreeFilterViewFactory(style, modelMonitor), properties);
    transformerViewManager.registerTransformerViewFactory(new TopologyFilterViewFactory(style), properties);
    transformerViewManager.registerTransformerViewFactory(new InteractionTransformerViewFactory(style), properties);
    LazyWorkQueue queue = new LazyWorkQueue();
    FilterWorker filterWorker = new FilterWorker(queue, serviceRegistrar);
    FilterIO filterIo = null;
    FilterPanelController filterPanelController = new FilterPanelController(transformerManager, transformerViewManager, validationManager, filterWorker, modelMonitor, filterIo, style, serviceRegistrar);
    FilterPanel filterPanel = new FilterPanel(filterPanelController, filterWorker, serviceRegistrar);
    TransformerWorker transformerWorker = new TransformerWorker(queue, transformerManager, serviceRegistrar);
    TransformerPanelController transformerPanelController = new TransformerPanelController(transformerManager, transformerViewManager, validationManager, filterPanelController, transformerWorker, filterIo, style, serviceRegistrar);
    TransformerPanel transformerPanel = new TransformerPanel(transformerPanelController, transformerWorker, serviceRegistrar);
    SelectPanel selectPanel = new SelectPanel(filterPanel, transformerPanel);
    JRootPane root = frame.getRootPane();
    root.setLayout(new GridBagLayout());
    root.add(selectPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    frame.setSize(450, 500);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}
Also used : TransformerViewManager(org.cytoscape.filter.internal.view.TransformerViewManager) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) InteractionTransformerFactory(org.cytoscape.filter.internal.transformers.interaction.InteractionTransformerFactory) CyNetwork(org.cytoscape.model.CyNetwork) FilterPanel(org.cytoscape.filter.internal.view.FilterPanel) FilterPanelStyle(org.cytoscape.filter.internal.view.look.FilterPanelStyle) CyTable(org.cytoscape.model.CyTable) Random(java.util.Random) JFrame(javax.swing.JFrame) CyNode(org.cytoscape.model.CyNode) LazyWorkQueue(org.cytoscape.filter.internal.work.LazyWorkQueue) SetCurrentNetworkEvent(org.cytoscape.application.events.SetCurrentNetworkEvent) TransformerManagerImpl(org.cytoscape.filter.internal.work.TransformerManagerImpl) ColumnFilterFactory(org.cytoscape.filter.internal.filters.column.ColumnFilterFactory) ValidationManager(org.cytoscape.filter.internal.work.ValidationManager) StandardStyle(org.cytoscape.filter.internal.view.look.StandardStyle) NetworkTestSupport(org.cytoscape.model.NetworkTestSupport) TopologyFilterFactory(org.cytoscape.filter.internal.filters.topology.TopologyFilterFactory) InteractionTransformerViewFactory(org.cytoscape.filter.internal.transformers.interaction.InteractionTransformerViewFactory) DegreeFilterFactory(org.cytoscape.filter.internal.filters.degree.DegreeFilterFactory) SelectPanel(org.cytoscape.filter.internal.view.SelectPanel) TopologyFilterViewFactory(org.cytoscape.filter.internal.filters.topology.TopologyFilterViewFactory) TransformerPanelController(org.cytoscape.filter.internal.view.TransformerPanelController) TransformerPanel(org.cytoscape.filter.internal.view.TransformerPanel) FilterWorker(org.cytoscape.filter.internal.work.FilterWorker) DegreeFilterViewFactory(org.cytoscape.filter.internal.filters.degree.DegreeFilterViewFactory) FilterPanelController(org.cytoscape.filter.internal.view.FilterPanelController) JRootPane(javax.swing.JRootPane) TransformerWorker(org.cytoscape.filter.internal.work.TransformerWorker)

Example 69 with JRootPane

use of javax.swing.JRootPane in project keystore-explorer by kaikramer.

the class JEscDialog method createRootPane.

@Override
protected JRootPane createRootPane() {
    JRootPane rootPane = new JRootPane();
    // Escape key closes dialogs
    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(stroke, "escapeKey");
    rootPane.getActionMap().put("escapeKey", new AbstractAction() {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            setVisible(false);
            dispose();
        }
    });
    return rootPane;
}
Also used : ActionEvent(java.awt.event.ActionEvent) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane) AbstractAction(javax.swing.AbstractAction)

Example 70 with JRootPane

use of javax.swing.JRootPane in project Course_Generator by patrovite.

the class FrmCalcSunriseSunset method createRootPane.

/**
 * Manage low level key strokes ESCAPE : Close the window
 *
 * @return
 */
protected JRootPane createRootPane() {
    JRootPane rootPane = new JRootPane();
    KeyStroke strokeEscape = KeyStroke.getKeyStroke("ESCAPE");
    KeyStroke strokeEnter = KeyStroke.getKeyStroke("ENTER");
    Action actionListener = new AbstractAction() {

        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    };
    Action actionListenerEnter = new AbstractAction() {

        public void actionPerformed(ActionEvent actionEvent) {
            RequestToClose();
        }
    };
    InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(strokeEscape, "ESCAPE");
    rootPane.getActionMap().put("ESCAPE", actionListener);
    inputMap.put(strokeEnter, "ENTER");
    rootPane.getActionMap().put("ENTER", actionListenerEnter);
    return rootPane;
}
Also used : Action(javax.swing.Action) AbstractAction(javax.swing.AbstractAction) ActionEvent(java.awt.event.ActionEvent) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane) InputMap(javax.swing.InputMap) AbstractAction(javax.swing.AbstractAction)

Aggregations

JRootPane (javax.swing.JRootPane)89 ActionEvent (java.awt.event.ActionEvent)48 KeyStroke (javax.swing.KeyStroke)34 AbstractAction (javax.swing.AbstractAction)32 Action (javax.swing.Action)29 InputMap (javax.swing.InputMap)26 JPanel (javax.swing.JPanel)16 BorderLayout (java.awt.BorderLayout)14 JButton (javax.swing.JButton)13 ActionListener (java.awt.event.ActionListener)12 JLabel (javax.swing.JLabel)12 FlowLayout (java.awt.FlowLayout)10 Container (java.awt.Container)9 Dimension (java.awt.Dimension)9 Insets (java.awt.Insets)9 BoxLayout (javax.swing.BoxLayout)9 Component (java.awt.Component)8 Frame (java.awt.Frame)7 JScrollPane (javax.swing.JScrollPane)7 GridBagConstraints (java.awt.GridBagConstraints)6