Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #19797

Question on homework....

Received by 10.224.207.66 with SMTP id fx2mr7440902qab.7.1353282312959; Sun, 18 Nov 2012 15:45:12 -0800 (PST)
Received by 10.49.86.106 with SMTP id o10mr2150271qez.14.1353282312935; Sun, 18 Nov 2012 15:45:12 -0800 (PST)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!u2no11329993qal.0!news-out.google.com!gf5ni327qab.0!nntp.google.com!u2no11329987qal.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Sun, 18 Nov 2012 15:45:12 -0800 (PST)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=65.92.24.71; posting-account=gulR8woAAABzXru8ud1vl1T00ObzOsIA
NNTP-Posting-Host 65.92.24.71
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <c3f77290-c243-4861-9ec3-40a7cbf6b612@googlegroups.com> (permalink)
Subject Question on homework....
From simple <csimple29@gmail.com>
Injection-Date Sun, 18 Nov 2012 23:45:12 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.java.programmer:19797

Show key headers only | View raw


Working on this homework - need to have java when launched the program show the main intro window (which it does show me) and then I need to show the welcome page but don't know how to make this appear right after.  The last step is it has to show me the rules windows but not sure how I tell the system the user wants to see the rules.  

When I run the batch file the intro window appears for a few seconds but not the other window  why is it not picking up???? I don't understand where it is getting the if type==1 ???  where is getting 1 from??? Do I need to create menu to ask for type 1 or 2???  Would really appreciate if someone can clarify why it is not working.....

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


public class window extends JWindow
{

  ImageIcon imIntro = new ImageIcon("images\\Lintro.jpg");
  ImageIcon imWelcome = new ImageIcon("images\\Welcome.jpg");
  ImageIcon imRules = new ImageIcon("images\\Rules.jpg");
  static Thread t = new Thread();
  static int thread = 0;
  static JButton bouton;
  static int X;
  static int Y;

  /* Parametres du constructeur :
        type: 1-> Intro, 2->rules */

  public window( int X, int Y, int type ) {

    super();
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    setSize(X,Y);
    setLocation( (dim.width - X)/2 , (dim.height - Y)/2);
    setVisible(true);
    Container fen = getContentPane();

    if (type == 1 ) bouton = new JButton(imIntro);
    else            bouton = new JButton(imRules);
    bouton.setPreferredSize(new Dimension(X, Y) );
    fen.add(bouton);
    bouton.setVisible(true);

    show();

       if( type == 1 ) { //this is the part I don't know where is it getting it
        try {
            t.sleep(2000);
            thread = 1;
        }
        catch( java.lang.InterruptedException ex ) {
            JOptionPane.showMessageDialog(null, "error");
            }
        dispose();

    }
    /* If it is the rules - close window when user cliques*/
     
    else {
        bouton.addActionListener( new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                     dispose();
                }
        });
    }

 }
}

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Question on homework.... simple <csimple29@gmail.com> - 2012-11-18 15:45 -0800
  Re: Question on homework.... Knute Johnson <nospam@knutejohnson.com> - 2012-11-18 16:38 -0800

csiph-web