server_crash 64 Postaholic

Hopefully the implemented basic security so you can't do this without permission.

server_crash 64 Postaholic

Anytime you mess with a URL you'll need to catch a malformedURLException and for the desktop thing,

else if(evt.getSource() == menuItemRules)
	{
            try
            {
		Desktop.browse(new URL( "http://www.google.co.uk/"));
            }
            catch(MalformedURLException mue)
            {
               //error message
            }
            catch(DesktopException de)
            {
               //error message
            }
	}
server_crash 64 Postaholic

Are you putting that in a try-catch clause? If so, what does it look like?

server_crash 64 Postaholic

You could always set the layout to null and set the bounds, but I don't know if that's a good idea or not...... That is, if you are talking about positioning components.

server_crash 64 Postaholic

im using awt...but i don't no how to add a window adapter ...so can u help me...thx a lot 4 the reply...
thx again...

I'll help you, but only if you type in normal english so I can understand.

server_crash 64 Postaholic

Sorrie, my english is only meant to make sense to those below the middle thirties :lol:

Maybe wen I get rid of my wretched cell fone I may B persuaded to communicate more eloquently.

Welche Sprache ist das?

server_crash 64 Postaholic

What's the error message you are recieving(if any)?

Also, Im too lazy to put that into a compiler and read through all the source, so please explain what it's doing that it's not suppose to in detail.

server_crash 64 Postaholic

Does that mean the <syntax> is allowed in java?

Yes, it's called generics! I thought JW just told you that :confused:

server_crash 64 Postaholic

Can clean up your language so we can understand you? If you are using swing set the default close operation. If you are using awt, then add a window adapter thing.

server_crash 64 Postaholic

And the error is?

server_crash 64 Postaholic

What's it not doing? There's a chance it wont even show up because you extend a swing component, but yet you are using awt components? (ie: Panel, TextField, etc)... I've seen cases were it won't display because of this.

server_crash 64 Postaholic

I'd use whatever internal structure the specified object has... Why waste your time reinventing something already there?

server_crash 64 Postaholic

You never asked a question... What are you having problems with? What do you need help with? etc.

server_crash 64 Postaholic

Whenever I get hungry.

server_crash 64 Postaholic

better than canvas.... If you want something just to draw on, then override the paint method.

server_crash 64 Postaholic


i am trying to past an image into my java program given the starting point and the ending point..,,

gc.drawImage (m_image,0,50,120,15this);


but its not working can you help me please

Look at your last parameter.

server_crash 64 Postaholic

well if the coding is not lengthy, can u plz post the codin for makin a frame the parent frame....i tried...

JFrame parent;
parent=this;

but i am supposed to write this in addactionlistener method.....and so it just doesnt work out

http://java.sun.com/docs/books/tutorial/uiswing/components/internalframe.html


If you are lazy like me I would have just overriden JDialog and set the location to the size of this dialog minus that of the larger... or something like that.

server_crash 64 Postaholic

Couple of problems:

1) You don't state what the problem is
2) You don't set anything visible
3) Your global variables are public
4) You don't set the layout

server_crash 64 Postaholic
server_crash 64 Postaholic

You could add 32 or subtract 32 from the ascii value depending on whether it's lower or uppercase.... A simpler solution is creating a substring and calling the toUpperCase() method:

String newString = (oldstring.substring(0,1)).toUpperCase();


NOTE: It's not tested so don't be suprised if that doesn't work.

server_crash 64 Postaholic

Just a bunch of garbage. Half of them look like rain or something was on the camera lenses, and the rest look awfully close to photoshop edits.

server_crash 64 Postaholic

Do you have to create your own stack? If not, then java should provide one for you. I believe when you push something onto the stack it gets put at the top. So, all you have to do is loop through the stack and test whether the character you just popped off is equal to the character at that specific position in the real string. An easier way is to simply use stringbuffer to reverse the string and then compare them.

server_crash 64 Postaholic

a = b? That's the only way I know of sharing references.

