Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you caught #3, which is the root of the poster's problem. The static thing was just an aside :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Also, don't make everything in your class static for no reason.

sciwizeh commented: can't believe i didn't notice nice catch +1
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Never having used any GObject components, I don't really understand exactly what you are wanting to emulate.

As far as other rendering strategies, it really depends on what you're doing now and what you're wanting to change about it.

You might find some value in looking through the source code examples from the book Filthy Rich Clients. The code can be downloaded from the "Examples" side tab (no direct link to it or I would link there instead). The authors cover many techniques for rendering various graphical effects.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That is just a method declaration, not a constructor. As already stated above, constructors do not specify a return type because they always return an instance of that class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, the most noticeable thing right off the bat is wildly inconsistent naming and formatting conventions. Yes, they actually matter.
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, it was just a guess since you failed to actually post any code which would have made a better answer possible...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Most likely you're not importing the class of the object being read.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

" tried to help anywayz." ?
Odd way of thanking those who gave you information based upon your less-than-precise posts. If by "tried to" you mean "didn't write the code for you", then perhaps you misunderstood their intent.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And those are not opening IE or Firefox in a Java frame - they are Java component implementations of a standards-compliant browser.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, some of their examples can be more complex than need be and obscure the usage they are trying to demonstrate. :(

One more thing worth noting with respect to AffineTransforms is that they represent the current state of the coordinate system within the graphics context. Since you can store references to as many AffineTransforms as you want, you can effectively "save" any state (translation, orientation, scale, and sheer) you wish and restore it at will. If you have many objects that render themselves independently, each can maintain it's own transform that it uses for rendering. When that object's turn to be rendered comes, you can save the current transform of your graphics context, apply that object's transform, render it, and then restore the original transform.

Here's an example of that:

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.AffineTransform;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class TransformExample extends JFrame {

    GraphicPanel gPanel;

    public TransformExample() {
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        gPanel = new GraphicPanel();
        getContentPane().add(gPanel);
        setBounds(100, 100, 200, 200);
        setVisible(true);
    }

    class GraphicPanel extends JPanel {
        TextLabel label1;
        TextLabel label2;
        TextLabel label3;

        protected void paintComponent(Graphics g) {
            if (label1 == null) {
                // lazy initilization so I have dimensions to work with
                FontMetrics fm = g.getFontMetrics();
                int width = getWidth();
                int height = getHeight();
                
                label1 = new TextLabel("Hi Vernon", Color.YELLOW, 
                  20, height/2, -Math.PI/2);
                
                String labelText = "I'm over here";
                int labelLen = fm.stringWidth(labelText);
                label2 = new TextLabel(labelText, Color.CYAN, 
                  width-labelLen, height/2, …
VernonDozier commented: Exactly what I was looking for! +6
Alex Edwards commented: Excellent example of professional programming. +3
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you bothered to read the link he posted, in Drawing Geometric Primitives, they discuss the rounded rectangle and oval both.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Have you looked at any of the tutorials and sample code in the Sun JMF section? There is a lot of information there for you to learn from.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The link that I posted in your other thread about not displaying the image covers this...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You have made this a bit more complex than need be. For simple transformations, the Graphics2D methods rotate() and translate() will suffice (they additively modify the current AffineTransform of the graphics context) without any need to obtain or work with an AffineTransform object directly.

I wrote this small example that might help

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class TextExample extends JFrame {

    GraphicPanel gPanel;

    public TextExample() {
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setLayout(new BorderLayout());
        gPanel = new GraphicPanel();
        getContentPane().add(gPanel, BorderLayout.CENTER);
        setBounds(100, 100, 200, 200);
        setVisible(true);
    }

    class GraphicPanel extends JPanel {
        protected void paintComponent(Graphics g) {
            Graphics2D g2 = (Graphics2D)g;
            g2.setBackground(Color.BLACK);
            g2.clearRect(0, 0, getWidth(), getHeight());
            g2.setColor(Color.WHITE);
            String msg = "Hi Vernon";
            FontMetrics metrics = g2.getFontMetrics();
            // translate context to center of panel
            // the point 0,0 now resides here
            g2.translate(getWidth() / 2, getHeight() / 2);
            g2.drawString(msg, -metrics.stringWidth(msg) / 2, 
              metrics.getMaxAscent() / 2);
            // rotate 45 deg
            g2.rotate(-Math.PI / 4);
            g2.setColor(Color.YELLOW);
            g2.drawString(msg, -metrics.stringWidth(msg) / 2, 
              metrics.getMaxAscent() / 2);
            // rotate 45 deg again - these transforms are additive
            g2.rotate(-Math.PI / 4);
            g2.setColor(Color.ORANGE);
            g2.drawString(msg, -metrics.stringWidth(msg) / 2, 
              metrics.getMaxAscent() / 2);
        }
    }

    public static void main(String... args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TextExample();
            }
        });
    }
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

i don't understand how byte stream could read images. does it need help of applets or else.

Images are comprised of bytes.
You want to read them.
Byte streams read bytes.
You use a byte stream.

...

Alex Edwards commented: Spoon feed-- +3
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You could use two Executors to separately submit sound and graphic update tasks.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Oh, and what about the Metaprogram compiles for languages that support templates?

Would that not be longer if there are a lot of template algorithms used? >_>

I am kidding a bit:)
Obviously I can't speak for many platforms that I've never used and "massive project" could encompass many builds that do perhaps take a long time ("long time" not really being quantified either).
The statement did remind me however of a co-worker's story of some training class he had to take years ago in which the "instructor" (using the term loosely, since he pretty much just read the Powerpoint slides to them) told them that it was more efficient to have all of their code read by someone else (yes, read, line by line) before compiling it - and no, he was not referring to logical code reviews. When they asked him to clarify that a little, since most of the people in the class were sure he couldn't really mean what he was implying, he said syntax errors could waste a lot of compile time that could be avoided by carefully checking the code first. :-/

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you have specific questions, post your current code in [code] [/code] tags and your questions or errors. If you have no idea how to proceed and need someone to walk you through the whole thing you are probably out of luck.

(And using 17 exclamation points does not get help faster - it might just have the opposite effect)

Alex Edwards commented: ! +3
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

error in sentence: ...Its round, like a Apple

Error in sentence: It's round like an apple.

(Since we're correcting things...)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And you registered just to post that? Smells like spam to me...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Your professor may have last compiled a "massive project" in 1970. :)
My workstation compiles and jars a Java project of 869 source files in ~20 seconds. Incremental background compiles while editing are near enough real-time.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

See Chapter 7: Polymorphism here: http://www.codeguru.com/java/tij/tij_c.shtml

And please tone down the exclamation points a bit when posting.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Why not just start the sound and then paint the image in the same thread?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, I would think it unlikely that you are going to retrieve 10 images per second from an HTTP connection, but you could use a Timer to repeat the HTTP GET requests on the connection on a set timing interval.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I already provided links above that cover the major steps involved. If you need more general links on Java, look through the "Read Me: Starting Java" thread that is stickied at the top of the forum.

Alex Edwards commented: You have a lot of patience. +3
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can write it in any editor that you please. Read the links and check the API docs for those classes that you do not know.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ok!! You just need to open an input stream from the URL, parse that for what you want, and write it to a text file!!

!!!!!

(All those exclamation points just look silly, don't they?... )

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

i would ask that all software developers make programs that work and do the job right the first time

Oh, well sorry, that goes against our desire to make programs that don't work and do the job wrong, just to laugh at your frustration with it.

i also think techies that work on computers should share a close bond with software developers. it is very important for it to all live in harmony like it does when it exists in side of a computer case.

Your statement above calls into question your desire for harmony.

Nick Evan commented: Haha +8
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, simply no, you cannot load an external browser program into a JFrame. They are not Java components - they are standalone programs.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There is no specific method for that. Just use add() and remove() to switch their places.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Most likely it's a resource location issue. You should use getClass().getResource(String) to locate the resource to load. You can read more about that here: http://java.sun.com/docs/books/tutorial/uiswing/misc/icon.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Look at your main method. You declare public class StackClass as the first statement. You cannot declare a public class in that method. (You could declare a local class there but I really doubt that is your intent)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You cannot declare a class inside your main method.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Help yourself instead, by figuring this out and coding it. It's YOUR project and you are supposed to be learning something from this. What do you plan to do after you leave school when you have a project assigned to you? Ask people on the internet to hand you a solution?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I already offered advice on that - learn audio signal processing and perhaps some machine learning theory.

No one here is going to be able to teach you speech recognition code. It's a very complex topic that you are going to need to research for yourself and experiment with.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Hey, The Dude- Do you do anything except post links? Damn.. you definitely need to get a life. What a pathetic dumbass.

Says the pathetic troll...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, this would seem rather suspect in it's intent.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

not the main loop, i get why you are using a loop there but why this:

while ( payrate <= - 1 ) {
    System.out.print ( "Please enter a positive number." ) ;
    payrate = input.nextDouble ( ) ;
}

all this does is keep taking in a number and rewriting a variable's value until the value is less than -1. you do this twice, and there is no need for the while loop.

I believe you are mis-reading the loop. It will loop until a value greater than -1 is entered, the intent being to ensure a positive value for the rate. It really should use payrate <= 0 though, since anything less than or equal to zero would be invalid.

To the poster, sciwizeh already pointed out the "stop" loop problem. Use !employeeName.equals("stop") or !employeeName.equalsIgnoreCase("stop") to compare the strings. Do not use == or != for string comparison.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You won't need much of anything in second year if you don't pay attention in class and pass the one's required in first year.

Perhaps you should take a look at the "Starting Java" FAQ stickied at the top of this forum if you have no relevant class materials to refer to.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Place that code in a method of your ListTest() class rather than adding it directly in main(). main() should be performing operations on your ListTest instance and should not directly operate on any members of that class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm just getting to the point I won't read code that isn't in code tags. I may reply that they need to post the code in tags, but if the code isn't formatted the question can go unanswered for all that I care.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And yet you still have not posted the code in code tags, nor posted the compiler errors you are getting.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

1) Put code between [code] [/code] tags when posting it (There is a button that will surround highlighted text with code tags in the toolbar of the post editor as well)
2) Compiler errors tell you explicitly what the problem is and on what line it occurs. Read them. Post them with your code if you don't understand them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That thread is a continuation of a couple more before it. There is also a lot of background reading here: http://episteme.arstechnica.com/eve/forums/a/tpc/f/770002407831/m/841006407831

One post the posters in that thread, "BadAndy" has been involved with the NOAA work at some level I believe.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

For those who wish to read through a more informed discussion of the matter:
http://episteme.arstechnica.com/eve/forums/a/tpc/f/770002407831/m/822003949831

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Given a Graphics2D context reference of "g2", you just call g2.rotate(theta) to rotate about the origin theta radians.
(Keeping in mind that the transformations are cumulative - the rotation and translation transforms are concatenated with the current transform on each call)