Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

127.0.0.1

You don't need anything more than local tools while you're just learning.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You really should have your game loop running in a separate thread, process and update your object interactions in that loop and then repaint(). Leave paintComponent() to its intended purpose of just rendering that component on the screen.

Here are a couple of tutorials on game/animation rendering if you'd like to see some alternatives:
http://www.cokeandcode.com/spaceinvaderstutorial
http://www.developer.com/java/other/article.php/893471/Fun-with-Java-Sprite-Animation-Part-1.htm

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

paintComponent() can definitely be called often and you really shouldn't be creating any new components in that method. It should just handling painting the component to the screen. Perhaps you should pop up the other screen from whatever event ended play.

Edit: Just a note on the double call: it's most likely being called a second time because it has to re-render the screen after you pop up a frame on top of it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I modified your code just a little (see below) to use a static alert() message (I didn't have a file for those) and fixed the minor error with the 'x' variable in your fwrite() code, and it did the replacement just fine. If you're looking at your print_r($temparray1) output in a browser, you won't see most of the text because it's markup with very little textual content. Look at the page source and you'll see all of the tags as text.

<?php
$svg = 'testIn.xml';
                        if(file_exists($svg))
                        {
                            // $file1=fopen($uploadfile,'r');
                            // while(!feof($file1))
                            // {
                                // $theData=fgets($file1);
                                // $temparray[]=preg_split("/[:\s,]+/",$theData, -1, PREG_SPLIT_NO_EMPTY);
                            // }
                            // fclose($file1);
                            // for($x=2; $x<count($temparray); $x++)
                            // {
                                // $labels[]=$temparray[$x][0];
                            // }
//above code is pulling information from another file to populate the alert function with
                            $labelCount = 0;
                            $file=fopen($svg,'r');
                            while(!feof($file))
                            {
                                $theData=fgets($file);
                                $pattern = "{transform='translate\((.+?)\) scale\((.+?)\)'\/\>}";
                                if(preg_match($pattern, $theData)>0)
                                {
				    echo "Match<BR>";
                                    $alertVar = 'hi';
                                    $replace = "transform='translate($1) scale($2)' onclick=\"alert('$alertVar')\"/>";
                                    $changedData = preg_replace($pattern, $replace, $theData);
                                    $temparray1[]=$changedData;
                                }
                                else
                                {
                                    $temparray1[]=$theData;
                                }
                            }
                            fclose($file);
                            print_r($temparray1);
							
                           $file2=fopen('testOut.xml', 'w');
                           for($x=0; $x<count($temparray1); $x++)
                           {
                               fwrite($file2, $temparray1[$x]);
                           }
                           fclose($file2);
//this code is for writing everything back out
                        }

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

Create a class to hold that data. Return an instance of that class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There are a couple of different methods for setting various icons for the button, including setPressedIcon(). Here's a list: http://java.sun.com/docs/books/tutorial/uiswing/components/button.html#contents

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

:icon_tortellini

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The answer has been posted 10+ times in this thread. Have you bothered to read it?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Hey, if you can't pasta the pasta, then pasta you should just pasta pasta.

maydhyam commented: For real... +0
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't see anything wrong with what you have there. Have you tried running it through a PreparedStatement?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you don't make an effort soon, it will be an easy calculation

GPA = 0;
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Perhaps this?

$alertVar = 'Your variable here';
$pattern = "{transform='translate\((.+?)\) scale\((.+?)\)'\/\>}";
$replace = "transform='translate($1) scale($2)' onclick=\"alert('$alertVar')\"/>";
$string = '<a xlink:title="Plot #1" xlink:show="new"/>
<g style="fill:none; color:red; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
	<g transform="translate(507.9,430.5)" style="stroke:none; fill:black; font-family:Arial; font-size:12.00pt; text-anchor:end">
		<text>Viruses</text>
	</g>
	<use xlink:href=\'#gpPt4\' transform=\'translate(343.4,220.7) scale(4.50)\'/>
	<use xlink:href=\'#gpPt4\' transform=\'translate(535.3,73.6) scale(4.50)\'/>
	<use xlink:href=\'#gpPt4\' transform=\'translate(394.6,112.0) scale(4.50)\'/>
	';
	

