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


Groups > comp.lang.java.gui > #4084

Re: recreating timesharin

From "Daniele Futtorovic" <daniele.futtorovic@THRWHITE.remove-dii-this>
Subject Re: recreating timesharin
Message-ID <g8ugah$iqd$1@registered.motzarella.org> (permalink)
Newsgroups comp.lang.java.gui
References <7df04a4a-bf7a-4615-9fb8-6a1664f231c5@d45g2000hsc.googlegroups.com>
Date 2011-04-27 15:48 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
On 25/08/2008 16:29, Tom A. allegedly wrote:
> I was looking through some old pascal line printer listings from
> <mumble mumble> decades ago, and thought I'd try to recreate an old
> game I wrote in Java.  Java, of course, doesn't do WRITELN and READLN
> from the terminal, 

Doesn't it?

<http://java.sun.com/docs/books/tutorial/essential/io/cl.html>

> so I created a jframe 

JFrame

> with a  jscrollpane

JScrollPane

> containing a jtextarea 

JTextArea

> for output, and below that a jtextfield 

JTextField

> to be
> the input area.  The question is, how to make the program stop and
> wait for input when it needs it.
> 
> I created a class called BasicIO that had a synchronized readln()
> method that did a wait(), and an event listener that would do a
> notify() when the event was from the input field, but it kept giving
> me an
> IllegalMonitorStateException.

Because you haven't acquired the Object's monitor.
<http://java.sun.com/javase/6/docs/api/java/lang/IllegalMonitorStateException.html>

> Obviously, I'm quite confused by threads and monitors, and was hoping
> someone could enlighten me?

<http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html>

And encompassing:
<http://java.sun.com/docs/books/tutorial/reallybigindex.html>

-- 
DF.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

recreating timesharing IO "Tom A." <tom.a.@THRWHITE.remove-dii-this> - 2011-04-27 15:48 +0000
  Re: recreating timesharin "Stefan Rybacki" <stefan.rybacki@THRWHITE.remove-dii-this> - 2011-04-27 15:48 +0000
  Re: recreating timesharin "Daniele Futtorovic" <daniele.futtorovic@THRWHITE.remove-dii-this> - 2011-04-27 15:48 +0000
    Re: recreating timesharin "Tom A." <tom.a.@THRWHITE.remove-dii-this> - 2011-04-27 15:48 +0000
      Re: recreating timesharin "Daniele Futtorovic" <daniele.futtorovic@THRWHITE.remove-dii-this> - 2011-04-27 15:48 +0000
  Re: recreating timesharin "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:48 +0000
    Re: recreating timesharin "Tom A." <tom.a.@THRWHITE.remove-dii-this> - 2011-04-27 15:48 +0000

csiph-web