Need a little help,a nd maybe some advice

I just finished making the beginning of a character planner for an rpg I play. I got the basic features done, and went about making a quick console interface for it so I could give it out and have people test it for me.
Here's the source: http://www.student.nvcc.edu/home/mappleman/trainer.zip
The main method looks like this:
public static void main(String[] args) {
          TextInterface ui = new TextInterface();
          ui.promptName();
          ui.promptRace();
          ui.promptProfession();
          ui.promptStartStat();
          ui.calcStats();
          ui.printStats();          
     }promptName() works fine. It prompts for the name, and waits for the user to type something in. After that though it runs through the other methods not stopping for input where it should (at the lines with SavitchIn.readLine* ). It ends up croaking on a divide by zero error because it didn't take any input. Everything seems in perfect order to me. Any idea whats going on?
Thanks in advance! Also, some general input about my code style would be appreciated. This is the first non trivial program I've written so far, and by far my first potentialy USEFUL program!

Hello again! After fixing the above problem, i found and fixed several other little problems, and now everything works wonderfully, except this. It gets to this part, and freezes up. The file is created, but the program doesn't exit. Trying to open the file with a text editor won't work, I end up having to kill the editor.
public void printStats(){
          PrintWriter outputStream = null;
          try{
               outputStream = new PrintWriter(new FileOutputStream(character.getName() + ".txt"));
          catch(FileNotFoundException e){
               System.out.println("Error opening the file");
               System.exit(0);
          outputStream.println("Name: " + character.getName());
          outputStream.println("Race: " + character.getRace());
          outputStream.println("Profession: " + character.getProfession());
          outputStream.println("Stats:");
          int lvl = 0;
          outputStream.print("CON:");
          while (lvl < 101){
               outputStream.print(" " + character.getStat(0, lvl));
          lvl = 0;
          outputStream.print("DEX:");
          while (lvl < 101){
               outputStream.print(" " + character.getStat(1, lvl));
          lvl = 0;
          outputStream.print("DIS:");
          while (lvl < 101){
               outputStream.print(" " + character.getStat(2, lvl));
          lvl = 0;
          outputStream.print("LOG:");
          while (lvl < 101){
               outputStream.print(" " + character.getStat(3, lvl));
          lvl = 0;
          outputStream.print("INT:");
          while (lvl < 101){
               outputStream.print(" " + character.getStat(4, lvl));
          lvl = 0;
          outputStream.print("STR:");
          while (lvl < 101){
               outputStream.print(" " + character.getStat(5, lvl));
          lvl = 0;
          outputStream.print("AGL:");
          while (lvl < 101){
               outputStream.print(" " + character.getStat(6, lvl));
          lvl = 0;
          outputStream.print("INF:");
          while (lvl < 101){
               outputStream.print(" " + character.getStat(7, lvl));
          lvl = 0;
          outputStream.print("WIS:");
          while (lvl < 101){
               outputStream.print(" " + character.getStat(8, lvl));
          lvl = 0;
          outputStream.print("AUR:");
          while (lvl < 101){
               outputStream.print(" " + character.getStat(9, lvl));
          System.out.println("Stats written to " + character.getName() + ".txt");
          outputStream.close();
     }Thanks again!

Similar Messages

  • Need a little help new to mac

    Need a little help I'm new to Mac.. i have had my ibook for over a year now and i like it a lot, but some times my usb post dies on my for a couple days maybe weeks. Ill have my ipod connected and when i go to plug in a flash drive. It doesn't detect my ipod anymore and my usb port don't work. it says that they were "removed improperly" and now they are not working again..i have tried to reinstall the whole os again and that doesn't work i don't have the hardware test disk so i don't know what could be the problem i know its not the logic board is there any test i can do to it to find out the problem its an ibook late 2001... there is no reset button on it. i tried to hold in the space bar and now when i boot up i get prompt to this screen that shows the world and then a folder with a ? mark but then after a few sec it boots right up im a mess need some help

    +it says that they were "removed improperly"+
    You have to go to the iPod's icon on your computer (or the flash drive's icon), select it and eject it there before removing it. Otherwise, data can be corrupted and/or lost. Repeatedly removing it without ejecting it from the desktop can cause it not to be recognized any longer.
    If your iBook is a "late 2001" model. It should have a reset button. Check out the chart here to make sure which model iBook you have:
    http://support.apple.com/kb/HT1772?viewlocale=en_US
    +i get prompt to this screen that shows the world and then a folder with a ? mark but then after a few sec it boots right up+
    It's trying to find a network volume from which to boot.
    Once it's booted up, go to System Preferences > Startup Disk, and select your Mac OS X startup volume. Then close System Preferences. The next time you start up, it should start up without looking for a network volume.

  • I need a little help

    hi i need a little help making a java applet rpg with log-in, chat, etc. and i dont really know to much about it and dont understand applet programming too much. If anyone could help, it would be appreciated. Also, since i am fairly decent at making/improving websites, if you help me i could make a website for you or improve one you already have. You can email me if you want to help at "[email protected]"

    Don't just give up. Like I said, start small.
    I've never heard of any pre-made RPG java classes.
    Why don't you poke around on SourceForge or some java-centric project site or one of the java gaming sites. Maybe someone has written all these libraries already, although you may have trouble using these classes if you're not familiar with programming in general and java in particular. Or do a Google search.
    But using a specialized API is a lot easier if you know how to use the general API (i.e., j2se).
    Another option of course is not to use java at all. Many commercial games come with an editor; you may find it easier to get one of those and do a mod.

  • Need a little help with dial setup on CME

    I've got a CME I'm using for testing and I think I need a little help figuring out the proper config to get the system to accept numbers I dial and have those numbers be passed on to an Avaya system (including the leading 9 for ARS in Avaya) via H.323 IP trunks.   I have it working well for internal 5 digit extension calls across the H.323 trunks and I also have it working well for some types of outside calls that gets passed on to the Avaya and then the Avaya dials the call out to the PSTN.   My only real problem is, I can't figure out how to correctly configure CME to examine the digits I'm dialing and only send the digits once I'm finished dialing....not as soon as it sees an initial match.
    What's happening is this.  I can dial local numbers in my area as 7 digits or 10 digits.  The phone company doesn't yet force us to dial area code and number for local calls (10 digits).  I can still dial 7 digits.   But...if I put an entry in CME that looks like this....
    (by the way, the 192.168.1.1 IP is not the real IP address, that's just an example, but the rest of this entry is what I really have entered in CME)
    dial-peer voice 9 voip
    description Outside 7 Dig Local Calls Via Avaya
    destination-pattern 9.......
    session target ipv4:192.168.1.1
    dtmf-relay h245-alphanumeric
    no vad
    ...Then it will always try to dial out immediately after seeing the first 8 digits I dial (9 plus the 7 digit number I called)...even though I have a speicifc entry in the system that accounts for calls to 9 plus area code 513.  I would have assumed that if I put the specific entry in for 9513....... it would see that and wait to see if I was actually dialing something to match 9513....... instead of 9.......   Understand what I mean?   Because 9513....... is more specific than 9....... but it still tries to send the call out immediately after seeing the first 8 digits I dialed.
    dial-peer voice 9513 voip
    description Outside 10 Dig Local Calls Via Avaya
    destination-pattern 9513.......
    session target ipv4:192.168.1.1
    dtmf-relay h245-alphanumeric
    no vad
    ...BUT...here's the interesting thing.  If I trace the 10 digit call in Avaya, I see that the number being presented to the Avaya PBX is only the first 7 digits of the number....not the full 10 digits...BUT I see a few more of the digits I dialed (like the 8th and 9th digits) after the call is already setup and sent to the PSTN.  It's like the CME is trying to send the rest of the 10 digits I dialed, but at that point it's already too late.   It setup the call as a 7 digit call (9 plus 7 digits), not 10 digit like I wanted.
    I'm more familiar with how to setup dialing in the Avaya via ARS.  My background is Avaya, not Cisco, so this dial-peer config is a little difficult for me until I understand the reasoning of how it examines the numbers and what I should do to make it wait for me to finish dialing....or to tell the system that what I'm dialing will be a minimum or a certain amount of digits and maximum of a certain amount of digits, like the Avaya does.  I just need some pointers and examples to look at :-)   I think I've almost got it....but I'm just missing something at the moment.
    Just so you understand, the call flow should be like this:  Cisco phone registered to CME > CME to Avaya via H.323 trunks > Avaya to PSTN via ISDN PRI trunks connected to Avaya.  I have to be sure I send the 9 to the Avaya also, because 9 triggers ARS in the Avaya. 
    Thanks for your help

    Here is a good document that explains how dial-peers are matched in the Cisco world:
    http://www.cisco.com/en/US/tech/tk652/tk90/technologies_tech_note09186a008010fed1.shtml#topic7
    In your case, it is variable length dial plan you are trying to implenent. To fix it, you need to add a T to force the system to wait for more digits to be entered if there is any.
    dial-peer voice 9 voip
    description Outside 7 Dig Local Calls Via Avaya
    destination-pattern 9.......T
    session target ipv4:192.168.1.1
    dtmf-relay h245-alphanumeric
    no vad
    dial-peer voice 9513 voip
    description Outside 10 Dig Local Calls Via Avaya
    destination-pattern 9513.......
    session target ipv4:192.168.1.1
    dtmf-relay h245-alphanumeric
    no vad
    You can also configure the inter-digits timeout using the command timeouts interdigit under telephony-service.
    Please rate helpful answers!

  • Need a little help.... not major....but am unsure I have...

    Need a little help.... not major....but am unsure I have the 2.4 GHz Wireless-G Broadband Router Model WRT54G version 2 I had bought some time ago (over year and a half) and never really had it hooked up since I have been moving from place to place. Now that I'm retired and staying in one place I'm ready to set up. I find myself having "several" power adaptors and not sure which is the correct one. Can anyone tell me if all the broadband routers had the Linksys name and/or logo on them? None of the adapters I have do. I want to use a proper adapter so as not to damage....are there any specs that would be helpful so that one of these adapters would work? Also I'm running WindowsXP Sorry to bother you folks with a dumb question as I'm sure there are others with far more important questions and concerns. Although I can't tell other than the end going into the unit fits, I do have one Class 2 Transformer which might be the one it's about 1 1/2 inches thick, about 2 inches tall with following written information: Model 49-12-1000D CUI Inc Input AC 120V 60Hz 20W Output DC12V 1000mA Appreciate any help you can give.....I believe my unit is an older one based on version so there may have been a "fatter" adapter then than now.

    The power adapter output should be 12V, 0.5A(so 6W power rating)

  • Need a little Help with my new xfi titanium

    +Need a little Help with my new xfi titanium< A few questions here.
    st question? Im using opt out port on the xfi ti. card and using digital li've on a windows 7 64 bit system,? I would like to know why when i use 5. or 7. and i check to make sure each speakear is working the rear speakers wont sound off but the sr and sl will in replace of the rear speakers. I did a test tone on my sony amp and the speaker are wired correctly becasue the rear speakers and the surrond? left and right sound off when they suppose too. Also when i try to click on? the sl and sr in the sound blaster control panel they dont work but if i click on the rear speakers in the control panel the sl and sr sound off. Do anyone know how i can fix this? So i would like to know why my sl and sr act like rears when they are not?
    2nd question? How do i control the volume from my keyboard or from windows period when using opt out i was able to do so with my on board? sound max audio using spidf? Now i can only control the audio using the sony receiver.
    Thank you for any help..

    /Re: Need a little Help with my new xfi titanium? ?
    ZDragon wrote:
    I'm unsure about the first question. Do you even have a 7. system and receiver? If you just have 5., you should be able to remap the audio in the THX console.
    I do have a sony 7. reciever str de-995 its an older one but its only for my cpu. At first i didnt even have THX installed because it didnt come with the driver package for some reason until i downloaded the daniel_k support drivers and installed it. But it doesnt help in anyway.
    I have checked every where regarding the first question and alot of people are having problems getting sound out of there rear channels and the sound being re-mapped to the surround right and the surround left as if there rear left and rear right.
    I read somewhere that the daniel_k support drivers would fix this but it didnt for me and many others.
    For the second question i assumed it would be becasue of the spidf pass through and that my onboard sound card was inferior to the xfi titaniums. But i wasnt sure and i was hopeing that someone would have a solution for that problem because i miss controlling the volume with my keyboard.

  • Need a little help with syncing my iPod.

    I got a new macbook pro for cristmas and a few cds. After i tried to sync my ipod to itunes i put a symbol next to each song that i got from other cds saying that they were downloading but they werent. Also the cds i downloaded to my ipod for the first time didnt appear at all. Need help.

    /Re: Need a little Help with my new xfi titanium? ?
    ZDragon wrote:
    I'm unsure about the first question. Do you even have a 7. system and receiver? If you just have 5., you should be able to remap the audio in the THX console.
    I do have a sony 7. reciever str de-995 its an older one but its only for my cpu. At first i didnt even have THX installed because it didnt come with the driver package for some reason until i downloaded the daniel_k support drivers and installed it. But it doesnt help in anyway.
    I have checked every where regarding the first question and alot of people are having problems getting sound out of there rear channels and the sound being re-mapped to the surround right and the surround left as if there rear left and rear right.
    I read somewhere that the daniel_k support drivers would fix this but it didnt for me and many others.
    For the second question i assumed it would be becasue of the spidf pass through and that my onboard sound card was inferior to the xfi titaniums. But i wasnt sure and i was hopeing that someone would have a solution for that problem because i miss controlling the volume with my keyboard.

  • Greetings,   I need a little help. I have a WRT54G Wirele...

    Greetings,
    I need a little help. I have a WRT54G Wireless Router, and it worked well for years with my Alcatel DSL Modem (Bellsouth/ATT).  The modem went out and it was replaced with Westell Modem.  When I bypass the router I have no problem connecting to the Internet, however when I connect the router--no connection.  I thought it would not be a problem swapping the modem out.  I am running XP with Norton Internet Security and Anti-virus.  I have disabled Norton and do not believe that to be the problem.  Do I have to reconfigure the router?  If so, can I do it with the original install CD?  (I am disabled and the original CD/instructions/box is in the attic and I cannot get it easily.)  I have read several different threads, but they do not specifically address my problem.  Any assistance is appreciated.  Eddy

    Many Westell modems are actually "modem-routers" and they use the same 192.168.1.1  address space as your WRT54G.  This is the root of your problems.
    Try the settings at this URL.
    http://www.dslreports.com/faq/6323
    Note that the "WAN" port on the BEFSR41 in the example is the same as the "Internet" port on your WRT54G.
    Please let me know whether or not this worked for you.

  • Need a little help please    Airport Express

    Need a little help please.
    I am trying to set up a wireless network at my home using Airport Express.
    I have a regular phone line running in to I assume the modem. From there, there is an Ethernet cable running from that box to the back of the PC. My question is, I think, which of those do I unplug and plug into the Airport Express, the one on the back of the PC or the one that is in the back of the modem, or is this totally wrong.
    Any help would be appreciated…
    Thanks
    In advance…
    PS I have the manual but to me it is not very clear…

    Your connection sequence would look like this:
    Internet > Modem > AirPort Express >>>wireless to your computers.
    This means that you would unplug the cable that is now connected at the back of your PC and move that connection to the AirPort Express.
    Open Macintosh HD > Applications > Utilities > AirPort Utility
    Click Continue to follow the guided setup. On the third page, you will choose the option to "Create a wireless network" and continue the setup.

  • Quality Playback-.need a little help

    Quality Playback….need a little help
    I’ve posted in the Premiere forums too, because I’m not sure where my issue is in converting .MOD files, the export of edited footage from Preimere Pro CS4 or if it’s in Encore.
    The quality just does not seem that good, I know it’s not HD quality, but it should be better than what I have.  Seems over pixilated especially around objects.
    Here’s my steps
    Convert .MOD files using Mpeg Streamclip to a .DV file format
    Settings Compression DV (DV25)
    Standard NTSC 720 x 480 29.97 fps
    Aspect 16:0
    Everything else is default
    Import to Premiere Pro CS5
    Edit footage
    Export to quicktime .mov file
    NTSC DV Widescreen
    720 x 480 quality 100%
    codec is DV25 NTSC
    Import .mov files to Encore CS5
    Build menus and playlists
    Export with default settings approximately 1hr 45min of edited video
    Thanks
    MAB

    Bill
    Thanks for your help and patience.
    I posted a screen shot of the mov export settings I was using.  I’m going to try Ann’s conversion method on the mod files to see if that improves things.
    You asked about the Encore transcoding, what do you mean by that, are there other settings in Encore that I need to set?
    I have an 1hour 45 min of video in my Encore project, burning to a 4.7 DVD.  Encore says it’s using 3.3bg, which seems low.
    MAB

  • Need a little help in settings for RAID-0 please

    Hey folks I am trying to over-come some issues and I believe my raid settings are not right. In BIOS what should they read like. I have 2 drives.
    Raid -Enable (got that one right )
    IDE Primary Master Raid-Enable or Disable?
    IDE Primary Slave Raid-Enable or Disable?
    IDE Secondary Master Raid-Enable or Disable?
    IDE Secondary Slave Raid- Enable or Disable?
    SATA1 Raid-Enable or Disable?
    SATA2 Raid-Enable or Disable?
    SATA2 Raid-Enable or Disable?
    SATA3 Raid-Enable or Disable?
    SATA4 Raid-Enable or Disable?
    Thanks for the time and help folks.
    System spec.
    Athalon 64 X2 3800+ Manchester
    Motherboard: MSI KN8-F nForce 4 SLI (MS 7185)(red board)
    Cooling: ARTIC
    Memory: 1 GB Kingston CAS 2.5 value ram (2x512 dual channel DDR400-PC3200 -BIOS set at 2T)
    Video Card: SAPPHIRE X1800XT 256
    Harddisk: 2 Seagate Barracuda 7200.8 in raid 0
    CD/DVD Drive: Sony 810 dl dvd burner/MEMOREX 16X16 DVD DUAL LAYER
    CRT/LCD Model: Samsung 19 SyncMaster
    Case: Antec SonataII
    Sound Card: X-FI FATLITY cambridge dolby digital amp&speakers
    PSU: 450 watt True Power inc. with case
    Software: XP SP2
     

    Quote from: nascarmike on 29-January-07, 07:10:51
    When I reset BIOS they came back all enabled ( primary and secondary and all 4 SATA. How do I determine which channels are in use? Also which area in BIOS allows me to change from 64 to 16K? I'm a little lost noob (or due to age maybe some Alzimers?)thanks in advance.
    RAID is disabled by default.
    Enable SATA as RAID for channels where are your HDD detected: (example: if you are connected your SATA disks to SATA1 & SATA2, configure RAID for  SATA1 & SATA2.)
    after raid is enabled, and configured property leave BIOS (SAVE AND EXIT) you will need to setup your raid configuration, by pushing F10 to enter Raid setup after post:
    hit F10 when menu popup to enter RAID utility.
    •     Now select Striping, Mirroring, Striping+Mirroring, Spanning.
    •    Next push the tab key, and select the striping block size you want.
    •    Push the tab key again, and select the hard drives you want to include in the Raid array.
    •    Then push F7 to save and finish the Raid array.
    Choice Stripping mode for RAID mode and add both HDDs to array. select "Striping Block" to 16k.
    then hit F7 when you done. at next menu make your array bootable by selecting array and hit "B":
    config with "Y" when asked.
    NOTE: Information on both Disk will be lost.

  • Sorry but I need a little help from yours...(vivo function on FX 5600)

    Hi everybody, I've decided to post here in order to get some advices (maybe some of the moderators are not going to agree with me) from some of you (wonkanoby, Osnavi, Stu online, among others...) that I have the certainty that you could help me out here.
    So here it's the message posted in the VGA MSI cards forum, but I didn't received any answers... And I'm so sorry for doing this but I don't see any other option, I really appreciate your advices, so here it's:
            "Hi, I'm trying to use the VIVO function on a MSI Geforce FX 5600 but without any good result. I've installed the last WDM driver and also the lates Nvidia drivers, also the Info executable for Intel Chipset (inf, AGP), the motherboard can't asign an IRQ to the AGP (possible solution suggested by Nvidia itself to reponse to: "code 10 the device can't start"), I don't know if this mobo it's not compatible with this function or with this vid card. I'm pretty shure that I can't capture any video files without having the need of using any third part software (adobe premiere, capture solution, tv-christ, among others) and please advice me if I'm wrong, (I've tried MSI media Center deluxe without any success). The error code that the device manager shows is this(on nvidia WDM video Capture): Error code 10, the device can´t start.
    Any ideas are welcome.
    Here are the specs:
    Pentium 4 HT 2.8 mhz 800 fsb
    Intel 865gbf
    DDR sdram 512 pc 3200 x 2
    MSI Geforce FX 5600 128vtd VIVO
         Driver 6.6.8.1
         Driver WDM 2.2.0.0
    Toshiba 80gb 7200rpm sata port
    Audigy Gamer
    Fax modem Conexant
    4 Fan coolers
    PSU 400 watts"

    There may be an IRQ issue that the Intel crowd may be better suited to help with. You may have a device IRQ conflict, I've had this happen before and you have to look at your IRQ's for starters and look at slot population. The Creative card may be in a shared slot further complicating the issue or perhaps even the drivers are conflicting.
    I suggest you tell us what slots are populated and post your IRQ's.
    Go to Start>AllPrograms>Accessories>System Information~>Hardware Resources>IRQ's (Use the Edit menu to select all and copy, then post your IRQ's like this:
    IRQ 0   System timer   OK
    IRQ 1   Standard 101/102-Key or Microsoft Natural PS/2 Keyboard   OK
    IRQ 4   Communications Port (COM1)   OK
    IRQ 5   WinFast TV2000 XP WDM Audio Capture   OK
    IRQ 6   Standard floppy disk controller   OK
    IRQ 8   System CMOS/real time clock   OK
    IRQ 9   Microsoft ACPI-Compliant System   OK
    IRQ 11   NVIDIA nForce PCI System Management   OK
    IRQ 12   PS/2 Compatible Mouse   OK
    IRQ 13   Numeric data processor   OK
    IRQ 14   Primary IDE Channel   OK
    IRQ 15   Secondary IDE Channel   OK
    IRQ 16   RADEON X800 XT Platinum Edition   OK
    IRQ 17   WinFast TV2000 XP WDM Video Capture   OK
    IRQ 18   Creative SB Audigy 2 ZS (WDM)   OK
    IRQ 19   OHCI Compliant IEEE 1394 Host Controller   OK
    IRQ 20   Standard Enhanced PCI to USB Host Controller   OK
    IRQ 21   NVIDIA Network Bus Enumerator   OK
    IRQ 22   Standard OpenHCD USB Host Controller   OK
    IRQ 23   Standard OpenHCD USB Host Controller   OK

  • New to mac.. need a little help

    I am relatively new to macs and need a lil help understanding what's going on with my computer. I recently got a lend of a powerbook G4 from a friend and it has a tendency to freeze up completely and I have to just hold the power button until it turns off then it when I turn it back on it will work ok again sometimes for several hours without a hitch.
    Also, sometimes instead of freezing up I'm just not able to type. I can do everything else with the mouse or open programs and such but when I try to type it just doesn't work (and again, restarting fixes the prob).
    Looking for help .. if anyone knows why it may be doing this and/or how to fix it your help would be greatly appreciated. Thanks

    Welcome to the Apple discussions.
    First, check your hard drive free space. Click on the apple on the menu bar, about this mac, ata, and click on the hard drive under ata bus (DVD drive is listed there too). That will tell you the drive capacity and how much is available. You want 10% to 15% of the total capacity to be available for systems usage. If less than that, performance can slow to a crawl, and some of the issues you identified could be due to low free disk space.
    Next, you should have a backup of the hard drive, if there's anything you want to keep.
    Download the program OnyX from http://www.titanium.free.fr/pgs2/english/download.html . Run the tasks on the cleaning and maintenance tabs. A number of people have found this helps clean up the hard drive and contributes to improved performance.
    This FAQ has some good advice for performance tuning: http://www.thexlab.com/faqs/performance.html
    If, after cleaning your system and tuning it up, you're still having problems, please post back with specifics.

  • Multithreading server /- client doesnt update need a little help

    I have three classes, one is my client called lobby, the second is my server, then my third is the server thread. Everything works but the client doesnt seem to update unless you type stuff in and hit enter or press send and that isbecause of the key and action listeners, how do i go about having to updating every 10 seconds or less..? I tried doing a while statement and of course it freezed it because its an infinite loop, tried making it a thread, not to good at that, i just need some advice on how to solve this problem, thanks.
    public class Lobby extends JPanel {
         public Lobby()
              listenSocket();
              send = new JButton("Send");
              chatter = new JTextField();
              motd = new JLabel("The Lobby");
              this.setLayout(new MigLayout());
              this.setSize(800, 600);
              this.setBackground(Color.white);
              this.setAutoscrolls(true);
              this.add(motd, "span 1, align center");
              this.add(UserListTop(), "align center, wrap");
              this.add(ChatBox(), "");
              this.add(UserList(), "wrap");
              this.add(Chatter(), "");
              this.add(Send(), "");
              this.setVisible(true);
         public Component ChatBox()
              Dimension dscroll = new Dimension(590, 400);
              chatbox = new JTextArea(20, 50);
              chatbox.setLineWrap(true);
              chatbox.setEditable(true);
              chatbox.setWrapStyleWord(true);
              JScrollPane areaScrollPane = new JScrollPane(chatbox);
              areaScrollPane.setVerticalScrollBarPolicy(
                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
              areaScrollPane.setAutoscrolls(true);
              areaScrollPane.setPreferredSize(dscroll);
              return areaScrollPane;
         public Component Chatter()
              KeyListener enter = new KeyListener()
                   @Override
                   public void keyPressed(KeyEvent event) {
                        if((event.getKeyChar() == KeyEvent.VK_ENTER) && (chatter.getText() != "") && (chatter.getText() != null))
                             //Send data over socket
                             String text = chatter.getText();
                             out.println(text);
                             chatter.setText(new String());
                             //Receive text from server
                             try{
                                  String line = in.readLine();
                                  chatbox.append("Usernamehere: " + line + "\n");
                             } catch (IOException e){
                                  System.out.println("Read failed");
                                  System.exit(1);
                   @Override
                   public void keyReleased(KeyEvent e) {
                   @Override
                   public void keyTyped(KeyEvent e) {
              String line;
              try {
                   line = in.readLine();
                   chatbox.append("usernamehere: " + line + "\n");
              } catch (IOException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
              chatter.addKeyListener(enter);
              Dimension chattersize = new Dimension(590, 30);
              chatter.setPreferredSize(chattersize);
              chatter.setVisible(true);
              return chatter;
         public Component Send()
              ActionListener sendl = new ActionListener()
                   @Override
                   public void actionPerformed(ActionEvent event) {
                        Object source = event.getSource();
                        if(source == send){
                             //Send data over socket
                             String text = chatter.getText();
                             out.println(text);
                             chatter.setText(new String(""));
                             //Receive text from server
                             try{
                                  String line = in.readLine();
                                  System.out.println("UserNameHere: " + line);
                                  chatbox.append("Usernamehere: " + line + "\n");
                             } catch (IOException e){
                                  System.out.println("Read failed");
                                  System.exit(1);
              send.addActionListener(sendl);
              send.setVisible(true);
              return send;
         public Component UserListTop()
              JLabel userlisttop = new JLabel("Players");
              return userlisttop;
         public Component UserList()
              Dimension scrollsize = new Dimension(170, 400);
              String names[] = new String[1500];
              for(int i = 0; i < 1500; i++)
                   names[i] = "Player" + i;
              userlist = new JList( names );
              userlist.setBackground(Color.white);
              userlist.setSize(50, 200);
              JScrollPane userlistscroll = new JScrollPane(userlist);
              userlistscroll.setPreferredSize(scrollsize);
              return userlistscroll;
         public void listenSocket(){
              //Create socket connection
              try{
                   socket = new Socket("localhost", 4444);
                   out = new PrintWriter(socket.getOutputStream(), true);
                   in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
              } catch (UnknownHostException e) {
                   System.out.println("Unknown host: localhost");
                   System.exit(1);
              } catch  (IOException e) {
                   System.out.println("No I/O");
                   System.exit(1);
    }

    3rd class
    package server;
    import java.io.DataInputStream;
    import java.io.IOException;
    import java.io.PrintStream;
    // This client thread opens the input and the output streams for a particular client,
    // ask the client's name, informs all the clients currently connected to the
    // server about the fact that a new client has joined the chat room,
    // and as long as it receive data, echos that data back to all other clients.
    // When the client leaves the chat room this thread informs also all the
    // clients about that and terminates.
    import java.net.Socket;
    public class clientThread extends Thread{
        DataInputStream is = null;
        PrintStream os = null;
        Socket clientSocket = null;      
        clientThread t[];
        public clientThread(Socket clientSocket, clientThread[] t){
         this.clientSocket=clientSocket;
            this.t=t;
        public void run()
         String line;
            String name;
         try{
             is = new DataInputStream(clientSocket.getInputStream());
             os = new PrintStream(clientSocket.getOutputStream());
             os.println("Enter your name.");
             name = is.readLine();
             os.println("Hello "+name+" to our chat room.\nTo leave enter /quit in a new line");
             for(int i=0; i<=9; i++)
              if (t!=null && t[i]!=this)
              t[i].os.println("*** A new user "+name+" entered the chat room !!! ***" );
         while (true) {
              line = is.readLine();
    if(line.startsWith("/quit")) break;
              for(int i=0; i<=9; i++)
              if (t[i]!=null) t[i].os.println("<"+name+"> "+line);
         for(int i=0; i<=9; i++)
              if (t[i]!=null && t[i]!=this)
              t[i].os.println("*** The user "+name+" is leaving the chat room !!! ***" );
         os.println("*** Bye "+name+" ***");
         // Clean up:
         // Set to null the current thread variable such that other client could
         // be accepted by the server
         for(int i=0; i<=9; i++)
              if (t[i]==this) t[i]=null;
         // close the output stream
         // close the input stream
         // close the socket
         is.close();
         os.close();
         clientSocket.close();
         catch(IOException e){};

  • Need a little help with G3 Clameshell...Please

    I just received this Clameshell, and it only has OS9 on it, I haven't used 9 in forever, and really need to get OSX on it. I have retail Panther cd's. But I hear I need to update the firmware, if it isn't updated yet.
    I know I can find out which I have in System Profiler, but I can't find it in there. Is it called something else? What part of System Profiler is it in(in OS9).
    Also, I have Cable net, this Clamshell was always used with dial up, how can I switch things around in it so I can hook up my ethernet cable and run with it? Is that possible with OS9? Or will I have to update the firmware a different way.
    I am stuck. Need lots of help.
    Thanks!!!
    veganjustice

    Is it called something else? What part of System Profiler is it in(in OS9).
    It is in the field called "Boot ROM".
    ...how can I switch things around in it so I can hook up my ethernet cable and run with it?
    Open the TCP/IP control panel. Configure it to use Ethernet and DHCP to get an IP address.

Maybe you are looking for