Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #6026
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | markspace <-@.> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Needs help in logic |
| Date | Sat, 09 Jul 2011 19:56:25 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 35 |
| Message-ID | <ivb4d0$o98$1@dont-email.me> (permalink) |
| References | <fbfce98a-335f-4465-b8b3-bd3c4d087d1c@b21g2000yqc.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Sun, 10 Jul 2011 02:56:32 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="5HSAJfqnDjjLFxXZ6WBWEw"; logging-data="24872"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fqrosC2+Rl0VDyV/xTo8hqno5XasZBJ0=" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 |
| In-Reply-To | <fbfce98a-335f-4465-b8b3-bd3c4d087d1c@b21g2000yqc.googlegroups.com> |
| Cancel-Lock | sha1:poDsvUJL2FdJVAX/L6PPwIYcK1g= |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6026 |
Show key headers only | View raw
Well, I don't do homework for people, but I'll give you some hints.
1. Don't use BorderLayout, it kinda sucks for what you're trying to do.
The default FlowLayout of a JPanel is proabably better. Put all the
components in the JPanel and add that to the main content pane of the
JFrame. Then pack() the frame (frame.pack()) instead of setting its size.
2. This is the next bit to add to your program:
> event-
> handler method or the actionPerformed method of class based on the
> ActionListener
Read this:
<http://download.oracle.com/javase/tutorial/uiswing/events/actionlistener.html>
Then add a method to your main class like this:
public class guessprogram implements .... name here... {
public static void main(String args[]) {
// this is what you have already...
}
public void actionPerformed(ActionEvent e) {
// logic to test input here
}
}
And add the ActionListener as that link shows you. That should get you
started. Your program has threading problems, but we'll leave that
alone for a beginner problem.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Needs help in logic Eric <ehtisham@gmail.com> - 2011-07-09 19:05 -0700
Re: Needs help in logic markspace <-@.> - 2011-07-09 19:56 -0700
Re: Needs help in logic lewbloch <lewbloch@gmail.com> - 2011-07-11 11:18 -0700
Re: Needs help in logic Roedy Green <see_website@mindprod.com.invalid> - 2011-07-10 02:02 -0700
csiph-web