SlideShare a Scribd company logo
1 of 6
Download to read offline
import java.awt.*;
import java.awt.event.MouseAdaptor;
import java.awt.event.MouseEvent;
import javax.swing.*;
public class Prob1_4 extends JPanel
{
private static final long serialVersionUID = 1L;
private final int WIDTH = 1200;
private final int HEIGHT = 800;
int maxX ,maxY ;
static JFrame f;
float pixelWidth , pixelHeight;
rWidth = 10.0F;
rHeight = 7.5F;
xP = -1, yP;
FontMetrics metrics;
public Prob1_4() {
setPreferredSize(new Dimension(WIDTH, HEIGHT));
addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent evt)
{
xP = evt.getX(); yP = evt.getY();
f.repaint();
}
} );
}
void initgr()
{ Dimension d = getSize();
maxX = d.width - 1; maxY = d.height - 1;
pixelWidth = rWidth/maxX; pixelHeight = rHeight/maxY;
}
int iX(float x){return Math.round(x/pixelWidth);}
int iY(float y){return maxY - Math.round(y/pixelHeight);}
float fx(int x){return x * pixelWidth;}
float fy(int y){return (maxY - y) * pixelHeight;}
public void paint(Graphics g)
{
initgr();
Graphics2D g2d = (Graphics2D) g;
Point origin = new Point(WIDTH / 2, HEIGHT / 2);
metrics = g.getFontMetrics();
double value1 = Math.pow(xP-origin.x,2);
double value2 =Math.pow(yP- origin.y,2);
int radius = (int)Math.sqrt(value1+value2);
g.drawString(
"Click anywhere on screen to generate hexagons of apprpriate radius! "
, 40, 100);
double size = (radius/253.0)*7.0;
double rad = (radius/253.0)*30.0;
drawHexGridLoop(g2d, origin, (int)size-2, (int)rad+5, 0);
}
//Method to draw regular hexagon
private void drawHex(Graphics g, int posX, int posY, int x, int y, int r) {
Graphics2D g2d = (Graphics2D) g;
hexagon hex = new hexagon(x, y, r);
hex.draw(g2d, x, y, 0, 0x008844, false);
hex.draw(g2d, x, y, 4, 000000, false);
}
public static void main(String[] args) {
f = new JFrame();
Prob1_4 p = new Prob1_4();
f.setContentPane(p);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
}
int iX(float x){return Math.round(x/pixelWidth);}
int iY(float y){return maxY - Math.round(y/pixelHeight);}
float fx(int x){return x * pixelWidth;}
float fy(int y){return (maxY - y) * pixelHeight;}
public void paint(Graphics g)
{
initgr();
Graphics2D g2d = (Graphics2D) g;
Point origin = new Point(WIDTH / 2, HEIGHT / 2);
metrics = g.getFontMetrics();
double value1 = Math.pow(xP-origin.x,2);
double value2 =Math.pow(yP- origin.y,2);
int radius = (int)Math.sqrt(value1+value2);
g.drawString(
"Click anywhere on screen to generate hexagons of apprpriate radius! "
, 40, 100);
double size = (radius/253.0)*7.0;
double rad = (radius/253.0)*30.0;
drawHexGridLoop(g2d, origin, (int)size-2, (int)rad+5, 0);
}
//Method to draw regular hexagon
private void drawHex(Graphics g, int posX, int posY, int x, int y, int r) {
Graphics2D g2d = (Graphics2D) g;
hexagon hex = new hexagon(x, y, r);
hex.draw(g2d, x, y, 0, 0x008844, false);
hex.draw(g2d, x, y, 4, 000000, false);
}
public static void main(String[] args) {
f = new JFrame();
Prob1_4 p = new Prob1_4();
f.setContentPane(p);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
}
Solution
import java.awt.*;
import java.awt.event.MouseAdaptor;
import java.awt.event.MouseEvent;
import javax.swing.*;
public class Prob1_4 extends JPanel
{
private static final long serialVersionUID = 1L;
private final int WIDTH = 1200;
private final int HEIGHT = 800;
int maxX ,maxY ;
static JFrame f;
float pixelWidth , pixelHeight;
rWidth = 10.0F;
rHeight = 7.5F;
xP = -1, yP;
FontMetrics metrics;
public Prob1_4() {
setPreferredSize(new Dimension(WIDTH, HEIGHT));
addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent evt)
{
xP = evt.getX(); yP = evt.getY();
f.repaint();
}
} );
}
void initgr()
{ Dimension d = getSize();
maxX = d.width - 1; maxY = d.height - 1;
pixelWidth = rWidth/maxX; pixelHeight = rHeight/maxY;
}
int iX(float x){return Math.round(x/pixelWidth);}
int iY(float y){return maxY - Math.round(y/pixelHeight);}
float fx(int x){return x * pixelWidth;}
float fy(int y){return (maxY - y) * pixelHeight;}
public void paint(Graphics g)
{
initgr();
Graphics2D g2d = (Graphics2D) g;
Point origin = new Point(WIDTH / 2, HEIGHT / 2);
metrics = g.getFontMetrics();
double value1 = Math.pow(xP-origin.x,2);
double value2 =Math.pow(yP- origin.y,2);
int radius = (int)Math.sqrt(value1+value2);
g.drawString(
"Click anywhere on screen to generate hexagons of apprpriate radius! "
, 40, 100);
double size = (radius/253.0)*7.0;
double rad = (radius/253.0)*30.0;
drawHexGridLoop(g2d, origin, (int)size-2, (int)rad+5, 0);
}
//Method to draw regular hexagon
private void drawHex(Graphics g, int posX, int posY, int x, int y, int r) {
Graphics2D g2d = (Graphics2D) g;
hexagon hex = new hexagon(x, y, r);
hex.draw(g2d, x, y, 0, 0x008844, false);
hex.draw(g2d, x, y, 4, 000000, false);
}
public static void main(String[] args) {
f = new JFrame();
Prob1_4 p = new Prob1_4();
f.setContentPane(p);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
}
int iX(float x){return Math.round(x/pixelWidth);}
int iY(float y){return maxY - Math.round(y/pixelHeight);}
float fx(int x){return x * pixelWidth;}
float fy(int y){return (maxY - y) * pixelHeight;}
public void paint(Graphics g)
{
initgr();
Graphics2D g2d = (Graphics2D) g;
Point origin = new Point(WIDTH / 2, HEIGHT / 2);
metrics = g.getFontMetrics();
double value1 = Math.pow(xP-origin.x,2);
double value2 =Math.pow(yP- origin.y,2);
int radius = (int)Math.sqrt(value1+value2);
g.drawString(
"Click anywhere on screen to generate hexagons of apprpriate radius! "
, 40, 100);
double size = (radius/253.0)*7.0;
double rad = (radius/253.0)*30.0;
drawHexGridLoop(g2d, origin, (int)size-2, (int)rad+5, 0);
}
//Method to draw regular hexagon
private void drawHex(Graphics g, int posX, int posY, int x, int y, int r) {
Graphics2D g2d = (Graphics2D) g;
hexagon hex = new hexagon(x, y, r);
hex.draw(g2d, x, y, 0, 0x008844, false);
hex.draw(g2d, x, y, 4, 000000, false);
}
public static void main(String[] args) {
f = new JFrame();
Prob1_4 p = new Prob1_4();
f.setContentPane(p);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
}

