Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-24-2008, 02:45 PM
Member
 
Join Date: Apr 2008
Posts: 9
iamchoilan is on a distinguished road
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 ?
Attached Files
File Type: zip Simulation_tool.zip (45.7 KB, 11 views)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-24-2008, 08:42 PM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 386
Zosden is on a distinguished road
Yes this can be done, have you ever used paintcomponent before.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-24-2008, 10:17 PM
Member
 
Join Date: Apr 2008
Posts: 9
iamchoilan is on a distinguished road
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.

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); } } }
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-25-2008, 05:49 PM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 386
Zosden is on a distinguished road
make an array of your plots and then just iterate through it and plot them as g.drawLine(xvalue of the first one, yValue of the first one, xValue of the next one, yValue of the second one). The hardest part of this is to figure out what the x and y's are.
__________________
My IP address is 127.0.0.1
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Two problem for my rssi calculation program iamchoilan Java 2D 12 04-27-2008 09:56 PM
Problem with Calculation .... danny000 New To Java 1 04-15-2008 04:42 PM
Problem with my first Struts program....please help me sireesha Web Frameworks 4 04-04-2008 08:33 AM
Problem with my program HelloWorld trill New To Java 1 08-05-2007 07:32 PM
getting problem in compiling java program? sathish04021984 New To Java 3 07-30-2007 11:26 AM


All times are GMT +3. The time now is 09:03 AM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org