View Single Post
  #5 (permalink)  
Old 04-24-2008, 09:13 PM
iamchoilan iamchoilan is offline
Member
 
Join Date: Apr 2008
Posts: 9
iamchoilan is on a distinguished road
Oh there is still error, can you please have a look in the program ?
Sorry I am new to java hope someone can solve my problem here...

Q1. Here is where I want to plot graph.

Code:
jButton3.setBounds(new Rectangle(8, 5, 70, 22)); jButton3.setMargin(new Insets(0, 0, 0, 0)); jButton3.setText("Plot"); jButton3.addActionListener(new MainSim_jButton3_actionAdapter(this));
I build a button here, but,

Code:
class MainSim_jButton3_actionAdapter implements ActionListener { }
This class is still empty I do not know how to implement the plotting thing...


Q2. Here is where I want to insert the image.

Code:
public void paint(Graphics g) { g.setColor(Color.white); g.fillRect(0, 0, getWidth(), getHeight()); //Here it draw the white part. g.setColor(Color.gray); if (fpPoints != null && fpPoints.length > 0) { for (int i = 0; i < fpPoints.length; i++) { g.drawLine(0, pix_grid * i, getWidth(), pix_grid * i); } for (int j = 0; j < fpPoints[0].length; j++) { g.drawLine(pix_grid * j, 0, pix_grid * j, getHeight()); } } //And here it draw the gray lines. super.paint(g); String p = ""; Color cp = Color.black; java.util.Random r = new java.util.Random(10); if (highlight != null) { for (int i = 0; i < highlight.size(); i++) { FpPoint fpp1 = (FpPoint) highlight.get(i); if (!p.equalsIgnoreCase(fpp1.getFPRss())) { //g.setColor(new Color((int)(Math.random()*2)*255, (int)(Math.random()*2)*255, (int)(Math.random()*2)*255)); g.setColor(new Color( (int) (r.nextFloat() * 2) * 255, (int) (r.nextFloat() * 2) * 255, (int) (r.nextFloat() * 2) * 255)); if (g.getColor().equals(Color.white)) { g.setColor(Color.gray); } p = fpp1.getFPRss(); } //g.fillOval(MainSim.m2pixel(fpp1.getPointYm()) - 4, MainSim.m2pixel(fpp1.getPointXm()) - 4, 8, 8); g.fillOval(MainSim.m2pixel(fpp1.getPointYm()) - pix_grid / 2, MainSim.m2pixel(fpp1.getPointXm()) - pix_grid / 2, pix_grid, pix_grid); } } if ( apsdata != null ){ for ( int i = 0 ; i < apsdata.size() ; i ++){ ApsData ad = (ApsData) apsdata.get(i); g.setColor(Color.black); g.fillRect(MainSim.m2pixel(ad.getXm()), MainSim.m2pixel(ad.getYm()), 26, 16); g.setColor(Color.white); g.drawString(String.valueOf(ad.getRssiAvg()), MainSim.m2pixel(ad.getXm())+3, MainSim.m2pixel(ad.getYm()) + 13); } } }

Last edited by iamchoilan : 04-24-2008 at 09:15 PM.
Reply With Quote