server_crash 64 Postaholic

That's what someone else said. Which compiler are you using? I'm using bloodshed.

server_crash 64 Postaholic

I have a matrix class which there are matrix objects. I want to call .value(int,int) directly on the matrix objects and set the internal 2d vector to the value on the right side of the equal sign.

Here is what I want to do:

new_matrix.value(row,col) = 0;

Here is what I've tried:

int &Matrix::value(int row, int col)
{
    return this->mat[row][col];
}

Where mat is the internal 2d vector data.

server_crash 64 Postaholic

I don't really understand that. Can u explain it to me with an example. how does it work 4 the infinite series of cos(x)?

:o

It's only for the right side, but I'm not sure that it will even work right yet. For an infinite series, you can allways get the sum of like the first 100 or so values and that is pretty much the answer, because it won't change much even though it's infinite.

server_crash 64 Postaholic

You'll still need the cos stuff. The formulas I was only meaning for the right of the equation.

server_crash 64 Postaholic

The good thing is you don't have to worry about order of operations. An equation like that would be much nicer in summation notation..... Also, the sequence looks arithmetic, so if you want to add all that crap up on the right side of the equation you can simply use the sum formula:

Sn = (n\2)(a1+a2)

If you don't know what I'm talking about, then think about when your teacher asks you to sum all the numbers from 1 to a 100...That's the shortcut.

server_crash 64 Postaholic

[hint]a .22 caliber bullet costs 2 pennies.......[/hint]

server_crash 64 Postaholic

Even if it was as low as 20 grand, that's still higher than the national average of what people make, right? That's rediculous.

server_crash 64 Postaholic

The best thing to do is draw a triangle if you're confused and the unit circle doesn't help. The only problem with using a triangle is you'll have to use some logic, because you'll start with 2 unknowns (from what I remember).

server_crash 64 Postaholic

Did you know it takes 36,000 a year to keep ONE prisoner in jail? Benificiating society = killing him.

server_crash 64 Postaholic

What are the values you are getting for 90 and 270? Shouldn't they both be 0 according to the unit circle?

server_crash 64 Postaholic

Loop through the string and create substrings or something:

for (int index=string.length-1; index>=0; --index)
{
    System.out.println(string.substring(0,index) + "\n");
}

I have no clue if that will work or not.

server_crash 64 Postaholic

Not that it's important or anything, but you can initialize all the elements to a specific value:

vector< vector< double > > matrix( row, vector<double>(row, int_val));

server_crash 64 Postaholic

One other thing, if ur using c++ u should try using strings instead of chars - it shud b familiar coming from a java background

It was actually my first choice to use strings. I would MUCH rather use them over char arrays, but all in all it was good practice, I guess. The reason I used char arrays is because it's the only way I could get it to convert to a double. The strod() wouldn't work with strings.

And try to avoid !EOF at all costs when reading files, u'll thank me 4 it later.

Out of curiosity, why do you say that? You and Narue both warned me, but I have no clue why... I thought it was customary to do this. The example I'm reading from actually shows to use !eof.

server_crash 64 Postaholic

No, this was a different problem. I'm using an older version of bloodshed and it as some really weird lock on files, so once I switched over it worked fine.

server_crash 64 Postaholic

I have a program that reads from a file, but for some reason it never reaches the end of the file or something, because the loop never ends. I put only 2 lines of text in the file, and a loop like this still ran infinite:

while (! my_file.eof())

Here is the full code:

Implementation:

//-include the DebitCard implementation
#include "Card.h"
//-include the header for I/O
#include <iostream>
//-include header for files
#include <fstream>
#include <string>
//-using definitions
//-used as a shortcut
using std::cout;
using std::cin;
using std::endl;

/**main()
 *-definition of this file
 *-goes in the main method
 *-main method allows the
 *-program to be run
 **/
