List of usage examples for javax.swing JInternalFrame JInternalFrame
public JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable)
JInternalFrame
with the specified title, resizability, closability, maximizability, and iconifiability. From source file:events.InternalFrameEventDemo.java
public void actionPerformed(ActionEvent e) { if (SHOW.equals(e.getActionCommand())) { //They clicked the Show button. //Create the internal frame if necessary. if (listenedToWindow == null) { listenedToWindow = new JInternalFrame("Event Generator", true, //resizable true, //closable true, //maximizable true); //iconifiable //We want to reuse the internal frame, so we need to //make it hide (instead of being disposed of, which is //the default) when the user closes it. listenedToWindow.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); //Add an internal frame listener so we can see //what internal frame events it generates. listenedToWindow.addInternalFrameListener(this); //And we mustn't forget to add it to the desktop pane! desktop.add(listenedToWindow); //Set its size and location. We'd use pack() to set the size //if the window contained anything. listenedToWindow.setSize(300, 100); listenedToWindow.setLocation(desktopWidth / 2 - listenedToWindow.getWidth() / 2, desktopHeight - listenedToWindow.getHeight()); }/*from w w w . j av a2 s .co m*/ //Show the internal frame. listenedToWindow.setVisible(true); } else { //They clicked the Clear button. display.setText(""); } }
From source file:flow.visibility.pcap.FlowProcess.java
/** function to create internal frame contain flow details */ public static JInternalFrame FlowInspection() { 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.j av a2s .com*/ /** create blank internal frame */ JInternalFrame FlowInspection = new JInternalFrame("Flow Inspection", true, true, true, true); FlowInspection.setBounds(601, 0, 600, 660); JTextArea textArea2 = new JTextArea(50, 10); PrintStream printStream2 = new PrintStream(new CustomOutputStream(textArea2)); System.setOut(printStream2); System.setErr(printStream2); JScrollPane scrollPane2 = new JScrollPane(textArea2); FlowInspection.add(scrollPane2); JPacketHandler<String> jpacketHandler = new JPacketHandler<String>() { public void nextPacket(JPacket packet, String user) { final JCaptureHeader header = packet.getCaptureHeader(); System.out.printf("========================= Next Packet ===============================\n"); System.out.printf("Packet caplen=%d wirelen=%d\n", header.caplen(), header.wirelen()); System.out.println(packet.toString()); } }; Pcap pcap3 = Pcap.openOffline(file, errbuf); /** Redirect Output into the Frame Text Area */ FlowInspection.setVisible(true); pcap3.loop(Pcap.LOOP_INFINITE, jpacketHandler, null); FlowInspection.revalidate(); pcap3.close(); return FlowInspection; }
From source file:InternalFrameEventDemo.java
public void actionPerformed(ActionEvent e) { if (SHOW.equals(e.getActionCommand())) { // They clicked the Show button. // Create the internal frame if necessary. if (listenedToWindow == null) { listenedToWindow = new JInternalFrame("Event Generator", true, // resizable true, // closable true, // maximizable true); // iconifiable // We want to reuse the internal frame, so we need to // make it hide (instead of being disposed of, which is // the default) when the user closes it. listenedToWindow.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); // Add an internal frame listener so we can see // what internal frame events it generates. listenedToWindow.addInternalFrameListener(this); // And we mustn't forget to add it to the desktop pane! desktop.add(listenedToWindow); // Set its size and location. We'd use pack() to set the size // if the window contained anything. listenedToWindow.setSize(300, 100); listenedToWindow.setLocation(desktopWidth / 2 - listenedToWindow.getWidth() / 2, desktopHeight - listenedToWindow.getHeight()); }//from w w w . j av a 2 s.co m // Show the internal frame. listenedToWindow.setVisible(true); } else { // They clicked the Clear button. display.setText(""); } }
From source file:Controlador.ControladorLecturas.java
public JInternalFrame graficoHumedadSuelo() { DefaultCategoryDataset defaultCategoryDataset = new DefaultCategoryDataset(); for (Object row : vectorHumedadSuelo()) { int grados = Integer.parseInt(((Vector) row).elementAt(0).toString()); String rowKey = "Sensor 1"; String columnKey = ((Vector) row).elementAt(1).toString(); defaultCategoryDataset.addValue(grados, rowKey, columnKey); }/*from ww w . j a v a 2 s.c o m*/ JFreeChart jFreeChart = ChartFactory.createLineChart(null, "Hora", "Humedad", defaultCategoryDataset, PlotOrientation.VERTICAL, true, true, true); ChartPanel chartPanel = new ChartPanel(jFreeChart); JInternalFrame jInternalFrame = new JInternalFrame("Grafico de Humedad del Suelo", true, true, true, true); jInternalFrame.add(chartPanel, BorderLayout.CENTER); jInternalFrame.pack(); return jInternalFrame; }
From source file:InternalFrameEventDemo.java
public void actionPerformed(ActionEvent e) { if (SHOW.equals(e.getActionCommand())) { //They clicked the Show button. //Create the internal frame if necessary. if (listenedToWindow == null) { listenedToWindow = new JInternalFrame("Event Generator", true, //resizable true, //closable true, //maximizable true); //iconifiable //We want to reuse the internal frame, so we need to //make it hide (instead of being disposed of, which is //the default) when the user closes it. listenedToWindow.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); //Add an internal frame listener so we can see //what internal frame events it generates. listenedToWindow.addInternalFrameListener(this); //And we mustn't forget to add it to the desktop pane! desktop.add(listenedToWindow); //Set its size and location. We'd use pack() to set the size //if the window contained anything. listenedToWindow.setSize(300, 100); listenedToWindow.setLocation(desktopWidth / 2 - listenedToWindow.getWidth() / 2, desktopHeight - listenedToWindow.getHeight()); }/*w w w . j av a 2 s. c o m*/ //Show the internal frame. listenedToWindow.setVisible(true); } else { //They clicked the Clear button. display.setText(""); } }
From source file:de.codesourcery.jasm16.ide.ui.viewcontainers.Perspective.java
@Override public IView addView(final IView view) { if (view == null) { throw new IllegalArgumentException("view must not be NULL"); }//from w w w. j a va 2 s . c o m final JInternalFrame internalFrame = new JInternalFrame(view.getTitle(), true, true, true, true); internalFrame.setBackground(Color.BLACK); internalFrame.setForeground(Color.GREEN); internalFrame.getContentPane().add(view.getPanel(this)); SizeAndLocation sizeAndLoc = applicationConfig.getViewCoordinates(getUniqueID(view)); if (sizeAndLoc != null) { internalFrame.setSize(sizeAndLoc.getSize()); internalFrame.setLocation(sizeAndLoc.getLocation()); } else { internalFrame.setSize(200, 150); internalFrame.setLocation(0, 0); internalFrame.pack(); } internalFrame.setVisible(true); final InternalFrameWithView frameAndView = new InternalFrameWithView(internalFrame, view); final InternalFrameListener listener = new InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent e) { disposeView(view); } }; internalFrame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE); internalFrame.addInternalFrameListener(listener); views.add(frameAndView); desktop.add(internalFrame); return view; }
From source file:fr.crnan.videso3d.ihm.PLNSPanel.java
private void addChart(JFreeChart chart) { ChartPanel panel = new ChartPanel(chart); chartPanels.add(panel);/*from w w w .j av a 2s . c o m*/ JInternalFrame frame = new JInternalFrame(chart.getTitle().getText(), true, false, true, true); frame.add(panel); frame.pack(); frame.setVisible(true); desktop.add(frame); desktop.tile(true); if (chartMouseListener != null) { panel.addChartMouseListener(chartMouseListener); } }
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 ww .j a v a 2 s .c o m*/ /** 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:neg.JRViewerFactura.java
private void iniciarComponentes(final String nombre, final BeanCorreoCliente mail, int flag) { java.awt.GridBagConstraints gridBagConstraints; tlbToolBar = new javax.swing.JPanel(); btnSave = new javax.swing.JButton(); btnPrint = new javax.swing.JButton(); btnReload = new javax.swing.JButton(); pnlSep01 = new javax.swing.JPanel(); btnFirst = new javax.swing.JButton(); btnPrevious = new javax.swing.JButton(); btnNext = new javax.swing.JButton(); btnLast = new javax.swing.JButton(); txtGoTo = new javax.swing.JTextField(); pnlSep02 = new javax.swing.JPanel(); btnActualSize = new javax.swing.JToggleButton(); btnFitPage = new javax.swing.JToggleButton(); btnFitWidth = new javax.swing.JToggleButton(); pnlSep03 = new javax.swing.JPanel(); btnZoomIn = new javax.swing.JButton(); btnZoomOut = new javax.swing.JButton(); cmbZoom = new javax.swing.JComboBox(); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (int i = 0; i < zooms.length; i++) { model.addElement("" + zooms[i] + "%"); }/*ww w . ja v a 2s . c om*/ cmbZoom.setModel(model); jButton1 = new javax.swing.JButton(); pnlMain = new javax.swing.JPanel(); scrollPane = new javax.swing.JScrollPane(); scrollPane.getHorizontalScrollBar().setUnitIncrement(5); scrollPane.getVerticalScrollBar().setUnitIncrement(5); pnlInScroll = new javax.swing.JPanel(); pnlPage = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); pnlLinks = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); lblPage = new PageRenderer(this); pnlStatus = new javax.swing.JPanel(); lblStatus = new javax.swing.JLabel(); setMinimumSize(new java.awt.Dimension(450, 150)); setPreferredSize(new java.awt.Dimension(450, 150)); setLayout(new java.awt.BorderLayout()); tlbToolBar.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 2)); btnSave.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/save.GIF"))); // NOI18N btnSave.setToolTipText(getBundleString("save")); btnSave.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnSave.setMaximumSize(new java.awt.Dimension(23, 23)); btnSave.setMinimumSize(new java.awt.Dimension(23, 23)); btnSave.setPreferredSize(new java.awt.Dimension(23, 23)); btnSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveActionPerformed(evt, nombre); } }); tlbToolBar.add(btnSave); btnPrint.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/print.GIF"))); // NOI18N btnPrint.setToolTipText(getBundleString("print")); btnPrint.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrint.setMaximumSize(new java.awt.Dimension(23, 23)); btnPrint.setMinimumSize(new java.awt.Dimension(23, 23)); btnPrint.setPreferredSize(new java.awt.Dimension(23, 23)); btnPrint.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPrintActionPerformed(evt); } }); tlbToolBar.add(btnPrint); if (flag == 0) { btnReload.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/mail.gif"))); // NOI18N btnReload.setToolTipText("Email"); btnReload.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnReload.setMaximumSize(new java.awt.Dimension(23, 23)); btnReload.setMinimumSize(new java.awt.Dimension(23, 23)); btnReload.setPreferredSize(new java.awt.Dimension(23, 23)); btnReload.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnReloadActionPerformed(evt); } private void btnReloadActionPerformed(ActionEvent evt) { Cliente finalCliente = new Cliente(); BeanCliente datosCl = new BeanCliente(); datosCl = finalCliente.getDatosFacturaCliente(finalCliente.getClienteID(mail.getCliente())); //Comprobamos si se tienen que enviar la factura por email o correo ordinario if (datosCl.getCorreo() == 1) { JLabel errorFields = new JLabel("Las facturas para el cliente " + datosCl.getNombre() + " se envan mediante correo ordinario "); JOptionPane.showMessageDialog(null, errorFields); } else { String query = "SELECT cc_nombre,cc_email FROM cc_contactos_cliente where cl_id =" + finalCliente.getClienteID(mail.getCliente()); CSDesktop.BuscaMailCliente = new JInternalFrame("Seleccionar Mail Cliente", true, false, false, true); // adjuntar panel al panel de contenido del marco interno CSSelectMailClienteFactura panel = new CSSelectMailClienteFactura(query, mail, nombre); CSDesktop.BuscaMailCliente.getContentPane().add(panel, BorderLayout.CENTER); // establecer tamao de marco interno en el tamao de su contenido CSDesktop.BuscaMailCliente.pack(); // adjuntar marco interno al escritorio y mostrarlo CSDesktop.elEscritorio.add(CSDesktop.BuscaMailCliente); CSDesktop.BuscaMailCliente.setLocation(150, 50); CSDesktop.BuscaMailCliente.setVisible(true); } } }); btnReload.setEnabled(true); tlbToolBar.add(btnReload); } pnlSep01.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep01); btnFirst.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/first.GIF"))); // NOI18N btnFirst.setToolTipText(getBundleString("first.page")); btnFirst.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFirst.setMaximumSize(new java.awt.Dimension(23, 23)); btnFirst.setMinimumSize(new java.awt.Dimension(23, 23)); btnFirst.setPreferredSize(new java.awt.Dimension(23, 23)); btnFirst.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFirstActionPerformed(evt); } }); tlbToolBar.add(btnFirst); btnPrevious.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/previous.GIF"))); // NOI18N btnPrevious.setToolTipText(getBundleString("previous.page")); btnPrevious.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrevious.setMaximumSize(new java.awt.Dimension(23, 23)); btnPrevious.setMinimumSize(new java.awt.Dimension(23, 23)); btnPrevious.setPreferredSize(new java.awt.Dimension(23, 23)); btnPrevious.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPreviousActionPerformed(evt); } }); tlbToolBar.add(btnPrevious); btnNext.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/next.GIF"))); // NOI18N btnNext.setToolTipText(getBundleString("next.page")); btnNext.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnNext.setMaximumSize(new java.awt.Dimension(23, 23)); btnNext.setMinimumSize(new java.awt.Dimension(23, 23)); btnNext.setPreferredSize(new java.awt.Dimension(23, 23)); btnNext.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNextActionPerformed(evt); } }); tlbToolBar.add(btnNext); btnLast.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/last.GIF"))); // NOI18N btnLast.setToolTipText(getBundleString("last.page")); btnLast.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnLast.setMaximumSize(new java.awt.Dimension(23, 23)); btnLast.setMinimumSize(new java.awt.Dimension(23, 23)); btnLast.setPreferredSize(new java.awt.Dimension(23, 23)); btnLast.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLastActionPerformed(evt); } }); tlbToolBar.add(btnLast); txtGoTo.setToolTipText(getBundleString("go.to.page")); txtGoTo.setMaximumSize(new java.awt.Dimension(40, 23)); txtGoTo.setMinimumSize(new java.awt.Dimension(40, 23)); txtGoTo.setPreferredSize(new java.awt.Dimension(40, 23)); txtGoTo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtGoToActionPerformed(evt); } }); tlbToolBar.add(txtGoTo); pnlSep02.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep02); btnActualSize.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/actualsize.GIF"))); // NOI18N btnActualSize.setToolTipText(getBundleString("actual.size")); btnActualSize.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnActualSize.setMaximumSize(new java.awt.Dimension(23, 23)); btnActualSize.setMinimumSize(new java.awt.Dimension(23, 23)); btnActualSize.setPreferredSize(new java.awt.Dimension(23, 23)); btnActualSize.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnActualSizeActionPerformed(evt); } }); tlbToolBar.add(btnActualSize); btnFitPage.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/fitpage.GIF"))); // NOI18N btnFitPage.setToolTipText(getBundleString("fit.page")); btnFitPage.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFitPage.setMaximumSize(new java.awt.Dimension(23, 23)); btnFitPage.setMinimumSize(new java.awt.Dimension(23, 23)); btnFitPage.setPreferredSize(new java.awt.Dimension(23, 23)); btnFitPage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitPageActionPerformed(evt); } }); tlbToolBar.add(btnFitPage); btnFitWidth.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/fitwidth.GIF"))); // NOI18N btnFitWidth.setToolTipText(getBundleString("fit.width")); btnFitWidth.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFitWidth.setMaximumSize(new java.awt.Dimension(23, 23)); btnFitWidth.setMinimumSize(new java.awt.Dimension(23, 23)); btnFitWidth.setPreferredSize(new java.awt.Dimension(23, 23)); btnFitWidth.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitWidthActionPerformed(evt); } }); tlbToolBar.add(btnFitWidth); pnlSep03.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep03); btnZoomIn.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomin.GIF"))); // NOI18N btnZoomIn.setToolTipText(getBundleString("zoom.in")); btnZoomIn.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnZoomIn.setMaximumSize(new java.awt.Dimension(23, 23)); btnZoomIn.setMinimumSize(new java.awt.Dimension(23, 23)); btnZoomIn.setPreferredSize(new java.awt.Dimension(23, 23)); btnZoomIn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomInActionPerformed(evt); } }); tlbToolBar.add(btnZoomIn); btnZoomOut.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomout.GIF"))); // NOI18N btnZoomOut.setToolTipText(getBundleString("zoom.out")); btnZoomOut.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnZoomOut.setMaximumSize(new java.awt.Dimension(23, 23)); btnZoomOut.setMinimumSize(new java.awt.Dimension(23, 23)); btnZoomOut.setPreferredSize(new java.awt.Dimension(23, 23)); btnZoomOut.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomOutActionPerformed(evt); } }); tlbToolBar.add(btnZoomOut); cmbZoom.setEditable(true); cmbZoom.setToolTipText(getBundleString("zoom.ratio")); cmbZoom.setMaximumSize(new java.awt.Dimension(80, 23)); cmbZoom.setMinimumSize(new java.awt.Dimension(80, 23)); cmbZoom.setPreferredSize(new java.awt.Dimension(80, 23)); cmbZoom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbZoomActionPerformed(evt); } }); cmbZoom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { cmbZoomItemStateChanged(evt); } }); tlbToolBar.add(cmbZoom); jButton1.setForeground(new java.awt.Color(255, 0, 0)); jButton1.setText("Cancelar"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); tlbToolBar.add(jButton1); add(tlbToolBar, java.awt.BorderLayout.NORTH); pnlMain.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { pnlMainComponentResized(evt); } }); pnlMain.setLayout(new java.awt.BorderLayout()); scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); pnlInScroll.setLayout(new java.awt.GridBagLayout()); pnlPage.setMinimumSize(new java.awt.Dimension(100, 100)); pnlPage.setPreferredSize(new java.awt.Dimension(100, 100)); pnlPage.setLayout(new java.awt.BorderLayout()); jPanel4.setMinimumSize(new java.awt.Dimension(100, 120)); jPanel4.setPreferredSize(new java.awt.Dimension(100, 120)); jPanel4.setLayout(new java.awt.GridBagLayout()); pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5)); pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5)); pnlLinks.setOpaque(false); pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { pnlLinksMousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { pnlLinksMouseReleased(evt); } }); pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { pnlLinksMouseDragged(evt); } }); pnlLinks.setLayout(null); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; jPanel4.add(pnlLinks, gridBagConstraints); jPanel5.setBackground(java.awt.Color.gray); jPanel5.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel5.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; jPanel4.add(jPanel5, gridBagConstraints); jPanel6.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel6.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; jPanel4.add(jPanel6, gridBagConstraints); jPanel7.setBackground(java.awt.Color.gray); jPanel7.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel7.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel4.add(jPanel7, gridBagConstraints); jPanel8.setBackground(java.awt.Color.gray); jPanel8.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel8.setPreferredSize(new java.awt.Dimension(5, 5)); jLabel1.setText("jLabel1"); jPanel8.add(jLabel1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; jPanel4.add(jPanel8, gridBagConstraints); jPanel9.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel9.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; jPanel4.add(jPanel9, gridBagConstraints); lblPage.setBackground(java.awt.Color.white); lblPage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); lblPage.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel4.add(lblPage, gridBagConstraints); pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); pnlInScroll.add(pnlPage, gridBagConstraints); scrollPane.setViewportView(pnlInScroll); pnlMain.add(scrollPane, java.awt.BorderLayout.CENTER); add(pnlMain, java.awt.BorderLayout.CENTER); pnlStatus.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 0)); lblStatus.setFont(new java.awt.Font("Dialog", 1, 10)); lblStatus.setText("Page i of n"); pnlStatus.add(lblStatus); add(pnlStatus, java.awt.BorderLayout.SOUTH); }
From source file:org.docx4all.ui.main.WordMLEditor.java
public void createInternalFrame(FileObject f) { if (f == null) { return;// w ww. j a v a 2 s.c om } 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 } }