More Related Content

Similar to import java.awt.;import java.awt.event.MouseAdaptor;import java.pdf

Computer graphics File for Engineers
Computer graphics File for EngineersComputer graphics File for Engineers
Computer graphics File for Engineersvarun arora
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manualUma mohan
 
Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]Palak Sanghani
 
SaveI need help with this maze gui that I wrote in java, I am tryi.pdf
SaveI need help with this maze gui that I wrote in java, I am tryi.pdfSaveI need help with this maze gui that I wrote in java, I am tryi.pdf
SaveI need help with this maze gui that I wrote in java, I am tryi.pdfarihantstoneart
 
Mashup caravan android-talks
Mashup caravan android-talksMashup caravan android-talks
Mashup caravan android-talkshonjo2
 
Creating an Uber Clone - Part VIII.pdf
Creating an Uber Clone - Part VIII.pdfCreating an Uber Clone - Part VIII.pdf
Creating an Uber Clone - Part VIII.pdfShaiAlmog1
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programsAmit Kapoor
 
Task Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdfTask Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdfcronkwurphyb44502
 
Elastic response pseudo spectrum in c programming
Elastic response pseudo spectrum in c programmingElastic response pseudo spectrum in c programming
Elastic response pseudo spectrum in c programmingSalar Delavar Qashqai
 
