Example usage for javax.swing JFrame setJMenuBar

List of usage examples for javax.swing JFrame setJMenuBar

Introduction

In this page you can find the example usage for javax.swing JFrame setJMenuBar.

Prototype

@BeanProperty(bound = false, hidden = true, description = "The menubar for accessing pulldown menus from this frame.")
public void setJMenuBar(final JMenuBar menubar) 

Source Link

Document

Sets the menubar for this frame.

Usage

From source file:com.jidesoft.spring.richclient.docking.JideApplicationWindow.java

/**
  * Overrides the applyStandardLayout by removing the 
  * setting of the layout manager and the insertion of
  * the center part of the frame. The JIDE docking framework
  * actually sets these, via the DefaultDockableHolder.
  *//* w  w w. jav  a  2  s .  c  o m*/
@Override
protected void applyStandardLayout(JFrame windowControl, ApplicationWindowConfigurer configurer) {
    this.logger.info("Applying standard layout");
    windowControl.setTitle(configurer.getTitle());
    windowControl.setIconImage(configurer.getImage());
    windowControl.setJMenuBar(createMenuBarControl());
    windowControl.getContentPane().add(createToolBarControl(), BorderLayout.NORTH);
    //windowControl.getContentPane().add(createStatusBarControl(), BorderLayout.SOUTH);
}

From source file:net.brtly.monkeyboard.gui.MasterControlPanel.java

public MasterControlPanel(JFrame frame) {
    _frame = frame;/*  w w w . j  a  v  a 2  s.  c o m*/
    initWindowListener(frame);

    JMenuBar menuBar = new JMenuBar();
    frame.setJMenuBar(menuBar);

    JMenu mnActions = new JMenu("Actions");
    menuBar.add(mnActions);

    JMenu mnDebug = new JMenu("Debug");
    mnActions.add(mnDebug);

    JMenuItem mntmAddPluginpanel = new JMenuItem("Request null PluginPanel");
    mntmAddPluginpanel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            System.out.println("Requesting null PluginPanel");
            // TODO
        }
    });
    mnDebug.add(mntmAddPluginpanel);

    JMenu mnOptions = new JMenu("Options");
    menuBar.add(mnOptions);

    _viewMenu = new JMenu("Views");

    _viewMenu.addMenuListener(new MenuListener() {

        @Override
        public void menuCanceled(MenuEvent arg0) {
        }

        @Override
        public void menuDeselected(MenuEvent arg0) {
        }

        @Override
        public void menuSelected(MenuEvent arg0) {
            updateViewMenu();
        }

    });
    menuBar.add(_viewMenu);

    // INITIALIZE MANAGERS
    // TODO: maybe call this in the Runnable and fire an event when finished
    _eventBus = new SwingEventBus();
    _eventBus.register(this);
    DeviceManager.init(_eventBus);

    _pluginManager = new PluginManager(_eventBus);
    _pluginManager.loadPlugins();

    // create the status bar panel and shove it down the bottom of the frame
    statusPanel = new StatusBar(frame);
    _frame.getContentPane().add(statusPanel, BorderLayout.SOUTH);

    _dockController = new CControl(frame);
    _frame.getContentPane().add(_dockController.getContentArea(), BorderLayout.CENTER);
    _panelFactory = new PluginPanelDockableFactory(_pluginManager);
    _dockController.addMultipleDockableFactory(PluginPanelDockableFactory.ID, _panelFactory);
    _dockController.createWorkingArea("root");

    updateViewMenu();

    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            DeviceManager.start(null);
        }
    });

    _runOnClose.add(new Runnable() {
        public void run() {
            _dockController.destroy();
            DeviceManager.stop();
            DeviceManager.shutdown();
            System.exit(0);
        }
    });
}

From source file:jgraph.JShow.java

/**
 * a driver for this demo//  www . ja va 2  s  .co m
 */
@SuppressWarnings("serial")
public static void showtest(DirectedOrderedSparseMultigraph<Object, Object> graph) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    final JShow demo = new JShow(graph);

    JMenu menu = new JMenu("Snapshot");
    menu.add(new AbstractAction("To JPEG") {
        public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            int option = chooser.showSaveDialog(demo);
            if (option == JFileChooser.APPROVE_OPTION) {
                File file = chooser.getSelectedFile();
                demo.writeJPEGImage(file);
            }
        }
    });
    menu.add(new AbstractAction("Print") {
        public void actionPerformed(ActionEvent e) {
            PrinterJob printJob = PrinterJob.getPrinterJob();
            printJob.setPrintable(demo);
            if (printJob.printDialog()) {
                try {
                    printJob.print();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
    });
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    JMenuBar menuBar = new JMenuBar();
    menuBar.add(menu);
    frame.setJMenuBar(menuBar);
    frame.getContentPane().add(demo);
    frame.pack();
    frame.setVisible(true);
}

From source file:misc.TextBatchPrintingDemo.java

/**
 * Create and display the main application frame.
 *///  ww  w  . j  av  a2 s  .  c om
void createAndShowGUI() {
    messageArea = new JLabel(defaultMessage);

    selectedPages = new JList(new DefaultListModel());
    selectedPages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    selectedPages.addListSelectionListener(this);

    setPage(homePage);

    JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(pageItem),
            new JScrollPane(selectedPages));

    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);

    /** Menu item and keyboard shortcuts for the "add page" command.  */
    fileMenu.add(createMenuItem(new AbstractAction("Add Page") {
        public void actionPerformed(ActionEvent e) {
            DefaultListModel pages = (DefaultListModel) selectedPages.getModel();
            pages.addElement(pageItem);
            selectedPages.setSelectedIndex(pages.getSize() - 1);
        }
    }, KeyEvent.VK_A, KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.ALT_MASK)));

    /** Menu item and keyboard shortcuts for the "print selected" command.*/
    fileMenu.add(createMenuItem(new AbstractAction("Print Selected") {
        public void actionPerformed(ActionEvent e) {
            printSelectedPages();
        }
    }, KeyEvent.VK_P, KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.ALT_MASK)));

    /** Menu item and keyboard shortcuts for the "clear selected" command.*/
    fileMenu.add(createMenuItem(new AbstractAction("Clear Selected") {
        public void actionPerformed(ActionEvent e) {
            DefaultListModel pages = (DefaultListModel) selectedPages.getModel();
            pages.removeAllElements();
        }
    }, KeyEvent.VK_C, KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.ALT_MASK)));

    fileMenu.addSeparator();

    /** Menu item and keyboard shortcuts for the "home page" command.  */
    fileMenu.add(createMenuItem(new AbstractAction("Home Page") {
        public void actionPerformed(ActionEvent e) {
            setPage(homePage);
        }
    }, KeyEvent.VK_H, KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK)));

    /** Menu item and keyboard shortcuts for the "quit" command.  */
    fileMenu.add(createMenuItem(new AbstractAction("Quit") {
        public void actionPerformed(ActionEvent e) {
            for (Window w : Window.getWindows()) {
                w.dispose();
            }
        }
    }, KeyEvent.VK_A, KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK)));

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);

    JPanel contentPane = new JPanel();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    contentPane.add(pane);
    contentPane.add(messageArea);

    JFrame frame = new JFrame("Text Batch Printing Demo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setJMenuBar(menuBar);
    frame.setContentPane(contentPane);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    if (printService == null) {
        // Actual printing is not possible, issue a warning message.
        JOptionPane.showMessageDialog(frame, "No default print service", "Print Service Alert",
                JOptionPane.WARNING_MESSAGE);
    }
}

