Example usage for java.awt CardLayout show

List of usage examples for java.awt CardLayout show

Introduction

In this page you can find the example usage for java.awt CardLayout show.

Prototype

public void show(Container parent, String name) 

Source Link

Document

Flips to the component that was added to this layout with the specified name , using addLayoutComponent .

Usage

From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java

private void showProductPanel() {

    // Load product panel
    java.util.List<ProductInfoExt> product = null;
    try {//from  w  w  w. ja v a2s  .co m
        if (menuStatus.equals("false")) {
            product = dlSales.getPopularProduct("Y");
        } else {
            day = getWeekDay();
            currentMenuList = dlSales.getMenuId(day);
            if (currentMenuList.size() != 0) {
                menuId = currentMenuList.get(0).getId();
            }
            product = dlSales.getMenuPopularProduct("Y", menuId);
        }
        //  m_productsset.put(id, product);
    } catch (BasicException ex) {
        logger.info("Order No. " + m_oTicket.getOrderId() + "exception in showProductPanel" + ex.getMessage());
        Logger.getLogger(JRetailPanelTakeAway.class.getName()).log(Level.SEVERE, null, ex);
    }

    JRetailCatalogTab jcurrTab = new JRetailCatalogTab();
    jcurrTab.applyComponentOrientation(getComponentOrientation());
    m_jProducts.add(jcurrTab, "PRODUCT.");

    // Add products
    for (ProductInfoExt prod : product) {
        tnbbutton = new ThumbNailBuilderPopularItems(97, 57, "com/openbravo/images/bluepopulartoit.png");
        jcurrTab.addPopularItemButton(new ImageIcon(tnbbutton.getThumbNailText(null, getProductLabel(prod))),
                new SelectedAction(prod));
    }

    // selectIndicatorPanel(new ImageIcon(tnbbutton.getThumbNail(product.getImage())), product.getName());

    CardLayout cl = (CardLayout) (m_jProducts.getLayout());
    cl.show(m_jProducts, "PRODUCT.");

}

From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java

public void refreshTicket() {
    //   System.out.println("refreshTicket");
    CardLayout cl = (CardLayout) (getLayout());
    customerFocus();// w ww .j  a  v a  2 s. c  o  m
    if (m_oTicket == null) {
        m_ticketlines.clearTicketLines();

        m_jSubtotalEuros1.setText(null);
        m_jTaxesEuros1.setText(null);
        m_jTotalEuros.setText(null);

        stateToZero();

        // Muestro el panel de nulos.
        cl.show(this, "null");
        // resetSouthComponent();  //commented to test performance

    } else {
        if (m_oTicket.getTicketType() == RetailTicketInfo.RECEIPT_REFUND) {
        }

        String name = m_oTicket.getName(m_oTicketExt);
        //             if(name.contains("-")){
        //
        //                String customer[]= null;
        //                customer =name.split("-");
        //                cusName.setText(customer[0]);
        //            }else{
        //                  cusName.setText("");
        //            }
        m_ticketlines.clearTicketLines();

        for (int i = 0; i < m_oTicket.getLinesCount(); i++) {
            m_ticketlines.addTicketLine(m_oTicket.getLine(i));
        }
        printPartialTotals();
        stateToZero();

        // Muestro el panel de tickets.
        cl.show(this, "ticket");
        //   resetSouthComponent();   //commented to test performance

        // activo el tecleador...
        m_jKeyFactory.setText(null);
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                m_jKeyFactory.requestFocus();
            }
        });
        m_jLblCurrentDate.setText(getDateForMe().toString());
        m_jUser.setText((m_oTicket.getUser()).getName());
        m_jLblTime.setText(getTime().toString() + "        ");
        //           m_jTable.setText(m_oTicket.getName(m_oTicketExt) );
    }
}

From source file:com.peterbochs.PeterBochsDebugger.java

private void jStepOverDropDownButtonActionPerformed(ActionEvent evt) {
    if (jStepOverDropDownButton.getEventSource() != null) {
        untilThread = new StepThread(jStepOverDropDownButton.getEventSource());
        if (jStepOverDropDownButton.getEventSource() == jStepOverNTimesMenuItem) {
            String s = JOptionPane.showInputDialog("Please input the instruction count?");
            if (s == null) {
                return;
            }//from  w  ww. j a  v  a 2 s . c  om
            untilThread.instructionCount = Integer.parseInt(s);
        }

        // if (currentPanel.equals("jMaximizableTabbedPane_BasePanel1")) {
        CardLayout cl = (CardLayout) (jMainPanel.getLayout());
        cl.show(jMainPanel, "Running Label 2");
        // }
        new Thread(untilThread, "Step until thread").start();
    } else {
        sendCommand("next");
        WebServiceUtil.log("peter-bochs", "step over", null, null, null);
        updateBochsStatus(true);
        // updateHistoryTable(re);
    }
}