I wanted to change the cloudsrectangles into an actuall image it do.pdf
I wanted to change the cloudsrectangles into an actuall image it do.pdfI wanted to change the cloudsrectangles into an actuall image it do.pdf
I wanted to change the cloudsrectangles into an actuall image it do.pdffeelinggifts
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicssnelkoli
 
import java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdfimport java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdfanwarsadath111
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsKandarp Tiwari
 
Graphics practical lab manual
Graphics practical lab manualGraphics practical lab manual
Graphics practical lab manualVivek Kumar Sinha
 
This is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdfThis is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdfanjandavid
 

Similar to import java.awt.;import java.awt.event.MouseAdaptor;import java.pdf (20)

Computer graphics File for Engineers
Computer graphics File for EngineersComputer graphics File for Engineers
Computer graphics File for Engineers
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Ocr code
Ocr codeOcr code
Ocr code
 
Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]
 
SaveI need help with this maze gui that I wrote in java, I am tryi.pdf
SaveI need help with this maze gui that I wrote in java, I am tryi.pdfSaveI need help with this maze gui that I wrote in java, I am tryi.pdf
SaveI need help with this maze gui that I wrote in java, I am tryi.pdf
 
Mashup caravan android-talks
Mashup caravan android-talksMashup caravan android-talks
Mashup caravan android-talks
 
Creating an Uber Clone - Part VIII.pdf
Creating an Uber Clone - Part VIII.pdfCreating an Uber Clone - Part VIII.pdf
Creating an Uber Clone - Part VIII.pdf
 
Computer graphics
Computer graphics   Computer graphics
Computer graphics
 
Computer graphics
Computer graphics   Computer graphics
Computer graphics
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programs
 
Clock For My
Clock For MyClock For My
Clock For My
 
Task Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdfTask Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdf
 
Elastic response pseudo spectrum in c programming
Elastic response pseudo spectrum in c programmingElastic response pseudo spectrum in c programming
Elastic response pseudo spectrum in c programming
 
I wanted to change the cloudsrectangles into an actuall image it do.pdf
I wanted to change the cloudsrectangles into an actuall image it do.pdfI wanted to change the cloudsrectangles into an actuall image it do.pdf
I wanted to change the cloudsrectangles into an actuall image it do.pdf
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
import java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdfimport java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdf
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C Programs
 
Graphics practical lab manual
Graphics practical lab manualGraphics practical lab manual
Graphics practical lab manual
 
662305 LAB13
662305 LAB13662305 LAB13
662305 LAB13
 
This is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdfThis is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdf
 

More from anyacarpets

1A society, according to Utilitarianism, is just to the extent tha.pdf
1A society, according to Utilitarianism, is just to the extent tha.pdf1A society, according to Utilitarianism, is just to the extent tha.pdf
1A society, according to Utilitarianism, is just to the extent tha.pdfanyacarpets
 
1) Structures of male reproductive system are1. Scrotum. 2. Pair o.pdf
1) Structures of male reproductive system are1. Scrotum. 2. Pair o.pdf1) Structures of male reproductive system are1. Scrotum. 2. Pair o.pdf
1) Structures of male reproductive system are1. Scrotum. 2. Pair o.pdfanyacarpets
 
I have many goals and many interests, as well as a long list of thi.pdf
 I have many goals and many interests, as well as a long list of thi.pdf I have many goals and many interests, as well as a long list of thi.pdf
I have many goals and many interests, as well as a long list of thi.pdfanyacarpets
 
Step1 HBr and HNO3 yield H (+) ion in the aqueous.pdf
                     Step1 HBr and HNO3 yield H (+) ion in the aqueous.pdf                     Step1 HBr and HNO3 yield H (+) ion in the aqueous.pdf
Step1 HBr and HNO3 yield H (+) ion in the aqueous.pdfanyacarpets
 
reaction condition H2SO4 H2O (heat) Soluti.pdf
                     reaction condition H2SO4  H2O (heat) Soluti.pdf                     reaction condition H2SO4  H2O (heat) Soluti.pdf