int main()
{
  DebitCard dc;
  //-char array for filename
  char filename[50];
  //-double for read amount
  double my_double = 0;
  //-char array to hold the information read
  char info[50];
  //-declaration of file object
  ifstream my_file;

  //-prompt the user
  cout << "Enter The File --> ";
  //-get the filename from the user
  cin.getline(filename, sizeof(filename));
  //-open the file based on the input
  my_file.open(filename);

  //-keep count of lines
  int count = 1;
  //-loop while it's no the end of the file
  while (! my_file.eof())
  {
    //-get the line from file
    my_file.getline(info,sizeof(info));
    //-store the value in a double
    //-this must be converted
    my_double = atof(info);
    //-if count is one, then we are on
    //-the first line and it is the balance
    //-to set the debit card to.
    if (count == 1)
    {
      //-print out the balance
      cout << "The Starting Balance Was --> " << …
server_crash 64 Postaholic

Okay, you're saying that your class isn't recognized, and that the above quote is how you call the member function (aka. method) of the class. So where is the object that you call the member function on? You know, <object>.<member function>(args)? It looks more like you're calling a non-member function, and obviously the compiler won't find it.

I thought the same thing, but the paper I'm reading from said all I have to do is #include the class and call the method (and the method was in a class). I didn't think that would work, and indeed it didn't. Oh well, I'll create the object like I should have in the first place. Thanks for clearing that up. I'm glad you did, because I was really getting confused with the paper saying/showing I didn't need an object.

server_crash 64 Postaholic

Do you mind providing the line of code causing the error?

server_crash 64 Postaholic

Sorry, it seemed to be a problem with something else. I fixed it, but it's not recognized my class that should have been imported:

I included the file:

#include "Card.h"


Which is a debitcard class that has some methods. I tried calling one of those methods and it says "implicit declaration of int set_balance(..)"

I called it like this:

set_balance(my_double); That is the signature of the method. Is there something I'm not doing?

server_crash 64 Postaholic

I'm trying this:


char info[50];


myfile.getline(info, sizeof(info) );

double my_double = atof(info);

It seems to work, I think, but I'm getting an error when I try to print out the double. It says no matching function for ostream& << &double.


Can anyone help me with this?

server_crash 64 Postaholic

First, you need to clean up your own english(the abbreviations ) so we can understand you. Then you need to show us what you've already done, and specifically what you're having trouble with.

In the meantime, remember Java has a String class with many methods such as indexOf() and other stuff.

server_crash 64 Postaholic

I'd say you'll need a loop which has some bounds. Most of the time it's -2PI to 2PI. (-6.28 to 6.28). You'll then need a real-to-screen conversion formula, which will depend on your window. After all that, then just loop through and call Java's built in cos() method as Phaelax pointed out.

server_crash 64 Postaholic

Good luck on the math ;) I made one once. You'll need a complex class since it goes in the form a + bi or something like that. I can't remember the exact formula for a mandelbrot.

server_crash 64 Postaholic

I'm not sure what you're saying. Are you talking something like a status bar? If you simply want it at very bottom of the frame, then put it all in a JPanel and then use the BorderLayout.CENTER swing constant.

server_crash 64 Postaholic

You left out Hillary Clinton, first female president of the Ustated Nites.

Don't forget 'The first, first man' Bill Clinton. I think he legally has one year.

server_crash 64 Postaholic

http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/LookAndFeel.html
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/UIManager.html

Those are few classes you would need to use.

Anyways, the ones I know are:

Java LAF
Mac LAF
Motif LAF
Windows LAF
GTK LAF

server_crash 64 Postaholic

Find an abandoned cabin in a rural area, nail his pecker to the floor, give him a knife, and set the cabin on fire leaving him with two options. Should he survive this, then send him to jail, the life expectancy of this type of offender is very short. The woman should never see the light of day again either.

That's good ;)

server_crash 64 Postaholic

I expected that question ;)

It's something like this:

INSIDE YOUR PAINTCOMPONENT METHOD:


g.drawImage(image, x, y, this);

or


g.drawImage(image, x, y, null);


I can't remember the last part, but I know it's one of the two.