List of usage examples for javax.swing JInternalFrame setVisible
@BeanProperty(hidden = true, visualUpdate = true) public void setVisible(boolean aFlag)
From source file:CSSDFarm.UserInterface.java
/** * Configure JxBrowser to be displayed. Load map.html from file to string data, load * this data into JxBrowser and add the browser to the panel. *//*w ww .jav a 2 s . c om*/ public void displayHeatmap() { LoggerProvider.getChromiumProcessLogger().setLevel(Level.OFF); LoggerProvider.getIPCLogger().setLevel(Level.OFF); LoggerProvider.getBrowserLogger().setLevel(Level.OFF); BrowserView view = new BrowserView(browser); JPanel toolBar = new JPanel(); Dimension dimension = panelHeatmap.getSize(); JInternalFrame internalFrame = new JInternalFrame(); internalFrame.add(view, BorderLayout.CENTER); internalFrame.add(toolBar, BorderLayout.NORTH); internalFrame.setSize(dimension); internalFrame.setLocation(0, 0); internalFrame.setBorder(null); internalFrame.setVisible(true); ((javax.swing.plaf.basic.BasicInternalFrameUI) internalFrame.getUI()).setNorthPane(null); URL url = getClass().getResource("map.html"); File html = new File(url.getPath()); String htmlString = null; try { htmlString = FileUtils.readFileToString(html); } catch (IOException ex) { Logger.getLogger(UserInterface.class.getName()).log(Level.SEVERE, null, ex); } browser.loadHTML(htmlString); panelHeatmap.add(internalFrame); }
From source file:mondrian.gui.Workbench.java
private void openSchemaFrame(File file, boolean newFile) { try {//from ww w . ja v a 2 s .co m setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (!newFile) { // check if file not already open if (checkFileOpen(file)) { return; } // check if schema file exists if (!file.exists()) { JOptionPane.showMessageDialog(this, getResourceConverter().getFormattedString("workbench.open.schema.not.found", "{0} File not found.", file.getAbsolutePath()), getResourceConverter().getString("workbench.open.schema.not.found.title", "Alert"), JOptionPane.WARNING_MESSAGE); return; } // check if file is writable if (!file.canWrite()) { JOptionPane.showMessageDialog(this, getResourceConverter().getFormattedString("workbench.open.schema.not.writeable", "{0} is not writeable.", file.getAbsolutePath()), getResourceConverter().getString("workbench.open.schema.not.writeable.title", "Alert"), JOptionPane.WARNING_MESSAGE); return; } checkSchemaFile(file); } final JInternalFrame schemaFrame = new JInternalFrame(); schemaFrame.setTitle(getResourceConverter().getFormattedString("workbench.open.schema.title", "Schema - {0}", file.getName())); getNewJdbcMetadata(); schemaFrame.getContentPane().add(new SchemaExplorer(this, file, jdbcMetaData, newFile, schemaFrame)); String errorOpening = ((SchemaExplorer) schemaFrame.getContentPane().getComponent(0)).getErrMsg(); if (errorOpening != null) { JOptionPane.showMessageDialog(this, getResourceConverter().getFormattedString("workbench.open.schema.error", "Error opening schema - {0}.", errorOpening), getResourceConverter().getString("workbench.open.schema.error.title", "Error"), JOptionPane.ERROR_MESSAGE); schemaFrame.setClosed(true); return; } schemaFrame.setBounds(0, 0, 1000, 650); schemaFrame.setClosable(true); schemaFrame.setIconifiable(true); schemaFrame.setMaximizable(true); schemaFrame.setResizable(true); schemaFrame.setVisible(true); desktopPane.add(schemaFrame, javax.swing.JLayeredPane.DEFAULT_LAYER); schemaFrame.show(); schemaFrame.setMaximum(true); displayWarningOnFailedConnection(); final javax.swing.JMenuItem schemaMenuItem = new javax.swing.JMenuItem(); schemaMenuItem.setText(windowMenuMapIndex++ + " " + file.getName()); schemaMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { if (schemaFrame.isIcon()) { schemaFrame.setIcon(false); } else { schemaFrame.setSelected(true); } } catch (Exception ex) { LOGGER.error("schemaMenuItem", ex); } } }); windowMenu.add(schemaMenuItem, 0); windowMenu.setEnabled(true); windowMenu.add(jSeparator3, -1); windowMenu.add(cascadeMenuItem, -1); windowMenu.add(tileMenuItem, -1); windowMenu.add(minimizeMenuItem, -1); windowMenu.add(maximizeMenuItem, -1); windowMenu.add(closeAllMenuItem, -1); // add the file details in menu map schemaWindowMap.put(schemaFrame, schemaMenuItem); updateMDXCatalogList(); schemaFrame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); schemaFrame.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosing(InternalFrameEvent e) { if (schemaFrame.getContentPane().getComponent(0) instanceof SchemaExplorer) { SchemaExplorer se = (SchemaExplorer) schemaFrame.getContentPane().getComponent(0); int response = confirmFrameClose(schemaFrame, se); if (response == 3) { // not dirty if (se.isNewFile()) { se.getSchemaFile().delete(); } // default case for no save and not dirty schemaWindowMap.remove(schemaFrame); updateMDXCatalogList(); schemaFrame.dispose(); windowMenu.remove(schemaMenuItem); } } } }); schemaFrame.setFocusable(true); schemaFrame.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { if (schemaFrame.getContentPane().getComponent(0) instanceof SchemaExplorer) { SchemaExplorer se = (SchemaExplorer) schemaFrame.getContentPane().getComponent(0); // update view menu based on schemaframe who gained // focus viewXmlMenuItem.setSelected(se.isEditModeXML()); } } public void focusLost(FocusEvent e) { if (schemaFrame.getContentPane().getComponent(0) instanceof SchemaExplorer) { SchemaExplorer se = (SchemaExplorer) schemaFrame.getContentPane().getComponent(0); // update view menu based on viewXmlMenuItem.setSelected(se.isEditModeXML()); } } }); viewXmlMenuItem.setSelected(false); } catch (Exception ex) { LOGGER.error("openSchemaFrame", ex); } finally { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
From source file:org.docx4all.ui.main.WordMLEditor.java
public void createInternalFrame(FileObject f) { if (f == null) { return;// ww w. j a v a 2 s.co m } log.info(VFSUtils.getFriendlyName(f.getName().getURI())); JInternalFrame iframe = _iframeMap.get(f.getName().getURI()); if (iframe != null) { iframe.setVisible(true); } else { iframe = new JInternalFrame(f.getName().getBaseName(), true, true, true, true); iframe.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); iframe.addInternalFrameListener(_internalFrameListener); iframe.addInternalFrameListener(_toolbarStates); iframe.addPropertyChangeListener(WindowMenu.getInstance()); if (iframe.getUI() instanceof BasicInternalFrameUI) { BasicInternalFrameUI ui = (BasicInternalFrameUI) iframe.getUI(); javax.swing.JComponent northPane = ui.getNorthPane(); if (northPane == null) { // Happens on Mac OSX: Google for "osx java getNorthPane" // Fix is from it.businesslogic.ireport.gui.JMDIFrame javax.swing.plaf.basic.BasicInternalFrameUI aUI = new javax.swing.plaf.basic.BasicInternalFrameUI( iframe); iframe.setUI(aUI); // Try again ui = (BasicInternalFrameUI) iframe.getUI(); northPane = ((javax.swing.plaf.basic.BasicInternalFrameUI) ui).getNorthPane(); } northPane.addMouseMotionListener(_titleBarMouseListener); } JEditorPane editorView = createEditorView(f); JPanel panel = FxScriptUIHelper.getInstance().createEditorPanel(editorView); iframe.getContentPane().add(panel); iframe.pack(); _desktop.add(iframe); editorView.requestFocusInWindow(); editorView.select(0, 0); String filePath = f.getName().getURI(); iframe.putClientProperty(WordMLDocument.FILE_PATH_PROPERTY, filePath); _iframeMap.put(filePath, iframe); iframe.show(); } try { iframe.setSelected(true); iframe.setIcon(false); iframe.setMaximum(true); } catch (PropertyVetoException exc) { // do nothing } }
From source file:org.en.tealEye.guiMain.MainAppFrame.java
public void insertInternalFrame(ExtendedJPanelImpl name) { ExtendedJPanelImpl jPanelImpl;//from w w w . ja v a2 s . com try { jPanelImpl = name; panelMap.put(name.getName(), name); JInternalFrame jInternalFrame = new JInternalFrame(); jInternalFrame.setSize(400, 300); jInternalFrame.setName(jPanelImpl.getName()); jInternalFrame.setTitle(jPanelImpl.getTitle()); jInternalFrame.getContentPane().add(new JScrollPane(jPanelImpl)); jInternalFrame.setIconifiable(true); jInternalFrame.setMaximizable(true); jInternalFrame.setResizable(true); jInternalFrame.setClosable(true); jInternalFrame.addInternalFrameListener(windowController); frameMap.put(jInternalFrame.getName(), jInternalFrame); desktop.add(jInternalFrame); desktop.getDesktopManager().activateFrame(jInternalFrame); desktop.getDesktopManager().maximizeFrame(jInternalFrame); jInternalFrame.moveToFront(); jInternalFrame.setSelected(true); jInternalFrame.setVisible(true); jInternalFrame.validate(); activeFrameMenu.addFrameButton(jPanelImpl.getName()); menuController.setActiveFrameName(jInternalFrame.getName()); } catch (Exception e) { log.error("cannot open panel " + name, e); } }
From source file:org.giswater.controller.MenuController.java
private void openFrame(JInternalFrame frame) { try {/* w w w . jav a 2 s .co m*/ frame.setVisible(true); frame.setMaximum(true); } catch (PropertyVetoException e) { Utils.logError(e); } }
From source file:org.pentaho.reporting.engine.classic.demo.ancient.demo.layouts.internalframe.InternalFrameDemoFrame.java
/** * Handler method called by the preview action. This method should perform all operations to preview the report. *///from ww w . j a v a 2s . c o m protected void attemptPreview() { final JInternalFrame frame = findSelectedFrame(); if (frame == null) { return; } final Rectangle bounds = frame.getBounds(); final Container parent = frame.getParent(); final boolean visible = frame.isVisible(); final int layer = frame.getLayer(); // now print .. previewReport(frame); if (parent != null) { if (frame.getParent() != parent) { frame.getParent().remove(frame); parent.add(frame); } } frame.setBounds(bounds); frame.setVisible(visible); frame.setLayer(new Integer(layer)); }
From source file:org.renjin.desktop.MainFrame.java
public MainFrame() { super("Renjin"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JDesktopPane desktop = new JDesktopPane(); desktop.setBackground(new Color(171, 171, 171)); JInternalFrame internalFrame = new JInternalFrame("R Console", true, true, true, true); console = new JConsole(); internalFrame.add(console, BorderLayout.CENTER); internalFrame.setBounds(25, 25, 600, 300); internalFrame.setVisible(true); desktop.add(internalFrame);/*from www . j a v a 2s . co m*/ add(desktop, BorderLayout.CENTER); setSize(650, 450); setVisible(true); }
From source file:org.sintef.thingml.ThingMLPanel.java
public ThingMLPanel(Boolean ArduinoPlugin, final ObservableString transferBuf) { try {//from www. j a va 2 s . c o m this.setLayout(new BorderLayout()); jsyntaxpane.DefaultSyntaxKit.initKit(); jsyntaxpane.DefaultSyntaxKit.registerContentType("text/thingml", Class.forName("org.sintef.thingml.ThingMLJSyntaxKit").getName()); JScrollPane scrPane = new JScrollPane(codeEditor); codeEditor.setContentType("text/thingml; charset=UTF-8"); Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; reg.getExtensionToFactoryMap().put("thingml", new ThingmlResourceFactory()); //codeEditor.setBackground(Color.LIGHT_GRAY) JMenuBar menubar = new JMenuBar(); JInternalFrame menuframe = new JInternalFrame(); menuframe.setSize(getWidth(), getHeight()); menuframe.setJMenuBar(menubar); menuframe.setLayout(new BorderLayout()); menuframe.add(scrPane, BorderLayout.CENTER); if (!ArduinoPlugin) { try { this.transferBuf = transferBuf; EditorKit editorKit = codeEditor.getEditorKit(); JToolBar toolPane = new JToolBar(); ((ThingMLJSyntaxKit) editorKit).addToolBarActions(codeEditor, toolPane); menuframe.add(toolPane, BorderLayout.NORTH); } catch (Exception e) { if (ThingMLApp.debug) e.printStackTrace(); } } menuframe.setVisible(true); ((BasicInternalFrameUI) menuframe.getUI()).setNorthPane(null); menuframe.setBorder(BorderFactory.createEmptyBorder()); add(menuframe, BorderLayout.CENTER); if (!ArduinoPlugin) {//FIXME: Nicolas, avoid code duplication final ThingMLCompilerRegistry registry = ThingMLCompilerRegistry.getInstance(); JMenu newCompilersMenu = new JMenu("Compile to"); for (final String id : registry.getCompilerIds()) { JMenuItem item = new JMenuItem(id); ThingMLCompiler c = registry.createCompilerInstanceByName(id); if (c.getConnectorCompilers().size() > 0) { JMenu compilerMenu = new JMenu(c.getID()); newCompilersMenu.add(compilerMenu); compilerMenu.add(item); for (final Map.Entry<String, CfgExternalConnectorCompiler> connectorCompiler : c .getConnectorCompilers().entrySet()) { JMenuItem connectorMenu = new JMenuItem(connectorCompiler.getKey()); compilerMenu.add(connectorMenu); connectorMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ThingMLModel thingmlModel = ThingMLCompiler.loadModel(targetFile); for (Configuration cfg : ThingMLHelpers.allConfigurations(thingmlModel)) { final ThingMLCompiler compiler = registry.createCompilerInstanceByName(id); for (NetworkPlugin np : loadedPlugins) { if (np.getTargetedLanguages().contains(compiler.getID())) { compiler.addNetworkPlugin(np); } } for (SerializationPlugin sp : loadedSerPlugins) { if (sp.getTargetedLanguages().contains(compiler.getID())) { compiler.addSerializationPlugin(sp); } } compiler.setOutputDirectory(new File(System.getProperty("java.io.tmpdir") + "/ThingML_temp/" + cfg.getName())); compiler.compileConnector(connectorCompiler.getKey(), cfg); } } }); } } else { newCompilersMenu.add(item); } item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Input file : " + targetFile); if (targetFile == null) return; try { ThingMLModel thingmlModel = ThingMLCompiler.loadModel(targetFile); if (thingmlModel != null) { for (Configuration cfg : ThingMLHelpers.allConfigurations(thingmlModel)) { final ThingMLCompiler compiler = registry.createCompilerInstanceByName(id); for (NetworkPlugin np : loadedPlugins) { if (np.getTargetedLanguages().contains(compiler.getID())) { compiler.addNetworkPlugin(np); } } for (SerializationPlugin sp : loadedSerPlugins) { if (sp.getTargetedLanguages().contains(compiler.getID())) { compiler.addSerializationPlugin(sp); } } compiler.setOutputDirectory(new File(System.getProperty("java.io.tmpdir") + "/ThingML_temp/" + cfg.getName())); compiler.compile(cfg); } } } catch (Exception ex) { if (ThingMLApp.debug) ex.printStackTrace(); } } }); c = null; } menubar.add(newCompilersMenu); } else { final ThingMLCompilerRegistry registry = ThingMLCompilerRegistry.getInstance(); JMenu newCompilersMenu = new JMenu("Compile to"); for (final String id : registry.getCompilerIds()) { if (id.compareToIgnoreCase("arduino") == 0) { JMenuItem item = new JMenuItem(id); ThingMLCompiler c = registry.createCompilerInstanceByName(id); if (c.getConnectorCompilers().size() > 0) { JMenu compilerMenu = new JMenu(c.getID()); newCompilersMenu.add(compilerMenu); compilerMenu.add(item); for (final Map.Entry<String, CfgExternalConnectorCompiler> connectorCompiler : c .getConnectorCompilers().entrySet()) { JMenuItem connectorMenu = new JMenuItem(connectorCompiler.getKey()); compilerMenu.add(connectorMenu); connectorMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ThingMLModel thingmlModel = ThingMLCompiler.loadModel(targetFile); for (Configuration cfg : ThingMLHelpers.allConfigurations(thingmlModel)) { final ThingMLCompiler compiler = registry .createCompilerInstanceByName(id); for (NetworkPlugin np : loadedPlugins) { if (np.getTargetedLanguages().contains(compiler.getID())) { compiler.addNetworkPlugin(np); } } for (SerializationPlugin sp : loadedSerPlugins) { if (sp.getTargetedLanguages().contains(compiler.getID())) { compiler.addSerializationPlugin(sp); } } compiler.setOutputDirectory( new File(System.getProperty("java.io.tmpdir") + "/ThingML_temp/" + cfg.getName())); compiler.compileConnector(connectorCompiler.getKey(), cfg); } } }); } } else { newCompilersMenu.add(item); } item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Input file : " + targetFile); if (targetFile == null) return; try { ThingMLModel thingmlModel = ThingMLCompiler.loadModel(targetFile); for (Configuration cfg : ThingMLHelpers.allConfigurations(thingmlModel)) { final ThingMLCompiler compiler = registry.createCompilerInstanceByName(id); for (NetworkPlugin np : loadedPlugins) { if (np.getTargetedLanguages().contains(compiler.getID())) { compiler.addNetworkPlugin(np); } } for (SerializationPlugin sp : loadedSerPlugins) { if (sp.getTargetedLanguages().contains(compiler.getID())) { compiler.addSerializationPlugin(sp); } } File myFileBuf = new File(System.getProperty("java.io.tmpdir") + "/ThingML_temp/" + cfg.getName()); compiler.setOutputDirectory(myFileBuf); compiler.compile(cfg); final InputStream input = new FileInputStream(myFileBuf.getAbsolutePath() + "/" + cfg.getName() + "/" + cfg.getName() + ".pde"); //System.out.println("tmp file: " + myFileBuf.getAbsolutePath() + "/" + cfg.getName() + "/" + cfg.getName() + ".pde"); //final InputStream input = new FileInputStream(myFileBuf); String result = null; try { if (input != null) { result = org.apache.commons.io.IOUtils.toString(input); input.close(); transferBuf.setString(result); transferBuf.hasChanged(); transferBuf.notifyObservers(); } else { //System.out.println("WHY"); } } catch (Exception exce) { if (ThingMLApp.debug) System.out.println("OH REALLY?"); } } } catch (Exception ex) { if (ThingMLApp.debug) ex.printStackTrace(); } } }); c = null; } } menubar.add(newCompilersMenu); } codeEditor.getDocument().addDocumentListener(new DocumentListener() { public void removeUpdate(DocumentEvent e) { lastUpdate.set(System.currentTimeMillis()); checkNeeded.set(true); } public void insertUpdate(DocumentEvent e) { lastUpdate.set(System.currentTimeMillis()); checkNeeded.set(true); } public void changedUpdate(DocumentEvent e) { lastUpdate.set(System.currentTimeMillis()); checkNeeded.set(true); } }); java.util.Timer timer = new Timer(); timer.scheduleAtFixedRate(new SeamlessNotification(), 250, 250); } catch (Exception e) { if (ThingMLApp.debug) e.printStackTrace(); } }