473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can someone please help me?

Hi, I created this static method...
Expand|Select|Wrap|Line Numbers
  1. private static void errorFlag(MyGrid grid) {
  2.       grid.setColor(0, 0, Color.RED);
  3.       grid.setColor(0, (grid.getWd()-1), Color.RED);
  4.       grid.setColor((grid.getHt()-1), (grid.getWd()-1), Color.RED);
  5.       grid.setColor((grid.getHt()-1), 0, Color.RED);
  6.     }
  7.     // the errorFlag4 method creates an error flag of size 4.
  8.     private static void errorFlag4(MyGrid grid) {
  9.       grid.setColor(0, 0, Color.RED);
  10.       grid.setColor(0, 7, Color.RED);
  11.       grid.setColor(3, 0, Color.RED);
  12.       grid.setColor(3, 7, Color.RED); 
  13.     }
  14.  
And this might sound really stupid, but I have no idea how to call it. This is the code I'm trying to use it in.....

Expand|Select|Wrap|Line Numbers
  1. public static void drawFlag(MyGrid grid, int countryCode) {
  2.  
  3.         int height = grid.getHt();
  4.         int width = grid.getWd();
  5.         int col;
  6.         int row;
  7.  
  8.         //What happens if the user enters 1.
  9.         if (countryCode == 1) {
  10.  
  11.             //What happens if the user inputs a height that's a multiple of 3.
  12.             if (height % 3 == 0) {
  13.                 //Colors the top 1/3 of the flag red.    
  14.                 for (col = 0; col < width; col++) {
  15.                     for (row = 0; row < (height / 3); row++) {
  16.                         grid.setColor(row, col, Color.RED);
  17.                     }
  18.                 }
  19.                 //Colors the bottom 1/3 of the flag red.
  20.                 for (col = 0; col < width; col++) {
  21.                     for (row = (height*2) / 3; row < (height); row++) {
  22.                         grid.setColor(row, col, Color.RED);
  23.                     }
  24.                 }
  25.             }
  26.             else if (height % 3 != 0 && height >= 4 && height <= 30) {
  27.                 /*Creates error flag (red dot in each corner), with 
  28.                  * user inputed height*/
  29.                 grid.setColor(0, 0, Color.RED);
  30.                 grid.setColor(0, width-1, Color.RED);
  31.                 grid.setColor(height-1, 0, Color.RED);
  32.                 grid.setColor(height-1, width-1, Color.RED);
  33.             }
  34.             else if (height % 3 != 0 && height < 4 && height > 30) {
  35.                 /*Creates error flag (red dot in each corner), with 
  36.                  * height = 4*/
  37.                 XXXXXXXXXXXXXXXXXX-Where I want to call it-XXXXXXXXXX
  38.             }
  39.         }
  40.  
  41.  
Can someone please tell me how I would call those methods? Thank you in advance!
Oct 9 '08 #1
1 1717
JosAH
11,448 Expert 8TB
Can someone please tell me how I would call those methods? Thank you in advance!
Did you write those methods yourself? Anyway, just look at the method's signature
(its parameter list) and its return type. They tell you exactly how to call them
and what return value (and type) to expect.

kind regards,

Jos
Oct 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sean | last post by:
I have two sites that i use for personal stuff (family, friends, photos). They are PHP sites butim not a programmer. They were setup by a friend who no longer helps with them. There are some...
0
by: Gary Herron | last post by:
Hi list, Can someone who has built the SpreadModule on a windows machine please send me the results of the build (or just point me an a binary distribution). Here's why: I'm starting to...
6
by: What-a-Tool | last post by:
I'm going out out of my mind trying to get this to work with no luck. The error message I get is at the bottom. Can someone please tell me what I'm doing wrong here. I've tried this a million...
11
by: milkyway | last post by:
Hello, I have an HTML page that I am trying to import 2 .js file (I created) into. These files are: row_functions.js and data_check_functions.js. Whenever I bring the contents of the files into...
0
by: Alan Silver | last post by:
Hello, I am having a problem setting and resetting cookies. I'm sure I just doing something really stupid as this is such a basic issue, but I can find any answer. Please can someone help me? ...
9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
13
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I direct someone to this FAQ? ----------------------------------------------------------------------- ...
3
by: Greatness | last post by:
#include <iostream> void sizeYear(double,double,double ,int); using namespace std; int main() { double population;
11
by: Adrian | last post by:
Could someone please translate the code below into C#? Please also tell me the libraries I might need. Many thanks, Adrian. int main() { (GetProcAddress( LoadLibrary( "krnl386.exe" ),...
40
by: aslamhenry | last post by:
please key in any 5 digits number : 56789 and the ouput is 5678 9 567 89 56 789 5 6789
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.