From source file:Main.java

Main() {
    JFrame f = new JFrame("Menu Demo");
    f.setSize(220, 200);/*from w ww . ja v a2s  .  co  m*/

    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar jmb = new JMenuBar();

    JMenu jmFile = new JMenu("File");
    JMenuItem jmiOpen = new JMenuItem("Open");
    JMenuItem jmiClose = new JMenuItem("Close");
    JMenuItem jmiSave = new JMenuItem("Save");
    JMenuItem jmiExit = new JMenuItem("Exit");
    jmFile.add(jmiOpen);
    jmFile.add(jmiClose);
    jmFile.add(jmiSave);
    jmFile.addSeparator();
    jmFile.add(jmiExit);
    jmb.add(jmFile);

    JMenu jmOptions = new JMenu("Options");
    JMenu a = new JMenu("A");
    JMenuItem b = new JMenuItem("B");
    JMenuItem c = new JMenuItem("C");
    JMenuItem d = new JMenuItem("D");
    a.add(b);
    a.add(c);
    a.add(d);
    jmOptions.add(a);

    JMenu e = new JMenu("E");
    e.add(new JMenuItem("F"));
    e.add(new JMenuItem("G"));
    jmOptions.add(e);

    jmb.add(jmOptions);

    JMenu jmHelp = new JMenu("Help");
    JMenuItem jmiAbout = new JMenuItem("About");
    jmHelp.add(jmiAbout);
    jmb.add(jmHelp);

    jmiOpen.addActionListener(this);
    jmiClose.addActionListener(this);
    jmiSave.addActionListener(this);
    jmiExit.addActionListener(this);
    b.addActionListener(this);
    c.addActionListener(this);
    d.addActionListener(this);
    jmiAbout.addActionListener(this);

    f.setJMenuBar(jmb);
    f.setVisible(true);
}

From source file:com.moss.bdbadmin.client.ui.BdbAdminClient.java

public BdbAdminClient(HttpClient httpClient, JFrame window, File configPath, ProxyFactory proxyFactory) {

    this.httpClient = httpClient;
    this.ancestor = window;
    this.configPath = configPath;
    this.proxyFactory = proxyFactory;

    try {/* w  ww .j a v a2 s.  c  o  m*/
        configJaxbContext = JAXBContext.newInstance(ServiceConfig.class);
    } catch (JAXBException ex) {
        throw new RuntimeException(ex);
    }

    JMenuItem newServiceItem = new JMenuItem("New Service");
    newServiceItem.setAction(new NewServiceAction());

    JMenu fileMenu = new JMenu("File");
    fileMenu.add(newServiceItem);

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);

    window.setJMenuBar(menuBar);
    window.setIconImage(new ImageIcon(this.getClass().getClassLoader().getResource("service.gif")).getImage());

    this.root = new DefaultMutableTreeNode();
    this.model = new DefaultTreeModel(root);
    getTree().setModel(model);
    getTree().setShowsRootHandles(true);
    getTree().setRootVisible(false);
    getTree().setCellRenderer(new Renderer());
    getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    getTree().getSelectionModel().addTreeSelectionListener(new SelectionListener());
    getTree().addMouseListener(new ContextMenuHandler());

    addAncestorListener(new AncestorListener() {
        public void ancestorAdded(AncestorEvent event) {
            loadConfig();
        }

        public void ancestorMoved(AncestorEvent event) {
        }

        public void ancestorRemoved(AncestorEvent event) {
        }
    });
}

From source file:com.diversityarrays.kdxplore.curate.TrialDataEditor.java

private JFrame addGraphOrPlotPanel(DesktopObject dobj) {
    JFrame frame = windowOpener.addDesktopObject(dobj);
    JMenuBar mbar = new JMenuBar();
    frame.setJMenuBar(getJMenuBar());
    toolFrames.add(frame);//from  w  ww.j ava 2  s.  c  om

    frame.addWindowListener(plotTitleUncounter);

    Dimension size = this.getSize();
    size.width = Math.max(size.width / 2, 640);
    size.height = Math.max(size.height / 2, 640);
    frame.setSize(size);
    frame.setLocationRelativeTo(null);

    windowsMenuManager.addWindow(frame, dobj.getTitle());
    refreshToolAll();
    return frame;
}

From source file:edu.ku.brc.specify.tools.l10nios.StrLocalizerAppForiOS.java

/**
 * @param frame//from www .ja  va  2  s . c  o m
 */