$newstring = preg_replace($pattern, $replace, $string);
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You should be able to just add the jar files to your build path in your project configuration.

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

That's a rather odd replacement you're making, but you can do it by escaping the square brackets like so

String a="FirstName & LAstName \\[abc\\]";
        String b="FirstName, LAstName \\[abc\\]";

They are being interpreted as a regular expression construct instead of normal characters.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, that really depends on how you decide to provide that access. Your menu bar can disable items by using their setEnabled() method if that's what you're wanting to do. The only way to actually remove an item is to remove it from its parent menu, but if your classes are removing a lot of menu items you really need to stop and ask yourself why you're trying to share one menu bar and hack it up as needed. Perhaps each screen or state of your application may need its own menu.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You'll be able to access those methods if you have declared the variable to be of your "MenuBar" type. If you're using a JMenuBar reference, those won't be visible.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, you're not blind - I guess I'm just crazy. I thought you had to check a box for it to keep you logged in. I logged out to check that and there is no "Remember Me" check box. Sorry for the misdirection :)

It seems to set the cookie automatically for me. Are you allowing DaniWeb to set cookies?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I think they meant "Remember me" in reference to staying logged in. It sets a cookie and you remain logged in between sessions. Obviously that's not a solution if you share the computer though.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Edit: Cross-posted with the above.

goofy_chick,
I think you have some sensitivity issues personally. You over-read condescension into his reply and then blew up in an indignant rant, completely ignoring that his link did have the answer to your question. You also might consider that his original comment on documentation was directly related to your mention that you hadn't found what you needed in the auto-completion for the TableHeader.

I read that particular document over a month ago when i first wanted to use a jtable and since it did not even help me get my data into the table, why would i go back to it for help in doing anything else with a jtable?

Perhaps because you were looking for different information this time? Perhaps you didn't notice it earlier? There was a specific sub-section link for resizing columns.

I cannot believe that i asked a perfectly polite question and ended up having to defend myself.

I dont believe you even replied to be of help - you just replied to put me in my place!!!!

I replied to point out you ignored the fact that the information he linked did address your question and you decided to yell at him instead. I also linked directly to that sub-section in my reply. Your original question was indeed polite, but your response was far from it.

As a 37 year old women on a male dominated degree, and when i say male dominated i …

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

People become moderators by invitation as the need arises. Generally those invitation are issued to individuals who have spent a considerable amount of time answering questions and being active in the forum community.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you dont want to contribute to a answer thats fine - I dont expect any answers but dont under any curcumstances insinuate that I have not RESEARCHED JTables and am just trying to get someone else to do the work for me!!!!

Is it okay to insinuate that perhaps you didn't read this portion of what he linked quite thoroughly enough? Would the circumstance that it specifically addresses setting the column width warrant a pass on your admonition?

BestJewSinceJC commented: eloquently said.. :) +5
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't.

Do you?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

hey, soul sister by train.

That seems a popular song with sig spammers :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So for all of your pedantic criticism, you have yet to offer an alternative suggestion to this gross linguistic infraction.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes you should use it, i am also using Registry Cleaner but i don't feel any change in my PC.

Oh sure, that makes a lot of sense. Recommend that someone should definitely use a product that you are currently seeing no benefit from at all.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You need to override the isCellEditable(int,int) method in your table model to return false

public boolean isCellEditable(int row, int column) {
        return false;
    }
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Perhaps the other wateen can help?
http://www.daniweb.com/forums/thread278217.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

i see almostbob is ardav doggie

I said drop it.

If you can't manage that and continue to argue and derail this thread, you'll end up with your wish for moderation on your account granted. I won't post in this thread again.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Hmm, 45-90 minutes.. am I late?

Let's tone down the personal attacks a bit and keep it on topic. I'm shaking my mod finger at you now. If I have to come back in here, you kids are in trouble.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

