// @topic T11717 MVC Demo - Account Balance // @brief Another Window extends JFrame <a href="http://www.c-jump.com/bcc/c257c/c257jsample/junk/wk10_banking/WindowAccountBalance.form"><tt>WindowAccountBalance.form</tt></a> package banking; public class WindowAccountBalance extends javax.swing.JFrame { // data attributes ControllerTransaction controller; // constructors public WindowAccountBalance(ControllerTransaction controller) { this.controller = controller; initComponents(); } //operations public void updateBalance( double balance ) { lblBalanceInfo.setText("Your balance is "+balance); setVisible(true); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { pnlAccountBalance = new javax.swing.JPanel(); lblBalanceInfo = new javax.swing.JLabel(); javax.swing.GroupLayout pnlAccountBalanceLayout = new javax.swing.GroupLayout(pnlAccountBalance); pnlAccountBalance.setLayout(pnlAccountBalanceLayout); pnlAccountBalanceLayout.setHorizontalGroup( pnlAccountBalanceLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlAccountBalanceLayout.createSequentialGroup() .addGap(28, 28, 28) .addComponent(lblBalanceInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(24, Short.MAX_VALUE)) ); pnlAccountBalanceLayout.setVerticalGroup( pnlAccountBalanceLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlAccountBalanceLayout.createSequentialGroup() .addGap(50, 50, 50) .addComponent(lblBalanceInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(60, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(pnlAccountBalance, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(115, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(pnlAccountBalance, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(25, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel lblBalanceInfo; private javax.swing.JPanel pnlAccountBalance; // End of variables declaration//GEN-END:variables }