reaction condition H2SO4 H2O (heat) Soluti.pdfanyacarpets
 
No it cant exist .pdf
                     No it cant exist                               .pdf                     No it cant exist                               .pdf
No it cant exist .pdfanyacarpets
 
It would be double 7.12x10-3 .pdf
                     It would be double 7.12x10-3                     .pdf                     It would be double 7.12x10-3                     .pdf
It would be double 7.12x10-3 .pdfanyacarpets
 
YES1st case when replaced= 1414=116when not replaced=1413.pdf
YES1st case when replaced= 1414=116when not replaced=1413.pdfYES1st case when replaced= 1414=116when not replaced=1413.pdf
YES1st case when replaced= 1414=116when not replaced=1413.pdfanyacarpets
 
With Hurricane Katrina battering the Louisiana coastline, JonDonle.pdf
With Hurricane Katrina battering the Louisiana coastline, JonDonle.pdfWith Hurricane Katrina battering the Louisiana coastline, JonDonle.pdf
With Hurricane Katrina battering the Louisiana coastline, JonDonle.pdfanyacarpets
 
Twenty years after the release of Jurassic Park, the dream of bringi.pdf
Twenty years after the release of Jurassic Park, the dream of bringi.pdfTwenty years after the release of Jurassic Park, the dream of bringi.pdf
Twenty years after the release of Jurassic Park, the dream of bringi.pdfanyacarpets
 
The two commands are used to verify NAT configuration are1) Router.pdf
The two commands are used to verify NAT configuration are1) Router.pdfThe two commands are used to verify NAT configuration are1) Router.pdf
The two commands are used to verify NAT configuration are1) Router.pdfanyacarpets
 
There exists two types of circulatory path in cardivascular system .pdf
There exists two types of circulatory path in cardivascular system .pdfThere exists two types of circulatory path in cardivascular system .pdf
There exists two types of circulatory path in cardivascular system .pdfanyacarpets
 
The photosystems found in the thylakoid membrane of the plants are t.pdf
The photosystems found in the thylakoid membrane of the plants are t.pdfThe photosystems found in the thylakoid membrane of the plants are t.pdf
The photosystems found in the thylakoid membrane of the plants are t.pdfanyacarpets
 
The diplococci bacteria are round-shaped microbes, and occur in the .pdf
The diplococci bacteria are round-shaped microbes, and occur in the .pdfThe diplococci bacteria are round-shaped microbes, and occur in the .pdf
The diplococci bacteria are round-shaped microbes, and occur in the .pdfanyacarpets
 
Technology may be defined as an innovation that can help for a perso.pdf
Technology may be defined as an innovation that can help for a perso.pdfTechnology may be defined as an innovation that can help for a perso.pdf
Technology may be defined as an innovation that can help for a perso.pdfanyacarpets
 
The actual illustration of values is decided by the machine design (.pdf
The actual illustration of values is decided by the machine design (.pdfThe actual illustration of values is decided by the machine design (.pdf
The actual illustration of values is decided by the machine design (.pdfanyacarpets
 
Solution i.e. m is bounded sequence.To find m for which the oper.pdf
Solution  i.e. m is bounded sequence.To find m for which the oper.pdfSolution  i.e. m is bounded sequence.To find m for which the oper.pdf
Solution i.e. m is bounded sequence.To find m for which the oper.pdfanyacarpets
 
Roll up is a type of merger where the investors in the market buy 2 .pdf
Roll up is a type of merger where the investors in the market buy 2 .pdfRoll up is a type of merger where the investors in the market buy 2 .pdf
Roll up is a type of merger where the investors in the market buy 2 .pdfanyacarpets
 
PolymorphismWhen one assignment is performed by various ways i.e. .pdf
PolymorphismWhen one assignment is performed by various ways i.e. .pdfPolymorphismWhen one assignment is performed by various ways i.e. .pdf
PolymorphismWhen one assignment is performed by various ways i.e. .pdfanyacarpets
 
Ovary Each ovary is whitish in colour and located alongside the la.pdf
Ovary  Each ovary is whitish in colour and located alongside the la.pdfOvary  Each ovary is whitish in colour and located alongside the la.pdf
Ovary Each ovary is whitish in colour and located alongside the la.pdfanyacarpets
 

More from anyacarpets (20)

1A society, according to Utilitarianism, is just to the extent tha.pdf
1A society, according to Utilitarianism, is just to the extent tha.pdf1A society, according to Utilitarianism, is just to the extent tha.pdf
1A society, according to Utilitarianism, is just to the extent tha.pdf
 
1) Structures of male reproductive system are1. Scrotum. 2. Pair o.pdf
1) Structures of male reproductive system are1. Scrotum. 2. Pair o.pdf1) Structures of male reproductive system are1. Scrotum. 2. Pair o.pdf
1) Structures of male reproductive system are1. Scrotum. 2. Pair o.pdf
 