From source file:com.peterbochs.PeterBochsDebugger.java

private void stepBochsButtonActionPerformed(ActionEvent evt) {
    if (stepBochsButton.getEventSource() != null) {
        untilThread = new StepThread(stepBochsButton.getEventSource());
        if (stepBochsButton.getEventSource() == jStepNMenuItem) {
            String s = JOptionPane.showInputDialog(this, "Please input the instruction count?");
            if (s == null) {
                return;
            }//from  ww  w. j a v  a2  s.c  o  m
            untilThread.instructionCount = Integer.parseInt(s);
        } else if (stepBochsButton.getEventSource() == jStepUntilIPBigChangeMenuItem) {
            String s = JOptionPane.showInputDialog("Please input the instruction count?");
            if (s == null) {
                return;
            }
            untilThread.ipDelta = CommonLib.string2long(s);
        }

        CardLayout cl = (CardLayout) (jMainPanel.getLayout());
        cl.show(jMainPanel, "Running Label 2");
        new Thread(untilThread, "Step until thread").start();
    } else {
        sendCommand("s");
        WebServiceUtil.log("peter-bochs", "step", null, null, null);
        updateBochsStatus(true);
    }
}

From source file:com.peterbochs.PeterBochsDebugger.java

private void stopBochs() {
    WebServiceUtil.log("peter-bochs", "stop", null, null, null);
    try {/*from w ww .j  a va2  s.co m*/
        this.enableAllButtons(false, false);
        runBochsButton.setText(MyLanguage.getString("Run_bochs"));
        runBochsButton.setToolTipText("Start emulation");
        runBochsButton.setIcon(new ImageIcon(getClass().getClassLoader()
                .getResource("com/peterbochs/icons/famfam_icons/resultset_next.png")));

        if (currentPanel.equals("jMaximizableTabbedPane_BasePanel1")) {
            CardLayout cl = (CardLayout) (jMainPanel.getLayout());
            cl.show(jMainPanel, "jMaximizableTabbedPane_BasePanel1");
            currentPanel = "jMaximizableTabbedPane_BasePanel1";
        }

        if (os == OSType.mac || os == OSType.linux) {
            ProcessBuilder pb = new ProcessBuilder("killall", "-9", "bochs");
            pb.start();
        } else {
            ProcessBuilder pb = new ProcessBuilder("StopBochs.exe");
            pb.start();
        }

        MemorySocketServerController.stop();
        JmpSocketServerController.stop();
        InterruptSocketServerController.stop();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:com.peterbochs.PeterBochsDebugger.java

private void jLogToggleButtonActionPerformed(ActionEvent evt) {
    CardLayout cl = (CardLayout) (jMainPanel.getLayout());
    if (jLogToggleButton.isSelected()) {
        cl.show(jMainPanel, "logPanel1");
        currentPanel = "logPanel1";
    } else {//from  www .  jav a  2 s .c o m
        cl.show(jMainPanel, "jMaximizableTabbedPane_BasePanel1");
        currentPanel = "jMaximizableTabbedPane_BasePanel1";
    }
}

From source file:com.peterbochs.PeterBochsDebugger.java

private void jOSLogToggleButtonActionPerformed(ActionEvent evt) {
    CardLayout cl = (CardLayout) (jMainPanel.getLayout());
    if (jOSLogToggleButton.isSelected()) {
        cl.show(jMainPanel, "oSLogPanel1");
        currentPanel = "osLogPanel1";
    } else {//  w  w  w.  j  a v a  2s . c o m
        cl.show(jMainPanel, "jMaximizableTabbedPane_BasePanel1");
        currentPanel = "jMaximizableTabbedPane_BasePanel1";
    }
}

From source file:com.peterbochs.PeterBochsDebugger.java

private void jProfilerToggleButtonActionPerformed(ActionEvent evt) {
    CardLayout cl = (CardLayout) (jMainPanel.getLayout());
    if (jProfilerToggleButton.isSelected()) {
        cl.show(jMainPanel, "jInstrumentPanel");
        currentPanel = "jInstrumentPanel";
    } else {/*from ww w  .  j a v  a2  s.  c o m*/
        cl.show(jMainPanel, "jMaximizableTabbedPane_BasePanel1");
        currentPanel = "jMaximizableTabbedPane_BasePanel1";
    }
}

From source file:com.peterbochs.PeterBochsDebugger.java

private synchronized void pauseBochs(boolean pauseBochsManually, boolean resumeMainPanel) {
    if (!processPauseBoch) {
        processPauseBoch = true;/*from ww w.ja va 2 s.  c o  m*/
        try {
            if (runBochsButton.getText().equals(MyLanguage.getString("Pause_bochs"))) {
                WebServiceUtil.log("peter-bochs", "pause", null, null, null);

                commandReceiver.clearBuffer();
                commandReceiver.waitUntilNoInput();

                if (pauseBochsManually) {
                    if (os == OSType.mac || os == OSType.linux) {
                        ProcessBuilder pb = new ProcessBuilder("killall", "-2", "bochs");
                        pb.start();
                    } else {
                        ProcessBuilder pb = new ProcessBuilder("PauseBochs.exe");
                        pb.start();
                    }
                }

                updateBochsStatus(true);

                if (resumeMainPanel) {
                    SwingUtilities.invokeLater(new Runnable() {
                        // this invokeLater prevent openJDK hang my program,
                        // I
                        // am using FC15
                        public void run() {
                            CardLayout cl = (CardLayout) (jMainPanel.getLayout());
                            cl.show(jMainPanel, currentPanel);
                        }
                    });
                }
                if (skipBreakpointTime <= 0 && customCommandQueue.size() <= 0) {
                    runBochsButton.setText(MyLanguage.getString("Run_bochs"));
                    runBochsButton.setToolTipText("Start emulation");
                    runBochsButton.setIcon(new ImageIcon(getClass().getClassLoader()
                            .getResource("com/peterbochs/icons/famfam_icons/resultset_next.png")));
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        processPauseBoch = false;
    }
}

From source file:com.peterbochs.PeterBochsDebugger.java

private void runBochs() {
    WebServiceUtil.log("peter-bochs", "run", null, null, null);
    try {//www.j  ava2s. c o  m
        enableAllButtons(false, true);
        if (currentPanel.equals("jMaximizableTabbedPane_BasePanel1")
                || currentPanel.equals("sourceLevelDebugger")) {
            CardLayout cl = (CardLayout) (jMainPanel.getLayout());
            cl.show(jMainPanel, "Running Label");
        }

        if (skipBreakpointTime > 0) {
            jRunningLabel.setText(
                    "<html><center>Bochs is running, click the pause button to pause it !!!<br><br><img src=\""
                            + url + "\" /><br><br>" + skipBreakpointTime + "</center></html>");
            jRunningLabel.getParent().getParent().getParent().repaint();
            jRunningLabel.getParent().getParent().repaint();
            jRunningLabel.getParent().repaint();
            jRunningLabel.repaint();
        } else if (customCommandQueue.size() > 0) {
            String nextCommands = "";
            for (int x = 0; x < customCommandQueue.size() && x < 10; x++) {
                nextCommands += customCommandQueue.get(x);
            }
            jRunningLabel.setText(
                    "<html><center>Bochs is running, click the pause button to pause it !!!<br><br><img src=\""
                            + url + "\" /><br><br>" + customCommandQueue.size() + "</center></html>");
            jRunningLabel.getParent().repaint();
        }

        Data.memoryProfilingZone.needToTellBochsToUpdateZone = true;
        commandReceiver.clearBuffer();
        sendCommand("c");

        runBochsButton.setText(MyLanguage.getString("Pause_bochs"));
        runBochsButton.setToolTipText("Pause emulation");
        runBochsButton.setIcon(new ImageIcon(
                getClass().getClassLoader().getResource("com/peterbochs/icons/famfam_icons/pause.png")));

        new Thread("runBochs() update thread") {
            public void run() {
                while (commandReceiver.getLinesLength() == 0) {
                    try {
                        Thread.currentThread();
                        Thread.sleep(200);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }

                skipBreakpointTime--;
                if (skipBreakpointTime > 0) {
                    pauseBochs(false, false); // update register, not really
                    // want to pause because it
                    // already paused
                    waitUpdateFinish();

                    runBochs();
                } else if (customCommandQueue.size() > 0) {
                    pauseBochs(false, false); // update register, not really
                    // want to pause because it
                    // already paused
                    waitUpdateFinish();

                    while (customCommandQueue.size() > 0) {
                        String command = customCommandQueue.get(0).command;
                        customCommandQueue.remove(0);

                        commandReceiver.clearBuffer();
                        if (command.equals("s")) {
                            sendCommand("s");
                            updateBochsStatus(true);
                            waitUpdateFinish();
                        } else if (command.equals("c")) {
                            runBochs();
                            return;
                        }
                    }
                    // pauseBochs(false, true);
                    // waitUpdateFinish();
                } else {
                    pauseBochs(false, true);
                    waitUpdateFinish();
                }
            }
        }.start();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}