Re: AWT Bug? Threading problem? Or am I losing my mind?
> > Here's my explanation: > the event distributing thread is a higher-priority thread than the > repainting one, and this somehow messes up the repaint() call. > Your closee but its worse than that, If you put a print in your actionperformed method that prints of the thread id and another one in your paint method, you will unfortunatelly see they are the same thread at least under solaris and NT I haven't bothered to look on Linux. So your right it is a problem but not an easilly fixed one. My usual work around and probablly a good idea since you don't want to tie up your event thread for to long anyway is to have your actionperformed start up a thread and then return you can use Thread or SwingWorker to do this java says SwingWorker is the right way but I always forget to use it. Brad -- --- There are two kinds of knowledge, you either know the answer or you know where to find it -Kane, Johnson, and anonymous
Re: AWT Bug? Threading problem? Or am I losing my mind?
Dustin Lang <[EMAIL PROTECTED]> writes: > Let's make the assumption that I haven't made a glaring error (may not be > a reasonable assumption since my brain is a bit fried), and assume that > this is in fact a bug. Now, this is by no means a major bug, and I'm sure > I could do a work-around, but if repaint(10L) is called, shouldn't paint > get called within 10 ms, regardless of what other threads are executing? > Or am I on crack? I's a little tricky when you're out on the event dispatching thread ;-) The repaint calls will be batched up until the event is processed. > import java.awt.*; > > public class Light extends Canvas { > > int dia; > > public Light(int d) { > dia = d; > } > > public Dimension getPreferredSize() { > return new Dimension(dia,dia); > } > > public void setColor(Color c) { > setForeground(c); > System.out.println("Repaint!"); // repaint(10L) removed Graphics g = getGraphics(); if (g != null) { update(g); // do an immediate update } } > } > > public void update(Graphics g) { > System.out.println("Update!"); > paint(g); > } > > public void paint(Graphics g) { > System.out.println("Painting (color is " + getForeground().toString() >+ ")"); > g.setColor(getBackground()); > g.fillRect(0,0,getSize().width,getSize().height); > g.setColor(getForeground()); > g.fillOval(0,0,dia,dia); > } > } Jürgen -- Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V Baroper Strasse 301, D-44221 Dortmund, Germany Phone: ++49 231/755-5806, Fax: ++49 231/755-5802
[Fwd: swingset/tableview does not work in 1.1.6v2]
1.1.6v2 glibc doesn't work very well. Running the swingset application demo - - It sometimes hangs on startup - Select the Tableview subdemo, try typing in a 'favorite sport' cell: each character except the first is inserted twice; return is inserted as 'o' (rather than ending the editing as it is supposed to). 1.1.5v5-980311 works ok. This is on redhat5.0 with upgraded glibc & ld.
BDK on 1.1.6v2
This mostly appears to work, however the juggler bean is unable to find the image files in the juggler.jar file. The reason for this appears to be that in the method loadImage getClass().getResource(name) is returning null in Juggler.java (BDK/demo/sunw/demo/juggler/Juggler.java) when name is the name of an image file. It should actually be returning the content handle which refers to an ImageProducer. The juggler demo does run fine as an applet, just not in the BeanBox. I'm running an updated version of Redhat 5.1. Anyone know how to get around this? Thanks, David. PS. I've tried the install shield that comes with the BDK on an SGI and under Linux, in both cases it barfed. Very odd, fortunately it is easy to extract the BDK by hand.
Re: Java classes graphically
[EMAIL PROTECTED] wrote: > Hello all, > >I'm all new here. I would like to gain pretty good understanding of > Java. I have quite solid understanding of OOP/OOD. I've gone through some > Java tutorials a few months back and fooled around with it somewhat. So I > know, say, the syntax of the Java language. What I don't know is how to > piece all the stuff together -- I.e. how to use all the standard classes > provided. > >I imagine that when I see a complete map of (inheritance) structure of > all the classes and look at all their data members and methods, and when I > look at examples from each separate inheritance tree, I'll gain the first > basic fundamental understanding on how the pieces fit together. >The media that I could utilize best, I hope, is The Net (URLs) -- that > way I can take a diagram that wouldn't fit on a regular sized paper, > enlarge it, chop it up into regular sized paper, print it out onto regular > sized paper, and paste the sheets together to get a poster giving me all I > want. > >If you don't think that there is anything on the web, please recommend > me a book which might contain such a poster please. I'll call local > computer bookstore and see whether they have it. > >The point of this exercie is to gain a decent understanding of Java > programming before Monday. So I got like 36 hrs. So this is, I guess, a > bit URGENT ;-) I would recommend the following books ( surf to http://www.ora.com ) 1) Exploring Java To learn about the programming langauge. 2) Java In A Nutshell For inheritance diagrams and quick reference manual 3) Java Examples In A Nutshell For many nice example programs I have got the Core Java I and II big books, but hearsay is very good about 'em For Swing/JFC Programming. Programming with the JFC I bought this book a month ago, it is quite good, but I have forgotten the author's name Mail me tomorrow. It has a CD ROM of Swing/JFC JDK1.1 for Win95 though. A very new book : Core Java Foundation Classes Prentice Hall. This is very concise book no trivial code here, but lots real examples. It is expensive 46.99 British Pounds compared to 49.99 USDollars! I think it has the same class as the O'Reilly Motif Programming Manual Vol 6 from X Window Series from 5 years ago. Bill your company so there. Cheers Peter -- import java.std.disclaimer.*; // "Dontcha just love the API, baby bop!" Peter Pilgrim Dept:OTC Derivatives IT, Deutsche Bank (UK) Ltd, Groundfloor 133 Houndsditch, London, EC3A 7DX Tel: +44-545-8000 Direct: +44 (0)171-545-9977 Fax: 0171-545-4313 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Re: Java classes graphically
As always when it is about books I recommand to look at http://www.mcp.com/personal/ There you can get ONLINE for free full books like the great Java 1.1 Unleashed of Sams and another about 15-20 (!) titles about Java. It is true that not all of them are very new, but there are some very fresh titles like the Java 1.1 Unleashed third edition. Rani. On Mon, Aug 10, 1998 at 04:13:19PM +0100, [EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > Hello all, > > > >I'm all new here. I would like to gain pretty good understanding of > > Java. I have quite solid understanding of OOP/OOD. I've gone through some > > Java tutorials a few months back and fooled around with it somewhat. So I > > know, say, the syntax of the Java language. What I don't know is how to > > piece all the stuff together -- I.e. how to use all the standard classes > > provided. > > > >I imagine that when I see a complete map of (inheritance) structure of > > all the classes and look at all their data members and methods, and when I > > look at examples from each separate inheritance tree, I'll gain the first > > basic fundamental understanding on how the pieces fit together. > > > >The media that I could utilize best, I hope, is The Net (URLs) -- that > > way I can take a diagram that wouldn't fit on a regular sized paper, > > enlarge it, chop it up into regular sized paper, print it out onto regular > > sized paper, and paste the sheets together to get a poster giving me all I > > want. > > > >If you don't think that there is anything on the web, please recommend > > me a book which might contain such a poster please. I'll call local > > computer bookstore and see whether they have it. > > > >The point of this exercie is to gain a decent understanding of Java > > programming before Monday. So I got like 36 hrs. So this is, I guess, a > > bit URGENT ;-) > > I would recommend the following books ( surf to http://www.ora.com ) > > 1) Exploring Java > To learn about the programming langauge. > > 2) Java In A Nutshell > For inheritance diagrams and quick reference manual > > 3) Java Examples In A Nutshell > For many nice example programs > > I have got the Core Java I and II big books, but hearsay is very good about 'em > > For Swing/JFC Programming. > > > Programming with the JFC > I bought this book a month ago, it is quite good, but I have forgotten the author's >name > Mail me tomorrow. It has a CD ROM of Swing/JFC JDK1.1 for Win95 though. > > > A very new book : Core Java Foundation Classes > Prentice Hall. This is very concise book no trivial code here, but lots real >examples. > It is expensive 46.99 British Pounds compared to 49.99 USDollars! > I think it has the same class as the O'Reilly Motif Programming Manual Vol 6 > from X Window Series from 5 years ago. Bill your company so there. > > > > > > > > Cheers > > Peter > > -- > import java.std.disclaimer.*; // "Dontcha just love the API, baby bop!" > Peter Pilgrim Dept:OTC Derivatives IT, > Deutsche Bank (UK) Ltd, Groundfloor 133 Houndsditch, London, EC3A 7DX > Tel: +44-545-8000 Direct: +44 (0)171-545-9977 Fax: 0171-545-4313 > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > > -- -- Rani Pinchuk <[EMAIL PROTECTED]> Tel: +32-3-326-79-97 http://www.kinetica.com/home/pinchuk --
Re: Java classes graphically
I'm using _The Java Class Libraries Second Edition, Volume 1_ by Patrick Chan and company from Sun. It covers java.io, java.lang, java.math, java.net, java.text and java.util. It is 2000 pages long and full of examples. Volume 2 covers applets and other stuff but I didn't buy it because I'm not working with that stuff and the books are expensive. This is not a tutorial -- the classes are listed in alphabetical order. Bruce Eckel's _Thinking in Java_ is probably better for getting started. I started out with O'Reilly's _Java In A Nutshell_ which is also pretty good.
More AWT Woes...
Hi again, I tried putting in a Toolkit.sync() in my traffic-light problem... in fact I loaded it down with many sync()s, but still with no luck. Is there something so wrong with traffic lights? Oh well, time to do some threading... Seeya, dstn. - Dustin Lang, [EMAIL PROTECTED]
JDK fonts. Please help.
Hi All, I'm trying to make my jdk116v2 work. I looked to the archive, but didn't found exact solution to my problem. Running "java my_application" had very terrible fonts all around - buttons, labels, etc. Looked like only bitmap fonts had been scaled and displayed. After messing around with font.properties and replacing all Java fonts to proportional (vector), I got buttons and labels looking Ok. But there is another problem that persists- java.awt.TextField doesn't display anything (or cuts text) unless it has been increased in size to some non-practical value (40 pixel in height, I need 20). Is there any solution for this? Java code is generated by IBM Visual Age for Java. I tried recompiling sources in Linux - no effect. Thank you. Edward