For use with anything other than trivial canned examples that you feed it?
You can't.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Unsigned applets cannot access the local file system: http://java.sun.com/docs/books/tutorial/deployment/applet/security.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This just in:
Younger people more likely to engage in risky behavior than older persons.

Really, I don't find it surprising at all. The venue may change, but ignoring risk or discounting consequences is not something new for the younger demographic.

Been there, done that, have the t-shirt.

The "internet memory" is an interesting new wrinkle though. For us slightly older folks, any existing pictures of our indiscretions are most likely safely tucked away forgotten in some shoebox in an attic, never to be perused by potential employers. :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>Besides, all that would prove is the terminal lazyness of all the "plzgimmeaproject" types which drive-by.
That was somewhat the point of telling them to search, but I suppose it's too much to expect them to actually see themselves in the bucket loads of such useless requests and their general reception :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And how is resurrecting someone else's thread from 2005 going to help with that?

Try searching for "final project" here. I'm sure you'll find plenty of results.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You posted code that showed the print being inside the if() test on the key code and said that it didn't work. That is why James re-iterated what he said.

I didn't post the code of me making it the first statement, because that wouldn't help at all.

Why would you post code showing you not doing what he suggested and saying that you tried it and it didn't work? That makes no sense at all.

Anyway, it's most likely a focus issue. Key listeners only fire when the component they are attached to have the focus. You didn't post the whole code, so your containment hierarchy isn't entirely clear and it's hard to tell if perhaps you've added the listener to the wrong component.

I'd also recommend that you take another of James' suggestions and override paintComponent() to handle your graphics rendering. Update object positions with your listeners and a timing thread for the ball position and then repaint().

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

His post said to make print the first statement in your listener to make sure the method was even getting called at all - and you didn't do that.

Getting snippy about it isn't likely to encourage anyone else to volunteer their time to help you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Post what you have started. Ask specific questions.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, it's returning the end result of the entire conditional. It will return either true or false.

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

You can use Random.nextInt(int) to choose an index in your button array.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can get the selected object from the combo box directly with getSelectedObject()If you already have a reference to combo box, you can use it directly, otherwise you can cast the event source (JComboBox)e.getSource() and use that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

e.getSource() returns the component that generated the event, which in your case is the combo box. You cannot cast that JComboBox reference to a JTextField.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sure, you can keep a variable for button color. Use Color though and not String

Color buttonColor = Color.BLUE;

and if you keep a list of the buttons, you can set it like

for (JButton button : buttonList){
  button.setForeground(buttonColor);
}

You can use a radio button group or combo box for color choice to update your variable.

Edit: oops, cross-post with Nick and it looks like I misunderstood your question.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So, read this: http://www.daniweb.com/forums/faq.php?faq=daniweb_policies#faq_keep_it_clean
And this: http://www.daniweb.com/forums/announcement14-2.html (as already mentioned)

If you have questions more specific than "gimme the code", post them in the C++ forum. Don't expect much help though if you haven't even made an attempt at the problem.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Better start learning how to draw then: http://java.sun.com/docs/books/tutorial/2d/index.html

Come back and post code and specific questions when you have them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The error just says uncompilable source code.

The error lines appear on lines 9 and 13 in LetterHist.java and on line 85 in Main.java

No, the compiler does not just say "Uncompilable source code". There is an explicit reason given and you should take the time to read it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Generally, it's done like this

String line=null;
while ((line = in.readLine()) != null) {
   System.out.println(line);
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You'll probably need to use GridBagLayout to achieve the degree of control you want.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The basics of Comparable really come down to returning a negative value if "this" is less than the object passed, a positive value if "this" is greater, or zero if they're equal

class SomeClass implements Comparable<SomeClass> {
    public int compareTo(SomeClass other) {
        // If this < other, return -1 
        // If this > other, return 1
        // If they're equal, return zero.
        return 0;
    }
}

Now all you need to do is code in the "if" statements to compare them.