Article View: borland.public.jbuilder.java.swing
Article #8665Re: $1.class and $2.class?
From: Randy
Date: Fri, 28 Jul 2000 00:00
Date: Fri, 28 Jul 2000 00:00
112 lines
3775 bytes
3775 bytes
it does support jar files; I have currently a jar file with the class and
two anonymous classes; the problem that I am now facing is it appears as if
one of the anonymous classes isn't loaded or isn't working as it does in the
appletviewer.
here's the code that I am referring to:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import RandyClasses.*;
public class DeckOfCards extends Applet {
private Cards dealt;
private Card deck[];
private int currentCard;
private Button dealButton,shuffleButton;
private TextField displayCard;
private Label status;
public void shuffle() {
currentCard = -1;
for(int i=0;i<52;i++) {
int j = (int) (Math.random()*52);
Card temp = deck[i];
deck[i] = deck[j];
deck[j] = temp;
}
dealButton.setEnabled(true);
}
public Card dealCard() {
if(++currentCard < deck.length) {
return deck[currentCard];
}
else {
dealButton.setEnabled(false);
return null;
}
}
public void init() {
setBackground(Color.yellow);
deck = new Card[52];
currentCard=-1;
DealActions de;
ShuffleAction se;
dealt = new Cards();
add(dealt);
for(int i=0;i <deck.length;i++)
deck[i] = new Card(i % 13,i/13);
dealButton = new Button("Deal Button");
dealButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Card d_card = dealCard();
if(d_card != null) {
dealt.changeCard(d_card.getFaceValue(),d_card.getSuitValue(),0);
displayCard.setText(dealt.toString());
dealt.repaint();
status.setText("Card #:"+currentCard);
}
else {
displayCard.setText("NO MORE CARDS TO DEAL");
status.setText("Shuffle cards to continue");
}
}
});
add(dealButton);
init2();
add(shuffleButton);
displayCard = new TextField(20);
displayCard.setEditable(false);
add(displayCard);
status = new Label();
add(status);
setSize(300,200);
show();
}
public void init2() {
shuffleButton = new Button("Shuffle Cards");
shuffleButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
displayCard.setText("Shuffling....");
shuffle();
displayCard.setText("DECK IS SHUFFLED");
}
});
}
}
Trejkaz Xaoza <trejkaz@xaoza.net> wrote in message
news:397CDDA8.402D9C6E@xaoza.net...
> Rich Wilkman wrote:
> > If you have an ISP that doesn't support JAR files, then you have an ISP
> > that doesn't support Applets.
>
> If you have an ISP that doesn't support applets, you have an ISP that
> probably doesn't support any kind of file format apart from HTML. ;-)
>
> As to why tripod don't allow files with a $ sign in them ...
>
> TX
Technical Details
Message-ID:
<8lsohg$bvk5@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8l52ru$2gl4@bornews.borland.com> <MPG.13e0491999aa6265989a4f@forums.borland.com> <8l7jit$qfm1@bornews.borland.com> <3977A06D.62AFAEB9@formlessvoid.com> <397CDDA8.402D9C6E@xaoza.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,f53d8f624b35a9db X-Google-Attributes: gid111d45,public From: "Randy" <slyfox65@netzero.net> Subject: Re: $1.class and $2.class? Date: 2000/07/28 Message-ID: <8lsohg$bvk5@bornews.borland.com> X-Deja-AN: 651935331 References: <8l52ru$2gl4@bornews.borland.com> <MPG.13e0491999aa6265989a4f@forums.borland.com> <8l7jit$qfm1@bornews.borland.com> <3977A06D.62AFAEB9@formlessvoid.com> <397CDDA8.402D9C6E@xaoza.net> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing