Results 1 to 4 of 4
- 04-24-2008, 12:45 PM #1
Member
- Join Date
- Apr 2008
- Posts
- 9
- Rep Power
- 0
Two problem for my rssi calculation program
I have downloaded a program, which can calculate rssi signal on a grid sheet.
1. I want to build a button, when I press the button, it pop up another window which show a graph on the data the program just calculated.
Can this be done ?
2. I want to insert a image to be the background of the grids, instead of that piece of white sheet, can this be done ?
- 04-24-2008, 06:42 PM #2
Yes this can be done, have you ever used paintcomponent before.
- 04-24-2008, 08:17 PM #3
Member
- Join Date
- Apr 2008
- Posts
- 9
- Rep Power
- 0
Sorry I have not used this before, as I am new to java hope someone can solve my problem here...
Q1. Here is where I want to plot graph.
I build a button here, but,Java 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));
This class is still empty I do not know how to implement the plotting thing...Java Code:class MainSim_jButton3_actionAdapter implements ActionListener { }
Q2. Here is where I want to insert the image.
Java 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); } } }
- 04-25-2008, 03:49 PM #4
Similar Threads
-
Problem with my first Struts program....please help me
By sireesha in forum Web FrameworksReplies: 5Last Post: 10-16-2011, 04:19 PM -
Two problem for my rssi calculation program
By iamchoilan in forum Java 2DReplies: 12Last Post: 04-27-2008, 07:56 PM -
Problem with Calculation ....
By danny000 in forum New To JavaReplies: 1Last Post: 04-15-2008, 02:42 PM -
Problem with my program HelloWorld
By trill in forum New To JavaReplies: 1Last Post: 08-05-2007, 05:32 PM -
getting problem in compiling java program?
By sathish04021984 in forum New To JavaReplies: 3Last Post: 07-30-2007, 09:26 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks