Headaches are very rarely a warning sign of a malignant (cancerous) brain tumour unless they are of recent onset (e.g. days or weeks) and there are other symptoms to go with them, such as 'stroke-like' weakness or changes in the senses; fits or 'absences'; or psychiatric-or-dementia-like change in mental function. In my hospital the headache clinic is not the place malignant brain tumours are diagnosed, they mostly come in as an emergency with a barn-door-obvious crisis of some sort. Benign tumours (not cancerous) also rarely show themselves by headaches alone, however they are much slower growing and can develop over months to years. Even then, the headache clinic very rarely finds that an uncomplicated headache turns out to be due to a benign brain tumour. Headaches that come for a few days or weeks, then and go away and come back repeatedly are extremely unlikely to be due to a tumour of any kind.
Headaches that are present every morning, that go away after getting up, and that are worse on coughing, straining at the toilet or bending over, and associated with feeling sick and blurred vision suggest an increase in the pressure in the head and need checked out. Even then, the chance of being due to a tumour isn't guaranteed. There are other treatable causes (such as migraine) that are much more of a possibility than a tumour, but actually most headaches are not due to any serious medical condition, and are due to stress, muscular tension in the neck and so on. If you're worried, see your doctor. Don't overdo painkillers. Surprisingly, with excessive use they can make headaches become persistent in some people (called analgesic-overuse headaches in the trade).