I have many goals and many interests, as well as a long list of thi.pdf
 I have many goals and many interests, as well as a long list of thi.pdf I have many goals and many interests, as well as a long list of thi.pdf
I have many goals and many interests, as well as a long list of thi.pdf
 
Step1 HBr and HNO3 yield H (+) ion in the aqueous.pdf
                     Step1 HBr and HNO3 yield H (+) ion in the aqueous.pdf                     Step1 HBr and HNO3 yield H (+) ion in the aqueous.pdf
Step1 HBr and HNO3 yield H (+) ion in the aqueous.pdf
 
reaction condition H2SO4 H2O (heat) Soluti.pdf
                     reaction condition H2SO4  H2O (heat) Soluti.pdf                     reaction condition H2SO4  H2O (heat) Soluti.pdf
reaction condition H2SO4 H2O (heat) Soluti.pdf
 
No it cant exist .pdf
                     No it cant exist                               .pdf                     No it cant exist                               .pdf
No it cant exist .pdf
 
It would be double 7.12x10-3 .pdf
                     It would be double 7.12x10-3                     .pdf                     It would be double 7.12x10-3                     .pdf
It would be double 7.12x10-3 .pdf
 
YES1st case when replaced= 1414=116when not replaced=1413.pdf
YES1st case when replaced= 1414=116when not replaced=1413.pdfYES1st case when replaced= 1414=116when not replaced=1413.pdf
YES1st case when replaced= 1414=116when not replaced=1413.pdf
 
With Hurricane Katrina battering the Louisiana coastline, JonDonle.pdf
With Hurricane Katrina battering the Louisiana coastline, JonDonle.pdfWith Hurricane Katrina battering the Louisiana coastline, JonDonle.pdf
With Hurricane Katrina battering the Louisiana coastline, JonDonle.pdf
 
Twenty years after the release of Jurassic Park, the dream of bringi.pdf
Twenty years after the release of Jurassic Park, the dream of bringi.pdfTwenty years after the release of Jurassic Park, the dream of bringi.pdf
Twenty years after the release of Jurassic Park, the dream of bringi.pdf
 
The two commands are used to verify NAT configuration are1) Router.pdf
The two commands are used to verify NAT configuration are1) Router.pdfThe two commands are used to verify NAT configuration are1) Router.pdf
The two commands are used to verify NAT configuration are1) Router.pdf
 
There exists two types of circulatory path in cardivascular system .pdf
There exists two types of circulatory path in cardivascular system .pdfThere exists two types of circulatory path in cardivascular system .pdf
There exists two types of circulatory path in cardivascular system .pdf
 
The photosystems found in the thylakoid membrane of the plants are t.pdf
The photosystems found in the thylakoid membrane of the plants are t.pdfThe photosystems found in the thylakoid membrane of the plants are t.pdf
The photosystems found in the thylakoid membrane of the plants are t.pdf
 
The diplococci bacteria are round-shaped microbes, and occur in the .pdf
The diplococci bacteria are round-shaped microbes, and occur in the .pdfThe diplococci bacteria are round-shaped microbes, and occur in the .pdf
The diplococci bacteria are round-shaped microbes, and occur in the .pdf
 
Technology may be defined as an innovation that can help for a perso.pdf
Technology may be defined as an innovation that can help for a perso.pdfTechnology may be defined as an innovation that can help for a perso.pdf
Technology may be defined as an innovation that can help for a perso.pdf
 
