Example usage for java.awt CardLayout next

List of usage examples for java.awt CardLayout next

Introduction

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

Prototype

public void next(Container parent) 

Source Link

Document

Flips to the next card of the specified container.

Usage

From source file:CardLayoutTest.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Card Layout");
    final Container contentPane = frame.getContentPane();
    final CardLayout layout = new CardLayout();
    contentPane.setLayout(layout);/*  w  w w.  j a va 2 s  .co  m*/
    ActionListener listener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            layout.next(contentPane);
        }
    };
    for (int i = 0; i < 5; i++) {
        String label = "Card " + i;
        JButton button = new JButton(label);
        contentPane.add(button, label);
        button.addActionListener(listener);
    }
    frame.setSize(300, 200);
    frame.show();
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("CardLayout");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentPane = frame.getContentPane();

    JPanel buttonPanel = new JPanel();
    JButton nextButton = new JButton("Next");
    buttonPanel.add(nextButton);//from   w w  w .  j a v  a  2s .c  o  m
    contentPane.add(buttonPanel, BorderLayout.SOUTH);

    final JPanel cardPanel = new JPanel();
    final CardLayout cardLayout = new CardLayout();
    cardPanel.setLayout(cardLayout);

    for (int i = 1; i <= 5; i++) {
        JButton card = new JButton("Card " + i);
        card.setPreferredSize(new Dimension(200, 200));
        String cardName = "card" + 1;
        cardPanel.add(card, cardName);
    }
    contentPane.add(cardPanel, BorderLayout.CENTER);
    nextButton.addActionListener(e -> cardLayout.next(cardPanel));

    frame.pack();
    frame.setVisible(true);
}

From source file:userInterface.ManufactureRole.DecisionChartJPanel.java

public DecisionChartJPanel(JPanel userProcessContainer, ManufactureOrganization o) {
    initComponents();//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    this.userProcessContainer = userProcessContainer;
    this.o = o;//from   w ww  . ja va 2s  .com
    JFreeChart jfreechart1 = createChart1(createDataset1());
    ChartPanel chartpanel1 = new ChartPanel(jfreechart1);
    chartpanel1.setPreferredSize(new Dimension(1000, 540));
    jPanel1.add(chartpanel1);
    CardLayout layout1 = (CardLayout) jPanel1.getLayout();
    layout1.next(jPanel1);
}

From source file:userInterface.StateAdminRole.DecisionChart4JPanel.java

public DecisionChart4JPanel(JPanel userProcessContainer, PhdEnterprise e) {
    initComponents();// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    this.userProcessContainer = userProcessContainer;
    this.e = e;//from   w  w w  .  ja v  a 2s.  c o m
    JFreeChart jfreechart1 = createChart1(createDataset1());
    ChartPanel chartpanel1 = new ChartPanel(jfreechart1);
    chartpanel1.setPreferredSize(new Dimension(1000, 540));
    jPanel1.add(chartpanel1);
    CardLayout layout1 = (CardLayout) jPanel1.getLayout();
    layout1.next(jPanel1);
}

From source file:userInterface.StateAdminRole.DecisionCartJPanel2.java

public DecisionCartJPanel2(JPanel userProcessContainer, PhdEnterprise e) {
    initComponents();// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    this.userProcessContainer = userProcessContainer;
    this.e = e;// www  . j av  a2  s  . c om
    JFreeChart jfreechart1 = createChart1(createDataset1());
    ChartPanel chartpanel1 = new ChartPanel(jfreechart1);
    chartpanel1.setPreferredSize(new Dimension(1000, 540));
    jPanel1.add(chartpanel1);
    CardLayout layout1 = (CardLayout) jPanel1.getLayout();
    layout1.next(jPanel1);
}

From source file:userinterface.HospitalAdminRole.HospitalAdminWorkAreaJPanel.java

private void BtnManageOrganizationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnManageOrganizationActionPerformed
    // TODO add your handling code here:
    ManageOrganization1JPanel manageOrganization1JPanel = new ManageOrganization1JPanel(userProcessContainer,
            enterprise.getOrganizationDirectory());
    userProcessContainer.add("manageOrganization1JPanel", manageOrganization1JPanel);
    CardLayout layout = (CardLayout) userProcessContainer.getLayout();
    layout.next(userProcessContainer);
}

From source file:userinterface.HospitalAdminRole.HospitalAdminWorkAreaJPanel.java

private void BtnManageEmployeeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnManageEmployeeActionPerformed
    // TODO add your handling code here:
    ManageEmployee1JPanel manageEmployee1JPanel = new ManageEmployee1JPanel(userProcessContainer,
            enterprise.getOrganizationDirectory());
    userProcessContainer.add("manageEmployee1JPanel", manageEmployee1JPanel);
    CardLayout layout = (CardLayout) userProcessContainer.getLayout();
    layout.next(userProcessContainer);
}

From source file:userinterface.HospitalAdminRole.HospitalAdminWorkAreaJPanel.java

private void BtnManageUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnManageUserActionPerformed
    // TODO add your handling code here:
    ManageUserAccount1JPanel manageUserAccount1JPanel = new ManageUserAccount1JPanel(userProcessContainer,
            enterprise);// ww  w .  j  a va2  s  . co  m
    userProcessContainer.add("ManageUserAccount1JPanel", manageUserAccount1JPanel);
    CardLayout layout = (CardLayout) userProcessContainer.getLayout();
    layout.next(userProcessContainer);
}

From source file:userinterface.HospitalAdminRole.HospitalAdminWorkAreaJPanel.java

private void BtnManageUser1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnManageUser1ActionPerformed
    // TODO add your handling code here:

    DataAnalysisHospitalJPanel dataAnalysisHospitalJPanel = new DataAnalysisHospitalJPanel(userProcessContainer,
            enterprise, business);//from  w w  w  .j  a  v  a2s.  c  om
    userProcessContainer.add("DataAnalysisHospitalJPanel", dataAnalysisHospitalJPanel);
    CardLayout layout = (CardLayout) userProcessContainer.getLayout();
    layout.next(userProcessContainer);

}

From source file:UserInterface.CDC.VaccineStateDistributionJPanel.java

private void viewDetailsjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewDetailsjButtonActionPerformed
    // TODO add your handling code here:
    int selectedRow = summaryjTable.getSelectedRow();

    if (selectedRow < 0) {
        JOptionPane.showMessageDialog(null, "Please select a State");
        return;//from  w ww .j a va2  s  . com
    }
    StateNetwork state = (StateNetwork) summaryjTable.getValueAt(selectedRow, 0);
    VaccineCityDistributionJPanel panel = new VaccineCityDistributionJPanel(workContainer, userAccount,
            business, cdcEnterprise, cdcOrg, state);
    workContainer.add("VaccineCityDistributionJPanel", panel);
    CardLayout layout = (CardLayout) workContainer.getLayout();
    layout.next(workContainer);

}