public void addMenuBar(final JFrame frame) {
    this.frame = frame;

    JMenuBar menuBar = new JMenuBar();

    JMenu fileMenu = new JMenu(getResourceString("FILE"));

    JMenuItem chooseFileItem = new JMenuItem(getResourceString("StrLocalizerApp.ChooseFileMenu"));
    fileMenu.add(chooseFileItem);

    chooseFileItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            doChooseFile();
        }
    });

    JMenuItem saveItem = new JMenuItem(getResourceString("SAVE"));
    fileMenu.add(saveItem);

    saveItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            doSave();
        }
    });

    if (!UIHelper.isMacOS()) {
        fileMenu.addSeparator();
        JMenuItem exitMenu = new JMenuItem(getResourceString("EXIT"));
        exitMenu.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                doExit(checkForChanges());
            }
        });

        fileMenu.add(exitMenu);
    }
    menuBar.add(fileMenu);

    JMenu scanMenu = new JMenu(getResourceString("Scan"));
    menuBar.add(scanMenu);

    scanMI = new JMenuItem(getResourceString("Source Code"));
    scanMenu.add(scanMI);

    scanMI.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            scanSources();
        }
    });

    JMenu transMenu = new JMenu(getResourceString("StrLocalizerApp.Translate"));
    menuBar.add(transMenu);

    startTransMenuItem = new JMenuItem(getResourceString("StrLocalizerApp.Start"));
    transMenu.add(startTransMenuItem);

    startTransMenuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            translateNewItems();
        }
    });
    transMenu.setVisible(false);

    stopTransMenuItem = new JMenuItem(getResourceString("Stop"));
    transMenu.add(stopTransMenuItem);

    stopTransMenuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            contTrans.set(false);
        }
    });
    stopTransMenuItem.setEnabled(false);

    frame.setJMenuBar(menuBar);

    setTopWindow(frame);

    register(FRAME, frame);
}

From source file:levelBuilder.DialogMaker.java

/**
 * Various routines necessary for displaying graph.
 *///ww  w  .j  a  v  a2  s. co m
private static void displayGraph() {
    JFrame frame = new JFrame("Dialog Maker");
    layout = new KKLayout<DialogNode, Double>(g);
    VisualizationViewer<DialogNode, Double> vv = new VisualizationViewer<DialogNode, Double>(layout);
    layout.setSize(new Dimension(windowWidth, windowHeight));
    vv.setPreferredSize(new Dimension(windowWidth, windowHeight));

    //Changes fields in node properties window when a node is selected
    pickedState = vv.getPickedVertexState();
    pickedState.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            Object subject = e.getItem();
            if (subject instanceof DialogNode) {
                selectedNode = (DialogNode) subject;
                textField.setText(selectedNode.getText());
                npcBox.setSelected(selectedNode.getIsNPC());
                String working = "";
                for (int c = 0; c < selectedNode.getChildren().length; c++) {
                    if (c == 0)
                        working += selectedNode.getChildren()[c].getText();
                    else
                        working += "," + selectedNode.getChildren()[c].getText();
                }
                if (working.equals("null"))
                    working = "";
                childrenField.setText(working.replace("]", "").replace("[", ""));
                working = Arrays.toString(selectedNode.getProbSets().get(strategy));
                if (working.equals("null"))
                    working = "";
                probSetField.setText(working.replace("]", "").replace("[", "").replace(" ", ""));
            }
        }
    });

    //Colors vertices according to 'initial', 'end', or 'middle' status.
    vv.getRenderContext().setVertexFillPaintTransformer(new Transformer<DialogNode, Paint>() {
        @Override
        public Paint transform(DialogNode n) {
            if (n.getText().equals("initial"))
                return new Color(100, 255, 100);
            if (n.getChildren().length == 0)
                return new Color(255, 100, 100);
            return new Color(100, 100, 255);
        }
    });

    //Labels vertices with node text.
    vv.getRenderContext().setVertexLabelTransformer(new Transformer<DialogNode, String>() {
        @Override
        public String transform(DialogNode n) {
            return n.getText().split(" ")[0];
        }

    });

    //Draws shape of vertices according to player or non-player status.
    vv.getRenderContext().setVertexShapeTransformer(new Transformer<DialogNode, Shape>() {
        @Override
        public Shape transform(DialogNode n) {
            if (n.getIsNPC())
                return new Rectangle(-15, -15, 30, 30);
            else
                return new Ellipse2D.Double(-15.0, -15.0, 30.0, 30.0);
        }

    });

    //Labels edges with probability of child being selected under the current strategy.
    vv.getRenderContext().setEdgeLabelTransformer(new Transformer<Double, String>() {
        @Override
        public String transform(Double e) {
            DialogNode source = g.getSource(e);
            if (source.getProbSets().size() > 0)
                for (int c = 0; c < source.getChildren().length; c++)
                    if (source.getChildren()[c].equals(g.getDest(e))) {
                        if (source.getProbSets().get(strategy) != null)
                            return Double.toString(source.getProbSets().get(strategy)[c]);
                        else //If node does not have probSet for that strategy, default to strategy 0.
                            return Double.toString(source.getProbSets().get(0)[c]);
                    }
            return null;
        }
    });
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);

    //Routines for editing mode.
    EditingModalGraphMouse<DialogNode, Double> gm = new EditingModalGraphMouse<DialogNode, Double>(
            vv.getRenderContext(),
            //Runs when a new node is created.
            new Factory<DialogNode>() {
                @Override
                public DialogNode create() {
                    DialogNode n = new DialogNode(isNPCBoxChecked, textField.getText(),
                            new ArrayList<double[]>(), new DialogNode[0]);
                    dg.addNode(n);
                    return n;
                }
            },
            //Runs when a new edge is created.
            new Factory<Double>() {
                @Override
                public Double create() {
                    addedEdgeID = Math.random();
                    return addedEdgeID;
                }
            });
    vv.setGraphMouse(gm);

    //Frame and mode menu.
    JMenuBar menuBar = new JMenuBar();
    JMenu modeMenu = gm.getModeMenu();
    modeMenu.setText("Mouse Mode");
    modeMenu.setIcon(null);
    modeMenu.setPreferredSize(new Dimension(100, 20));
    menuBar.add(modeMenu);
    frame.setJMenuBar(menuBar);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(vv);
    frame.pack();
    frame.setVisible(true);

    //      //Sets position of each node.
    //      for (DialogNode n : nodeMap.values()) {
    //         Point2D.Double point = new Point2D.Double(n.getX(), n.getY());
    //         if (point.x != 0.0 && point.y != 0.0)
    //            layout.setLocation(n, point);
    //      }
}

