List of usage examples for javax.swing JInternalFrame setVisible
@BeanProperty(hidden = true, visualUpdate = true) public void setVisible(boolean aFlag)
From source file:KjellDirdalNotepad.java
public Component add(JInternalFrame frame) { JInternalFrame[] array = getAllFrames(); Point p;/*from w w w .j a va 2 s.c om*/ int w; int h; Component retval = super.add(frame); checkDesktopSize(); if (array.length > 0) { p = array[0].getLocation(); p.x = p.x + FRAME_OFFSET; p.y = p.y + FRAME_OFFSET; } else { p = new Point(0, 0); } frame.setLocation(p.x, p.y); if (frame.isResizable()) { w = getWidth() - (getWidth() / 3); h = getHeight() - (getHeight() / 3); if (w < frame.getMinimumSize().getWidth()) w = (int) frame.getMinimumSize().getWidth(); if (h < frame.getMinimumSize().getHeight()) h = (int) frame.getMinimumSize().getHeight(); frame.setSize(w, h); } moveToFront(frame); frame.setVisible(true); try { frame.setSelected(true); } catch (PropertyVetoException e) { frame.toBack(); } return retval; }
From source file:com.opendoorlogistics.studio.AppFrame.java
@Override public void addInternalFrame(JInternalFrame frame, FramePlacement placement) { desktopPane.add(frame);/*from w w w .j a va 2s .com*/ frame.pack(); frame.setVisible(true); // if(ScriptEditor.class.isInstance(frame)){ // try { // frame.setMaximum(true); // } catch (PropertyVetoException e) { // } // } // else{ // WindowState state = PreferencesManager.getSingleton().getWindowState(frame) if (placement == FramePlacement.AUTOMATIC) { boolean placed = false; if (ODLInternalFrame.class.isInstance(frame)) { ODLInternalFrame odlFrame = (ODLInternalFrame) frame; placed = odlFrame.placeInLastPosition(desktopScrollPane.getViewport().getBounds()); } if (!placed) { LayoutUtils.placeInternalFrame(desktopPane, frame); } } else if (placement == FramePlacement.CENTRAL) { Dimension desktopSize = desktopPane.getSize(); Dimension frameSize = frame.getSize(); int x = (desktopSize.width - frameSize.width) / 2; int y = (desktopSize.height - frameSize.height) / 2; frame.setLocation(x, y); } else if (placement == FramePlacement.CENTRAL_RANDOMISED) { Dimension desktopSize = desktopPane.getSize(); Dimension frameSize = frame.getSize(); Dimension remaining = new Dimension(Math.max(0, desktopSize.width - frameSize.width), Math.max(0, desktopSize.height - frameSize.height)); Dimension halfRemaining = new Dimension(remaining.width / 2, remaining.height / 2); Random random = new Random(); int x = remaining.width / 4 + random.nextInt(halfRemaining.width); int y = remaining.height / 4 + random.nextInt(halfRemaining.height); frame.setLocation(x, y); } frame.toFront(); }
From source file:com.opendoorlogistics.studio.AppFrame.java
JComponent launchTableGrid(int tableId) { if (loaded != null) { for (JInternalFrame frame : desktopPane.getAllFrames()) { if (ODLGridFrame.class.isInstance(frame) && ((ODLGridFrame) frame).getTableId() == tableId) { frame.setVisible(true); frame.moveToFront();/*from ww w . j a va2 s .co m*/ try { frame.setMaximum(true); } catch (Throwable e) { throw new RuntimeException(e); } // if not within visible areas, then recentre? return frame; } } ODLTableDefinition table = loaded.getDs().getTableByImmutableId(tableId); if (table != null) { ODLGridFrame gf = new ODLGridFrame(loaded.getDs(), table.getImmutableId(), true, null, loaded.getDs(), this); addInternalFrame(gf, FramePlacement.AUTOMATIC); return gf; } } return null; }
From source file:com.opendoorlogistics.studio.AppFrame.java
void launchTableSchemaEditor(int tableId) { if (loaded != null) { for (JInternalFrame frame : desktopPane.getAllFrames()) { if (TableSchemaEditor.class.isInstance(frame) && ((TableSchemaEditor) frame).getTableId() == tableId) { frame.setVisible(true); frame.moveToFront();/*from w w w. ja v a2 s. c o m*/ try { frame.setMaximum(true); } catch (Throwable e) { throw new RuntimeException(e); } return; } } TableSchemaEditor gf = new TableSchemaEditor(loaded.getDs(), tableId); addInternalFrame(gf, FramePlacement.AUTOMATIC); } }
From source file:com.moss.bdbadmin.client.ui.BdbAdminClient.java
private void showInDialog(String title, Component ancestor) { // final JDialog dialog; // if (ancestor instanceof JFrame) { // dialog = new JDialog((JFrame)ancestor); // }/*from w ww .j a va 2s . c o m*/ // else if (ancestor instanceof JDialog) { // dialog = new JDialog((JDialog)ancestor); // } // else if (ancestor == null) { // dialog = new JDialog(); // } // else { // throw new RuntimeException(); // } JInternalFrame dialog = new JInternalFrame(title); // dialog.setTitle(client.url() + dbPath); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // dialog.setModal(false); dialog.getContentPane().add(ancestor); dialog.setSize(400, 300); // dialog.setLocationRelativeTo(ancestor); dialog.setResizable(true); dialog.setClosable(true); dialog.setIconifiable(true); dialog.setMaximizable(true); getDesktopPane().add(dialog); try { dialog.setMaximum(true); } catch (PropertyVetoException e) { e.printStackTrace(); } dialog.setVisible(true); }
From source file:com.igormaznitsa.jhexed.swing.editor.ui.MainForm.java
protected JInternalFrame createFrame() { JInternalFrame frame = new JInternalFrame("Some frame"); frame.setBounds(30, 30, 300, 300);/*from w ww . jav a2 s. c om*/ frame.setTitle("Some frame"); frame.setVisible(true); return frame; }
From source file:flow.visibility.pcap.FlowProcess.java
/** function to create internal frame contain flow sequence */ public static JInternalFrame FlowSequence() { final StringBuilder errbuf = new StringBuilder(); // For any error msgs final String file = "tmp-capture-file.pcap"; //System.out.printf("Opening file for reading: %s%n", file); /*************************************************************************** * Second we open up the selected file using openOffline call **************************************************************************/ Pcap pcap = Pcap.openOffline(file, errbuf); if (pcap == null) { System.err.printf("Error while opening device for capture: " + errbuf.toString()); }//from w w w .jav a2s . c om /** create blank internal frame */ JInternalFrame FlowSequence = new JInternalFrame("Flow Sequence", true, true, true, true); FlowSequence.setBounds(601, 0, 600, 660); JTextArea textArea3 = new JTextArea(50, 10); PrintStream printStream3 = new PrintStream(new CustomOutputStream(textArea3)); System.setOut(printStream3); System.setErr(printStream3); JScrollPane scrollPane3 = new JScrollPane(textArea3); FlowSequence.add(scrollPane3); /** Process to print the packet one by one */ JPacketHandler<String> jpacketHandler = new JPacketHandler<String>() { public void nextPacket(JPacket packet, String user) { final JCaptureHeader header = packet.getCaptureHeader(); Timestamp timestamp = new Timestamp(header.timestampInMillis()); Tcp tcp = new Tcp(); Udp udp = new Udp(); Icmp icmp = new Icmp(); Ip4 ip4 = new Ip4(); Ethernet ethernet = new Ethernet(); /** For IP Packet */ if (packet.hasHeader(ip4)) { if (packet.hasHeader(tcp)) { System.out.println(timestamp.toString() + " : [TCP] : " + FormatUtils.ip(ip4.source()) + ":" + tcp.source() + "->" + FormatUtils.ip(ip4.destination()) + ":" + tcp.destination()); } if (packet.hasHeader(udp)) { System.out.println(timestamp.toString() + " : [UDP] : " + FormatUtils.ip(ip4.source()) + ":" + udp.source() + "->" + FormatUtils.ip(ip4.destination()) + ":" + udp.destination()); } if (packet.hasHeader(icmp)) { System.out.println(timestamp.toString() + " : [ICMP] : " + FormatUtils.ip(ip4.source()) + "->" + FormatUtils.ip(ip4.destination()) + ":" + icmp.type()); } } /** For Ethernet Packet */ else if (packet.hasHeader(ethernet)) { System.out.println(timestamp.toString() + " : [ETH] : " + FormatUtils.mac(ethernet.source()) + "->" + FormatUtils.mac(ethernet.destination()) + ":" + ethernet.type()); } } }; Pcap pcap4 = Pcap.openOffline(file, errbuf); /** Redirect the Output into Frame Text Area */ FlowSequence.setVisible(true); pcap4.loop(Pcap.LOOP_INFINITE, jpacketHandler, null); FlowSequence.revalidate(); pcap4.close(); return FlowSequence; }
From source file:mondrian.gui.Workbench.java
private void newQueryMenuItemActionPerformed(ActionEvent evt) { JMenuItem schemaMenuItem = schemaWindowMap.get(desktopPane.getSelectedFrame()); final JInternalFrame jf = new JInternalFrame(); jf.setTitle(getResourceConverter().getString("workbench.new.MDXQuery.title", "MDX Query")); QueryPanel qp = new QueryPanel(this); jf.getContentPane().add(qp);//from ww w. j av a 2 s. c o m jf.setBounds(0, 0, 500, 480); jf.setClosable(true); jf.setIconifiable(true); jf.setMaximizable(true); jf.setResizable(true); jf.setVisible(true); desktopPane.add(jf); jf.show(); try { jf.setSelected(true); } catch (Exception ex) { // do nothing LOGGER.error("newQueryMenuItemActionPerformed.setSelected", ex); } // add the mdx frame to this set of mdx frames for cascading method mdxWindows.add(jf); // create mdx menu item final javax.swing.JMenuItem queryMenuItem = new javax.swing.JMenuItem(); queryMenuItem.setText(getResourceConverter().getFormattedString("workbench.new.MDXQuery.menuitem", "{0} MDX", Integer.toString(windowMenuMapIndex))); queryMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { if (jf.isIcon()) { jf.setIcon(false); } else { jf.setSelected(true); } } catch (Exception ex) { LOGGER.error("queryMenuItem", ex); } } }); // disable mdx frame close operation to provide our handler // to remove frame object from mdxframeset before closing jf.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); jf.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosing(InternalFrameEvent e) { mdxWindows.remove(jf); jf.dispose(); // follow this by removing file from schemaWindowMap windowMenu.remove(queryMenuItem); return; } }); windowMenu.add(queryMenuItem, -1); windowMenu.add(jSeparator3, -1); windowMenu.add(cascadeMenuItem, -1); windowMenu.add(tileMenuItem, -1); windowMenu.add(minimizeMenuItem, -1); windowMenu.add(maximizeMenuItem, -1); windowMenu.add(closeAllMenuItem, -1); qp.setMenuItem(queryMenuItem); qp.setSchemaWindowMap(schemaWindowMap); qp.setWindowMenuIndex(windowMenuMapIndex++); if (schemaMenuItem != null) { qp.initConnection(schemaMenuItem.getText()); } else { JOptionPane.showMessageDialog(this, getResourceConverter().getString("workbench.new.MDXQuery.no.selection", "No Mondrian connection. Select a Schema to connect."), getResourceConverter().getString("workbench.new.MDXQuery.no.selection.title", "Alert"), JOptionPane.WARNING_MESSAGE); } }
From source file:mondrian.gui.Workbench.java
private void aboutMenuItemActionPerformed(ActionEvent evt) { try {//from w w w . j a va2 s . c o m JEditorPane jEditorPane = new JEditorPane( myClassLoader.getResource(getResourceConverter().getGUIReference("version")).toString()); jEditorPane.setEditable(false); JScrollPane jScrollPane = new JScrollPane(jEditorPane); JPanel jPanel = new JPanel(); jPanel.setLayout(new java.awt.BorderLayout()); jPanel.add(jScrollPane, java.awt.BorderLayout.CENTER); JInternalFrame jf = new JInternalFrame(); jf.setTitle("About"); jf.getContentPane().add(jPanel); Dimension screenSize = this.getSize(); int aboutW = 400; int aboutH = 300; int width = (screenSize.width / 2) - (aboutW / 2); int height = (screenSize.height / 2) - (aboutH / 2) - 100; jf.setBounds(width, height, aboutW, aboutH); jf.setClosable(true); desktopPane.add(jf); jf.setVisible(true); jf.show(); } catch (Exception ex) { LOGGER.error("aboutMenuItemActionPerformed", ex); } }
From source file:mondrian.gui.Workbench.java
private void newJDBCExplorerMenuItemActionPerformed(ActionEvent evt) { try {/* ww w.j ava 2s.com*/ if (jdbcMetaData == null) { getNewJdbcMetadata(); } final JInternalFrame jf = new JInternalFrame(); jf.setTitle(getResourceConverter().getFormattedString("workbench.new.JDBCExplorer.title", "JDBC Explorer - {0} {1}", jdbcMetaData.getDatabaseProductName(), jdbcMetaData.getJdbcConnectionUrl())); getNewJdbcMetadata(); JdbcExplorer jdbce = new JdbcExplorer(jdbcMetaData, this); jf.getContentPane().add(jdbce); jf.setBounds(0, 0, 500, 480); jf.setClosable(true); jf.setIconifiable(true); jf.setMaximizable(true); jf.setResizable(true); jf.setVisible(true); // create jdbc menu item final javax.swing.JMenuItem jdbcMenuItem = new javax.swing.JMenuItem(); jdbcMenuItem.setText(getResourceConverter().getFormattedString("workbench.new.JDBCExplorer.menuitem", "{0} JDBC Explorer", Integer.toString(windowMenuMapIndex++))); jdbcMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { if (jf.isIcon()) { jf.setIcon(false); } else { jf.setSelected(true); } } catch (Exception ex) { LOGGER.error("queryMenuItem", ex); } } }); jf.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosing(InternalFrameEvent e) { jdbcWindows.remove(jf); jf.dispose(); // follow this by removing file from schemaWindowMap windowMenu.remove(jdbcMenuItem); return; } }); desktopPane.add(jf); jf.setVisible(true); jf.show(); try { jf.setSelected(true); } catch (Exception ex) { // do nothing LOGGER.error("newJDBCExplorerMenuItemActionPerformed.setSelected", ex); } jdbcWindows.add(jf); windowMenu.add(jdbcMenuItem, -1); windowMenu.add(jSeparator3, -1); windowMenu.add(cascadeMenuItem, -1); windowMenu.add(tileMenuItem, -1); windowMenu.add(minimizeMenuItem, -1); windowMenu.add(maximizeMenuItem, -1); windowMenu.add(closeAllMenuItem, -1); } catch (Exception ex) { JOptionPane.showMessageDialog(this, getResourceConverter().getFormattedString("workbench.new.JDBCExplorer.exception", "Database connection not successful.\n{0}", ex.getLocalizedMessage()), getResourceConverter().getString("workbench.new.JDBCExplorer.exception.title", "Database Connection Error"), JOptionPane.ERROR_MESSAGE); LOGGER.error("newJDBCExplorerMenuItemActionPerformed", ex); } }