Greek Flag
I would like to create a class that extends JComponent. I need to draw the Greek flag,
For this flag, the ratio of width to height is 11:8, so for example 220 pixels by 160. It needs to be drawn as large as possible depending on the applet window but still keeping the ratio.
I have done the starting code and I am able to draw the flag however I have to clue in how to do the ration part. Any suggestions?
import javax.swing.JComponent;
import java.awt.*;
import java.awt.geom.Ellipse2D;
class GreekFlagextends JComponent
{
publicvoid paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D)g;
int w = getWidth();
int h = getHeight();
double ratio = (double)w/(double)h;
int flagHeight, flagWidth;
if(ratio>11.0/8.0)
{
}
else
{
}
// then draw the rows, and the cross
}
}