From source file:direccion.Reportes.java

public Reportes() {

    String titulo = "Reportes";
    jFrame = new JFrame(titulo);
    jFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    jFrame.setSize(800, 600);//from w w  w  . ja  v a2s  .com

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int x = (screenSize.width / 2) - (jFrame.getSize().width / 2);
    int y = (screenSize.height / 2) - (jFrame.getSize().height / 2);
    jFrame.setLocation(x, y);

    JLabel etiqueta = new JLabel("Reportes");
    etiqueta.setBounds(300, 25, 200, 50);
    etiqueta.setFont(new Font("Verdana", Font.BOLD, 30));
    etiqueta.setForeground(Color.BLACK);

    JMenuBar jMenuBar = new JMenuBar();

    JMenu acceso = new JMenu("Acceso a");
    JMenu ayuda = new JMenu("Ayuda");

    JMenuItem rec_hum = new JMenuItem("Recursos Humanos");
    JMenuItem conta = new JMenuItem("Contabilidad");
    JMenuItem ventas = new JMenuItem("Ventas");
    JMenuItem compras = new JMenuItem("Compras");
    JMenuItem inventario = new JMenuItem("Inventario");

    JMenuItem acerca_de = new JMenuItem("Acerca de");
    acerca_de.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(null, "Ayuda", "Ayuda", 3);
        }
    });

    acceso.add(rec_hum);
    acceso.add(conta);
    acceso.add(ventas);
    acceso.add(compras);
    acceso.add(inventario);

    ayuda.add(acerca_de);

    jMenuBar.add(acceso);
    jMenuBar.add(ayuda);

    JCalendar cal1 = new JCalendar();
    cal1.setBounds(250, 150, 400, 300);
    JCalendarCombo cal2 = new JCalendarCombo();
    cal2.setBounds(250, 150, 400, 300);

    String reportes[] = { "Mantenimiento", "Compras", "Ventas", "Inventario", "Contabilidad",
            "Recursos Humanos" };
    JComboBox combobox = new JComboBox(reportes);
    combobox.setBounds(300, 100, 150, 30);

    JLabel calendario = new JLabel("Fecha de Operacin:");
    calendario.setBounds(60, 150, 150, 30);

    JButton aceptar = new JButton("Aceptar");
    aceptar.setBounds(50, 200, 150, 30);
    aceptar.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            if (combobox.getSelectedIndex() == 0) {

                datos_mantenimiento.setValue("Recursos Humanos", d_mant_rh);
                datos_mantenimiento.setValue("Contabilidad", d_mant_cont);
                datos_mantenimiento.setValue("Ventas", d_mant_vent);
                datos_mantenimiento.setValue("Compras", d_mant_comp);
                datos_mantenimiento.setValue("Inventario", d_mant_inv);
                datos_mantenimiento.setValue("Mantenimiento", d_mant_mant);

                Grafica = ChartFactory.createPieChart3D("Mantenimiento", datos_mantenimiento, true, true, true);

                ChartPanel panel_grafica = new ChartPanel(Grafica);
                JFrame frame_grafica = new JFrame("Grfico");

                JMenuBar menu = new JMenuBar();
                JMenu archivo = new JMenu("Archivo");
                JMenuItem guardar = new JMenuItem("Guardar como reporte...");
                guardar.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        Document document = new Document();
                        PdfWriter writer = null;
                        try {
                            writer = PdfWriter.getInstance(document,
                                    new FileOutputStream("Grfico Mantenimiento.pdf"));
                        } catch (DocumentException ex) {
                            Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (FileNotFoundException ex) {
                            Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex);
                        }

                        document.open();
                        PdfContentByte cb = writer.getDirectContent();
                        PdfTemplate tp = cb.createTemplate(450, 450);
                        Graphics2D g2 = tp.createGraphicsShapes(450, 450);
                        menu.setVisible(false);
                        frame_grafica.print(g2);
                        menu.setVisible(true);
                        g2.dispose();
                        cb.addTemplate(tp, 30, 400);
                        document.close();

                        HSSFWorkbook workbook = new HSSFWorkbook();
                        HSSFSheet sheet = workbook.createSheet("Reporte de Mantenimiento");

                        Row fila = sheet.createRow(0);
                        File archivo = new File("Reporte de Mantenimiento.xls");
                        Cell celda;

                        String[] titulos = { "Recursos Humanos", "Contabilidad", "Ventas", "Compras",
                                "Inventario", "Mantenimiento" };
                        Double[] datos = { d_mant_rh, d_mant_cont, d_mant_vent, d_mant_comp, d_mant_inv,
                                d_mant_mant };

                        int i;
                        for (i = 0; i < titulos.length; i++) {
                            celda = fila.createCell(i);
                            celda.setCellValue(titulos[i]);
                        }
                        fila = sheet.createRow(1);
                        for (i = 0; i < datos.length; i++) {
                            celda = fila.createCell(i);
                            celda.setCellValue(datos[i]);
                        }
                        try {
                            FileOutputStream out = new FileOutputStream(archivo);
                            workbook.write(out);
                            out.close();
                            System.out.println("Archivo creado exitosamente!");
                        } catch (IOException ex) {
                            System.out.println("Error de escritura");
                            ex.printStackTrace();
                        }
                    }
                });
                archivo.add(guardar);
                menu.add(archivo);
                frame_grafica.getContentPane().add(panel_grafica);
                frame_grafica.setBounds(60, 60, 450, 400);
                frame_grafica.setJMenuBar(menu);
                frame_grafica.setVisible(true);
                frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            }
            if (combobox.getSelectedIndex() == 1) {

                datos_compras.setValue("Nomina", d_comp_nom);
                datos_compras.setValue("Compras", d_comp_comp);
                datos_compras.setValue("Gastos Fijos", d_comp_gf);
                datos_compras.setValue("Gastos Variables", d_comp_gv);
                datos_compras.setValue("Gastos Otros", d_comp_go);

                Grafica = ChartFactory.createPieChart3D("Compras", datos_compras, true, true, true);

                ChartPanel panel_grafica = new ChartPanel(Grafica);
                JFrame frame_grafica = new JFrame("Grfico");

                JMenuBar menu = new JMenuBar();
                JMenu archivo = new JMenu("Archivo");
                JMenuItem guardar = new JMenuItem("Guardar como reporte...");
                guardar.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        Document document = new Document();
                        PdfWriter writer = null;
                        try {
                            writer = PdfWriter.getInstance(document,
                                    new FileOutputStream("Grfico Compras.pdf"));
                        } catch (DocumentException ex) {
                            Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (FileNotFoundException ex) {
                            Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex);
                        }

                        document.open();
                        menu.setVisible(false);
                        PdfContentByte cb = writer.getDirectContent();
                        PdfTemplate tp = cb.createTemplate(450, 450);
                        Graphics2D g2 = tp.createGraphicsShapes(850, 850);
                        menu.setVisible(false);
                        frame_grafica.print(g2);
                        menu.setVisible(true);
                        g2.dispose();
                        cb.addTemplate(tp, 30, 400);
                        document.close();

                        HSSFWorkbook workbook = new HSSFWorkbook();
                        HSSFSheet sheet = workbook.createSheet("Reporte de Compras");

                        Row fila = sheet.createRow(0);
                        File archivo = new File("Reporte de Compras.xls");
                        Cell celda;

                        String[] titulos = { "Nomina", "Compras", "Gastos Fijos", "Gastos Variables",
                                "Gastos Otros" };
                        Double[] datos = { d_comp_nom, d_comp_comp, d_comp_gf, d_comp_gv, d_comp_go };

                        int i;
                        for (i = 0; i < titulos.length; i++) {
                            celda = fila.createCell(i);
                            celda.setCellValue(titulos[i]);
                        }
                        fila = sheet.createRow(1);
                        for (i = 0; i < datos.length; i++) {
                            celda = fila.createCell(i);
                            celda.setCellValue(datos[i]);
                        }
                        try {
                            FileOutputStream out = new FileOutputStream(archivo);
                            workbook.write(out);
                            out.close();
                            System.out.println("Archivo creado exitosamente!");
                        } catch (IOException ex) {
                            System.out.println("Error de escritura");
                            ex.printStackTrace();
                        }
                    }
                });
                archivo.add(guardar);
                menu.add(archivo);
                frame_grafica.getContentPane().add(panel_grafica);
                frame_grafica.setBounds(60, 60, 450, 400);
                frame_grafica.setJMenuBar(menu);
                frame_grafica.setVisible(true);
                frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            }
            if (combobox.getSelectedIndex() == 2) {

                datos_ventas.addValue(d_vent_s1_lu, "Semana 1", "Lunes");
                datos_ventas.addValue(d_vent_s1_ma, "Semana 1", "Martes");
                datos_ventas.addValue(d_vent_s1_mi, "Semana 1", "Mircoles");
                datos_ventas.addValue(d_vent_s1_ju, "Semana 1", "Jueves");
                datos_ventas.addValue(d_vent_s1_vi, "Semana 1", "Viernes");
                datos_ventas.addValue(d_vent_s1_sa, "Semana 1", "Sbado");
                datos_ventas.addValue(d_vent_s1_do, "Semana 1", "Domingo");

                datos_ventas.addValue(d_vent_s2_lu, "Semana 2", "Lunes");
                datos_ventas.addValue(d_vent_s2_ma, "Semana 2", "Martes");
                datos_ventas.addValue(d_vent_s2_mi, "Semana 2", "Mircoles");
                datos_ventas.addValue(d_vent_s2_ju, "Semana 2", "Jueves");
                datos_ventas.addValue(d_vent_s2_vi, "Semana 2", "Viernes");
                datos_ventas.addValue(d_vent_s2_sa, "Semana 2", "Sbado");
                datos_ventas.addValue(d_vent_s2_do, "Semana 2", "Domingo");

                Grafica = ChartFactory.createLineChart3D("Ventas", "Das", "Ingresos", datos_ventas,
                        PlotOrientation.VERTICAL, true, true, false);

                ChartPanel panel_grafica = new ChartPanel(Grafica);
                JFrame frame_grafica = new JFrame("Grfico");

                JMenuBar menu = new JMenuBar();
                JMenu archivo = new JMenu("Archivo");
                JMenuItem guardar = new JMenuItem("Guardar como reporte...");
                guardar.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        Document document = new Document();
                        PdfWriter writer = null;
                        try {
                            writer = PdfWriter.getInstance(document,
                                    new FileOutputStream("Grfico Ventas.pdf"));
                        } catch (DocumentException ex) {
                            Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (FileNotFoundException ex) {
                            Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex);
                        }

                        document.open();
                        PdfContentByte cb = writer.getDirectContent();
                        PdfTemplate tp = cb.createTemplate(450, 450);
                        Graphics2D g2 = tp.createGraphicsShapes(450, 450);
                        menu.setVisible(false);
                        frame_grafica.print(g2);
                        menu.setVisible(true);
                        g2.dispose();
                        cb.addTemplate(tp, 30, 400);
                        document.close();

                        HSSFWorkbook workbook = new HSSFWorkbook();
                        HSSFSheet sheet = workbook.createSheet("Reporte de Ventas");

                        Row fila = sheet.createRow(0);
                        File archivo = new File("Reporte de Ventas.xls");
                        Cell celda;

                        String[] titulos1 = { "S1 lunes", "S1 martes", "S1 miercoles", "S1 jueves",
                                "S1 viernes", "S1 sabado", "S1 domingo" };
                        String[] titulos2 = { "S2 lunes", "S2 martes", "S2 miercoles", "S2 jueves",
                                "S2 viernes", "S2 sabado", "S2 domingo" };
                        Double[] datos1 = { d_vent_s1_lu, d_vent_s1_ma, d_vent_s1_mi, d_vent_s1_ju,
                                d_vent_s1_vi, d_vent_s1_sa, d_vent_s1_do };
                        Double[] datos2 = { d_vent_s2_lu, d_vent_s2_ma, d_vent_s2_mi, d_vent_s2_ju,
                                d_vent_s2_vi, d_vent_s2_sa, d_vent_s2_do };

                        int i, j;
                        for (i = 0; i < titulos1.length; i++) {
                            celda = fila.createCell(i);
                            celda.setCellValue(titulos1[i]);
                        }
                        fila = sheet.createRow(1);
                        for (i = 0; i < datos1.length; i++) {
                            celda = fila.createCell(i);
                            celda.setCellValue(datos1[i]);
                        }
                        fila = sheet.createRow(3);
                        for (j = 0; j < titulos2.length; j++) {
                            celda = fila.createCell(j);
                            celda.setCellValue(titulos2[j]);
                        }
                        fila = sheet.createRow(4);
                        for (j = 0; j < datos2.length; j++) {
                            celda = fila.createCell(j);
                            celda.setCellValue(datos2[j]);
                        }
                        try {
                            FileOutputStream out = new FileOutputStream(archivo);
                            workbook.write(out);
                            out.close();
                            System.out.println("Archivo creado exitosamente!");
                        } catch (IOException ex) {
                            System.out.println("Error de escritura");
                            ex.printStackTrace();
                        }
                    }
                });
                archivo.add(guardar);
                menu.add(archivo);
                frame_grafica.getContentPane().add(panel_grafica);
                frame_grafica.setBounds(60, 60, 450, 400);
                frame_grafica.setJMenuBar(menu);
                frame_grafica.setVisible(true);
                frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            }
            if (combobox.getSelectedIndex() == 3) {

                datos_inventario.setValue("Producto 1", d_inv_p1);
                datos_inventario.setValue("Producto 2", d_inv_p2);
                datos_inventario.setValue("Producto 3", d_inv_p3);
                datos_inventario.setValue("Producto 4", d_inv_p4);
                datos_inventario.setValue("Producto 5", d_inv_p5);

                Grafica = ChartFactory.createPieChart3D("Inventario", datos_inventario, true, true, true);

                ChartPanel panel_grafica = new ChartPanel(Grafica);
                JFrame frame_grafica = new JFrame("Grfico");

                JMenuBar menu = new JMenuBar();
                JMenu archivo = new JMenu("Archivo");
                JMenuItem guardar = new JMenuItem("Guardar como reporte...");
                guardar.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        Document document = new Document();
                        PdfWriter writer = null;
                        try {
                            writer = PdfWriter.getInstance(document,
                                    new FileOutputStream("Grfico Inventario.pdf"));
                        } catch (DocumentException ex) {
                            Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (FileNotFoundException ex) {
                            Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex);
                        }

                        document.open();
                        PdfContentByte cb = writer.getDirectContent();
                        PdfTemplate tp = cb.createTemplate(450, 450);
                        Graphics2D g2 = tp.createGraphicsShapes(450, 450);
                        menu.setVisible(false);
                        frame_grafica.print(g2);
                        menu.setVisible(true);
                        g2.dispose();
                        cb.addTemplate(tp, 30, 400);
                        document.close();

                        HSSFWorkbook workbook = new HSSFWorkbook();
                        HSSFSheet sheet = workbook.createSheet("Reporte de Inventario");

                        Row fila = sheet.createRow(0);
                        File archivo = new File("Reporte de Inventario.xls");
                        Cell celda;

                        String[] titulos = { "Producto 1", "Producto 2", "Prroducto 3", "Producto 4",
                                "Producto 5" };
                        Double[] datos = { d_inv_p1, d_inv_p2, d_inv_p3, d_inv_p4, d_inv_p5 };

                        int i;
                        for (i = 0; i < titulos.length; i++) {
                            celda = fila.createCell(i);
                            celda.setCellValue(titulos[i]);
                        }
                        fila = sheet.createRow(1);
                        for (i = 0; i < datos.length; i++) {
                            celda = fila.createCell(i);
                            celda.setCellValue(datos[i]);
                        }
                        try {
                            FileOutputStream out = new FileOutputStream(archivo);
                            workbook.write(out);
                            out.close();
                            System.out.println("Archivo creado exitosamente!");
                        } catch (IOException ex) {
                            System.out.println("Error de escritura");
                            ex.printStackTrace();
                        }
                    }
                });
                archivo.add(guardar);
                menu.add(archivo);
                frame_grafica.getContentPane().add(panel_grafica);
                frame_grafica.setBounds(60, 60, 450, 400);
                frame_grafica.setJMenuBar(menu);
                frame_grafica.setVisible(true);
                frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            }
            if (combobox.getSelectedIndex() == 4) {

                datos_contabilidad.addValue(d_cont_e_lu, "Entradas", "Lunes");
                datos_contabilidad.addValue(d_cont_e_ma, "Entradas", "Martes");
                datos_contabilidad.addValue(d_cont_e_mi, "Entradas", "Mircoles");
                datos_contabilidad.addValue(d_cont_e_ju, "Entradas", "Jueves");
                datos_contabilidad.addValue(d_cont_e_vi, "Entradas", "Viernes");
                datos_contabilidad.addValue(d_cont_e_sa, "Entradas", "Sbado");
                datos_contabilidad.addValue(d_cont_e_do, "Entradas", "Domingo");

                datos_contabilidad.addValue(d_cont_s_lu, "Salidas", "Lunes");
                datos_contabilidad.addValue(d_cont_s_ma, "Salidas", "Martes");
                datos_contabilidad.addValue(d_cont_s_mi, "Salidas", "Mircoles");
                datos_contabilidad.addValue(d_cont_s_ju, "Salidas", "Jueves");
                datos_contabilidad.addValue(d_cont_s_vi, "Salidas", "Viernes");
                datos_contabilidad.addValue(d_cont_s_sa, "Salidas", "Sbado");
                datos_contabilidad.addValue(d_cont_s_do, "Salidas", "Domingo");

                datos_contabilidad.addValue(d_cont_u_lu, "Utilidades", "Lunes");
                datos_contabilidad.addValue(d_cont_u_ma, "Utilidades", "Martes");
                datos_contabilidad.addValue(d_cont_u_mi, "Utilidades", "Mircoles");
                datos_contabilidad.addValue(d_cont_u_ju, "Utilidades", "Jueves");
                datos_contabilidad.addValue(d_cont_u_vi, "Utilidades", "Viernes");
                datos_contabilidad.addValue(d_cont_u_sa, "Utilidades", "Sbado");
                datos_contabilidad.addValue(d_cont_u_do, "Utilidades", "Domingo");

                Grafica = ChartFactory.createLineChart3D("Contabilidad", "Das", "Ingresos",
                        datos_contabilidad, PlotOrientation.VERTICAL, true, true, false);

                ChartPanel panel_grafica = new ChartPanel(Grafica);
                JFrame frame_grafica = new JFrame("Grfico");

                JMenuBar menu = new JMenuBar();
                JMenu archivo = new JMenu("Archivo");
                JMenuItem guardar = new JMenuItem("Guardar como reporte...");
                guardar.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        Document document = new Document();
                        PdfWriter writer = null;
                        try {
                            writer = PdfWriter.getInstance(document,
                                    new FileOutputStream("Grfico Contabilidad.pdf"));
                        } catch (DocumentException ex) {
                            Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (FileNotFoundException ex) {
                            Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex);
                        }

                        document.open();
                        PdfContentByte cb = writer.getDirectContent();
                        PdfTemplate tp = cb.createTemplate(450, 450);
                        Graphics2D g2 = tp.createGraphicsShapes(450, 450);
                        menu.setVisible(false);
                        frame_grafica.print(g2);
                        menu.setVisible(true);
                        g2.dispose();
                        cb.addTemplate(tp, 30, 400);
                        document.close();

                        HSSFWorkbook workbook = new HSSFWorkbook();
                        HSSFSheet sheet = workbook.createSheet("Reporte de Contabilidad");

                        Row fila = sheet.createRow(0);
                        File archivo = new File("Reporte de Contabilidad.xls");
                        Cell celda;

                        String[] t_ent = { "E lunes", "E martes", "E miercoles", "E jueves", "E viernes",
                                "E sabado", "E domingo" };
                        String[] t_sal = { "S lunes", "S martes", "S miercoles", "S jueves", "S viernes",
                                "S sabado", "S domingo" };
                        String[] t_uti = { "U lunes", "U martes", "U miercoles", "U jueves", "U viernes",
                                "U sabado", "U domingo" };
                        Double[] d_ent = { d_cont_e_lu, d_cont_e_ma, d_cont_e_mi, d_cont_e_ju, d_cont_e_vi,
                                d_cont_e_sa, d_cont_e_do };
                        Double[] d_sal = { d_cont_s_lu, d_cont_s_ma, d_cont_s_mi, d_cont_s_ju, d_cont_s_vi,
                                d_cont_s_sa, d_cont_s_do };
                        Double[] d_uti = { d_cont_u_lu, d_cont_u_ma, d_cont_u_mi, d_cont_u_ju, d_cont_u_vi,
                                d_cont_u_sa, d_cont_u_do };

                        int i, j, k;
                        for (i = 0; i < t_ent.length; i++) {
                            celda = fila.createCell(i);
                            celda.setCellValue(t_ent[i]);
                        }
                        fila = sheet.createRow(1);
                        for (i = 0; i < d_ent.length; i++) {
                            celda = fila.createCell(i);
                            celda.setCellValue(d_ent[i]);
                        }
                        fila = sheet.createRow(3);
                        for (j = 0; j < t_sal.length; j++) {
                            celda = fila.createCell(j);
                            celda.setCellValue(t_sal[j]);
                        }
                        fila = sheet.createRow(4);
                        for (j = 0; j < d_sal.length; j++) {
                            celda = fila.createCell(j);
                            celda.setCellValue(d_sal[j]);
                        }
                        fila = sheet.createRow(6);
                        for (k = 0; k < t_uti.length; k++) {
                            celda = fila.createCell(k);
                            celda.setCellValue(t_uti[k]);
                        }
                        fila = sheet.createRow(7);
                        for (k = 0; k < d_uti.length; k++) {
                            celda = fila.createCell(k);
                            celda.setCellValue(d_uti[k]);
                        }
                        try {
                            FileOutputStream out = new FileOutputStream(archivo);
                            workbook.write(out);
                            out.close();
                            System.out.println("Archivo creado exitosamente!");
                        } catch (IOException ex) {
                            System.out.println("Error de escritura");
                            ex.printStackTrace();
                        }
                    }
                });
                archivo.add(guardar);
                menu.add(archivo);
                frame_grafica.getContentPane().add(panel_grafica);
                frame_grafica.setBounds(60, 60, 450, 400);
                frame_grafica.setJMenuBar(menu);
                frame_grafica.setVisible(true);
                frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            }
            if (combobox.getSelectedIndex() == 5) {

                datos_rec_hum.addValue(d_rh_a_lu, "Asistencias", "Lunes");
                datos_rec_hum.addValue(d_rh_a_ma, "Asistencias", "Martes");
                datos_rec_hum.addValue(d_rh_a_mi, "Asistencias", "Mircoles");
                datos_rec_hum.addValue(d_rh_a_ju, "Asistencias", "Jueves");
                datos_rec_hum.addValue(d_rh_a_vi, "Asistencias", "Viernes");
                datos_rec_hum.addValue(d_rh_a_sa, "Asistencias", "Sbado");
                datos_rec_hum.addValue(d_rh_a_do, "Asistencias", "Domingo");

                datos_rec_hum.addValue(d_rh_r_lu, "Retardos", "Lunes");
                datos_rec_hum.addValue(d_rh_r_ma, "Retardos", "Martes");
                datos_rec_hum.addValue(d_rh_r_mi, "Retardos", "Mircoles");
                datos_rec_hum.addValue(d_rh_r_ju, "Retardos", "Jueves");
                datos_rec_hum.addValue(d_rh_r_vi, "Retardos", "Viernes");
                datos_rec_hum.addValue(d_rh_r_sa, "Retardos", "Sbado");
                datos_rec_hum.addValue(d_rh_r_do, "Retardos", "Domingo");

                datos_rec_hum.addValue(d_rh_f_lu, "Faltas", "Lunes");
                datos_rec_hum.addValue(d_rh_f_ma, "Faltas", "Martes");
                datos_rec_hum.addValue(d_rh_f_mi, "Faltas", "Mircoles");
                datos_rec_hum.addValue(d_rh_f_ju, "Faltas", "Jueves");
                datos_rec_hum.addValue(d_rh_f_vi, "Faltas", "Viernes");
                datos_rec_hum.addValue(d_rh_f_sa, "Faltas", "Sbado");
                datos_rec_hum.addValue(d_rh_f_do, "Faltas", "Domingo");

                Grafica = ChartFactory.createBarChart3D("Recursos Humanos", "Das", "Nmero de Empleados",
                        datos_rec_hum, PlotOrientation.VERTICAL, true, true, false);

                ChartPanel panel_grafica = new ChartPanel(Grafica);
                JFrame frame_grafica = new JFrame("Grfico");

                JMenuBar menu = new JMenuBar();
                JMenu archivo = new JMenu("Archivo");
                JMenuItem guardar = new JMenuItem("Guardar como reporte...");
                guardar.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        Document document = new Document();
                        PdfWriter writer = null;
                        try {
                            writer = PdfWriter.getInstance(document,
                                    new FileOutputStream("Grfico Recursos Humanos.pdf"));
                        } catch (DocumentException ex) {
                            Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (FileNotFoundException ex) {
                            Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex);
                        }

                        document.open();
                        PdfContentByte cb = writer.getDirectContent();
                        PdfTemplate tp = cb.createTemplate(450, 450);
                        Graphics2D g2 = tp.createGraphicsShapes(450, 450);
                        menu.setVisible(false);
                        frame_grafica.print(g2);
                        menu.setVisible(true);
                        g2.dispose();
                        cb.addTemplate(tp, 30, 400);
                        document.close();

                        HSSFWorkbook workbook = new HSSFWorkbook();
                        HSSFSheet sheet = workbook.createSheet("Reporte de Recursos Humanos");

                        Row fila = sheet.createRow(0);
                        File archivo = new File("Reporte de Recursos Humanos.xls");
                        Cell celda;

                        String[] t_asi = { "A lunes", "A martes", "A miercoles", "A jueves", "A viernes",
                                "A sabado", "A domingo" };
                        String[] t_ret = { "R lunes", "R martes", "R miercoles", "R jueves", "R viernes",
                                "R sabado", "R domingo" };
                        String[] t_fal = { "F lunes", "F martes", "F miercoles", "F jueves", "F viernes",
                                "F sabado", "F domingo" };
                        int[] d_asi = { d_rh_a_lu, d_rh_a_ma, d_rh_a_mi, d_rh_a_ju, d_rh_a_vi, d_rh_a_sa,
                                d_rh_a_do };
                        int[] d_ret = { d_rh_r_lu, d_rh_r_ma, d_rh_r_mi, d_rh_r_ju, d_rh_r_vi, d_rh_r_sa,
                                d_rh_r_do };
                        int[] d_fal = { d_rh_f_lu, d_rh_r_ma, d_rh_r_mi, d_rh_r_ju, d_rh_r_vi, d_rh_r_sa,
                                d_rh_r_do };

                        int i, j, k;
                        for (i = 0; i < t_asi.length; i++) {
                            celda = fila.createCell(i);
                            celda.setCellValue(t_asi[i]);
                        }
                        fila = sheet.createRow(1);
                        for (i = 0; i < d_asi.length; i++) {
                            celda = fila.createCell(i);
                            celda.setCellValue(d_asi[i]);
                        }
                        fila = sheet.createRow(3);
                        for (j = 0; j < t_ret.length; j++) {
                            celda = fila.createCell(j);
                            celda.setCellValue(t_ret[j]);
                        }
                        fila = sheet.createRow(4);
                        for (j = 0; j < d_ret.length; j++) {
                            celda = fila.createCell(j);
                            celda.setCellValue(d_ret[j]);
                        }
                        fila = sheet.createRow(6);
                        for (k = 0; k < t_fal.length; k++) {
                            celda = fila.createCell(k);
                            celda.setCellValue(t_fal[k]);
                        }
                        fila = sheet.createRow(7);
                        for (k = 0; k < d_fal.length; k++) {
                            celda = fila.createCell(k);
                            celda.setCellValue(d_fal[k]);
                        }
                        try {
                            FileOutputStream out = new FileOutputStream(archivo);
                            workbook.write(out);
                            out.close();
                            System.out.println("Archivo creado exitosamente!");
                        } catch (IOException ex) {
                            System.out.println("Error de escritura");
                            ex.printStackTrace();
                        }
                    }
                });
                archivo.add(guardar);
                menu.add(archivo);
                frame_grafica.getContentPane().add(panel_grafica);
                frame_grafica.setBounds(60, 60, 450, 400);
                frame_grafica.setJMenuBar(menu);
                frame_grafica.setVisible(true);
                frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            }
        }
    });

    jPanel = new JPanel();
    jPanel.setLayout(null);

    jPanel.add(cal1);
    jPanel.add(cal2);
    jPanel.add(etiqueta);
    jPanel.add(combobox);
    jPanel.add(calendario);
    jPanel.add(aceptar);
    jFrame.setJMenuBar(jMenuBar);
    jFrame.add(jPanel);

    jFrame.setVisible(true);
}