The actual illustration of values is decided by the machine design (.pdf
The actual illustration of values is decided by the machine design (.pdfThe actual illustration of values is decided by the machine design (.pdf
The actual illustration of values is decided by the machine design (.pdf
 
Solution i.e. m is bounded sequence.To find m for which the oper.pdf
Solution  i.e. m is bounded sequence.To find m for which the oper.pdfSolution  i.e. m is bounded sequence.To find m for which the oper.pdf
Solution i.e. m is bounded sequence.To find m for which the oper.pdf
 
Roll up is a type of merger where the investors in the market buy 2 .pdf
Roll up is a type of merger where the investors in the market buy 2 .pdfRoll up is a type of merger where the investors in the market buy 2 .pdf
Roll up is a type of merger where the investors in the market buy 2 .pdf
 
PolymorphismWhen one assignment is performed by various ways i.e. .pdf
PolymorphismWhen one assignment is performed by various ways i.e. .pdfPolymorphismWhen one assignment is performed by various ways i.e. .pdf
PolymorphismWhen one assignment is performed by various ways i.e. .pdf
 
Ovary Each ovary is whitish in colour and located alongside the la.pdf
Ovary  Each ovary is whitish in colour and located alongside the la.pdfOvary  Each ovary is whitish in colour and located alongside the la.pdf
Ovary Each ovary is whitish in colour and located alongside the la.pdf
 

Recently uploaded

Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 

Recently uploaded (20)

Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 

import java.awt.;import java.awt.event.MouseAdaptor;import java.pdf

  • 1. import java.awt.*; import java.awt.event.MouseAdaptor; import java.awt.event.MouseEvent; import javax.swing.*; public class Prob1_4 extends JPanel { private static final long serialVersionUID = 1L; private final int WIDTH = 1200; private final int HEIGHT = 800; int maxX ,maxY ; static JFrame f; float pixelWidth , pixelHeight; rWidth = 10.0F; rHeight = 7.5F; xP = -1, yP; FontMetrics metrics; public Prob1_4() { setPreferredSize(new Dimension(WIDTH, HEIGHT)); addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent evt) { xP = evt.getX(); yP = evt.getY(); f.repaint(); } } ); } void initgr() { Dimension d = getSize(); maxX = d.width - 1; maxY = d.height - 1; pixelWidth = rWidth/maxX; pixelHeight = rHeight/maxY; } int iX(float x){return Math.round(x/pixelWidth);} int iY(float y){return maxY - Math.round(y/pixelHeight);} float fx(int x){return x * pixelWidth;}
  • 2. float fy(int y){return (maxY - y) * pixelHeight;} public void paint(Graphics g) { initgr(); Graphics2D g2d = (Graphics2D) g; Point origin = new Point(WIDTH / 2, HEIGHT / 2); metrics = g.getFontMetrics(); double value1 = Math.pow(xP-origin.x,2); double value2 =Math.pow(yP- origin.y,2); int radius = (int)Math.sqrt(value1+value2); g.drawString( "Click anywhere on screen to generate hexagons of apprpriate radius! " , 40, 100); double size = (radius/253.0)*7.0; double rad = (radius/253.0)*30.0; drawHexGridLoop(g2d, origin, (int)size-2, (int)rad+5, 0); } //Method to draw regular hexagon private void drawHex(Graphics g, int posX, int posY, int x, int y, int r) { Graphics2D g2d = (Graphics2D) g; hexagon hex = new hexagon(x, y, r); hex.draw(g2d, x, y, 0, 0x008844, false); hex.draw(g2d, x, y, 4, 000000, false); } public static void main(String[] args) { f = new JFrame(); Prob1_4 p = new Prob1_4(); f.setContentPane(p); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } } int iX(float x){return Math.round(x/pixelWidth);} int iY(float y){return maxY - Math.round(y/pixelHeight);}
  • 3. float fx(int x){return x * pixelWidth;} float fy(int y){return (maxY - y) * pixelHeight;} public void paint(Graphics g) { initgr(); Graphics2D g2d = (Graphics2D) g; Point origin = new Point(WIDTH / 2, HEIGHT / 2); metrics = g.getFontMetrics(); double value1 = Math.pow(xP-origin.x,2); double value2 =Math.pow(yP- origin.y,2); int radius = (int)Math.sqrt(value1+value2); g.drawString( "Click anywhere on screen to generate hexagons of apprpriate radius! " , 40, 100); double size = (radius/253.0)*7.0; double rad = (radius/253.0)*30.0; drawHexGridLoop(g2d, origin, (int)size-2, (int)rad+5, 0); } //Method to draw regular hexagon private void drawHex(Graphics g, int posX, int posY, int x, int y, int r) { Graphics2D g2d = (Graphics2D) g; hexagon hex = new hexagon(x, y, r); hex.draw(g2d, x, y, 0, 0x008844, false); hex.draw(g2d, x, y, 4, 000000, false); } public static void main(String[] args) { f = new JFrame(); Prob1_4 p = new Prob1_4(); f.setContentPane(p); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } }
  • 4. Solution import java.awt.*; import java.awt.event.MouseAdaptor; import java.awt.event.MouseEvent; import javax.swing.*; public class Prob1_4 extends JPanel { private static final long serialVersionUID = 1L; private final int WIDTH = 1200; private final int HEIGHT = 800; int maxX ,maxY ; static JFrame f; float pixelWidth , pixelHeight; rWidth = 10.0F; rHeight = 7.5F; xP = -1, yP; FontMetrics metrics; public Prob1_4() { setPreferredSize(new Dimension(WIDTH, HEIGHT)); addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent evt) { xP = evt.getX(); yP = evt.getY(); f.repaint(); } } ); } void initgr() { Dimension d = getSize(); maxX = d.width - 1; maxY = d.height - 1; pixelWidth = rWidth/maxX; pixelHeight = rHeight/maxY; } int iX(float x){return Math.round(x/pixelWidth);} int iY(float y){return maxY - Math.round(y/pixelHeight);}
  • 5. float fx(int x){return x * pixelWidth;} float fy(int y){return (maxY - y) * pixelHeight;} public void paint(Graphics g) { initgr(); Graphics2D g2d = (Graphics2D) g; Point origin = new Point(WIDTH / 2, HEIGHT / 2); metrics = g.getFontMetrics(); double value1 = Math.pow(xP-origin.x,2); double value2 =Math.pow(yP- origin.y,2); int radius = (int)Math.sqrt(value1+value2); g.drawString( "Click anywhere on screen to generate hexagons of apprpriate radius! " , 40, 100); double size = (radius/253.0)*7.0; double rad = (radius/253.0)*30.0; drawHexGridLoop(g2d, origin, (int)size-2, (int)rad+5, 0); } //Method to draw regular hexagon private void drawHex(Graphics g, int posX, int posY, int x, int y, int r) { Graphics2D g2d = (Graphics2D) g; hexagon hex = new hexagon(x, y, r); hex.draw(g2d, x, y, 0, 0x008844, false); hex.draw(g2d, x, y, 4, 000000, false); } public static void main(String[] args) { f = new JFrame(); Prob1_4 p = new Prob1_4(); f.setContentPane(p); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } } int iX(float x){return Math.round(x/pixelWidth);}
  • 6. int iY(float y){return maxY - Math.round(y/pixelHeight);} float fx(int x){return x * pixelWidth;} float fy(int y){return (maxY - y) * pixelHeight;} public void paint(Graphics g) { initgr(); Graphics2D g2d = (Graphics2D) g; Point origin = new Point(WIDTH / 2, HEIGHT / 2); metrics = g.getFontMetrics(); double value1 = Math.pow(xP-origin.x,2); double value2 =Math.pow(yP- origin.y,2); int radius = (int)Math.sqrt(value1+value2); g.drawString( "Click anywhere on screen to generate hexagons of apprpriate radius! " , 40, 100); double size = (radius/253.0)*7.0; double rad = (radius/253.0)*30.0; drawHexGridLoop(g2d, origin, (int)size-2, (int)rad+5, 0); } //Method to draw regular hexagon private void drawHex(Graphics g, int posX, int posY, int x, int y, int r) { Graphics2D g2d = (Graphics2D) g; hexagon hex = new hexagon(x, y, r); hex.draw(g2d, x, y, 0, 0x008844, false); hex.draw(g2d, x, y, 4, 000000, false); } public static void main(String[] args) { f = new JFrame(); Prob1_4 p = new Prob1_4(); f.setContentPane(p); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } }