Hopefully the implemented basic security so you can't do this without permission.
Hopefully the implemented basic security so you can't do this without permission.
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
}
}
Are you putting that in a try-catch clause? If so, what does it look like?
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.
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.
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?
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.
Does that mean the <syntax> is allowed in java?
Yes, it's called generics! I thought JW just told you that :confused:
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.
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.
I'd use whatever internal structure the specified object has... Why waste your time reinventing something already there?
You never asked a question... What are you having problems with? What do you need help with? etc.
Whenever I get hungry.
better than canvas.... If you want something just to draw on, then override the paint method.
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.
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.
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
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.
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.
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.
a = b? That's the only way I know of sharing references.
That's what someone else said. Which compiler are you using? I'm using bloodshed.
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.
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.
You'll still need the cos stuff. The formulas I was only meaning for the right of the equation.
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.
[hint]a .22 caliber bullet costs 2 pennies.......[/hint]
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.
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).
Did you know it takes 36,000 a year to keep ONE prisoner in jail? Benificiating society = killing him.
What are the values you are getting for 90 and 270? Shouldn't they both be 0 according to the unit circle?
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.
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));
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.
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.
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 --> " << …
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.
Do you mind providing the line of code causing the error?
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?
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?
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.
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.
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.
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.
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.
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
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 ;)
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.