nikhil
progress bar in google map
1 Answer(s)      6 years and 8 months ago
Posted in : Development process
Advertisement
View Answers

October 14, 2008 at 4:02 PM


Hi Nikhil,


This is simple progress bar code. please implement following code,

import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class ProgressBarDemo extends JFrame implements ActionListener {
private JProgressBar progress;
private JButton button;
private JLabel label1;
private JPanel topPanel;


public ProgressBarDemo(){
setTitle("Progress Bar Application" );
setSize(310, 130 );
setBackground( Color.gray );

topPanel = new JPanel();
topPanel.setPreferredSize( new Dimension(310, 130 ));
getContentPane().add( topPanel );

// Create a label and progress bar
label1 = new JLabel("Waiting to start tasks..." );
label1.setPreferredSize(new Dimension(280, 24 ));
topPanel.add(label1);

progress = new JProgressBar(0,20);
progress.setPreferredSize( new Dimension(300, 20));
progress.setValue( 0 );
progress.setStringPainted(true);
progress.setBounds(20, 35, 260, 20 );
topPanel.add( progress );

button = new JButton("Start");
topPanel.add( button );
button.addActionListener( this );
}

public void actionPerformed(ActionEvent event){
if( event.getSource() == button ){
button.setEnabled(false);
for( int pbar = 1; pbar < 21; pbar++ ){
// Do some sort of simulated task
DoBogusTask(pbar);

// Update the progress indicator and label
label1.setText( "Performing task " + pbar + " of 20" );
Rectangle labelRect = label1.getBounds();
labelRect.x = 0;
labelRect.y = 0;
label1.paintImmediately( labelRect );

progress.setValue(pbar);
Rectangle progressRect = progress.getBounds();
progressRect.x = 0;
progressRect.y = 0;
progress.paintImmediately(progressRect);
}
}
}

public void DoBogusTask(int pbar){
Random random = new Random(pbar);
for( int iValue = 0; iValue < random.nextFloat() * 1000; iValue++ ){
//System.out.println( "iValue=" + iValue );
}
}

public static void main( String args[] ){
// Create an instance of the test application
ProgressBarDemo pb = new ProgressBarDemo();
pb.setVisible( true );
pb.setSize(400,200);
pb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
-------------------------------------

Thanks










Related Tutorials/Questions & Answers:
progress bar in google map - Development process
progress bar in google map   in my google map i want a progress bar... are loaded on the map.  Hi Nikhil, This is simple progress bar code...; private JPanel topPanel; public ProgressBarDemo(){ setTitle("Progress Bar
progress bar
progress bar  Hi guys, I'm doing a file upload in spring MVC technology. For file upload i did validation in client side.While uploading how to use an ajax function to show the progress bar
Advertisements
Progress Bar
Progress Bar  Hi friend, I'm interested in knowing how to progress bar in oracle forms 9i for the trigger when-button-pressed.Thankyou. Thanks and Regards, M.SHANKAR
Progress Bar - Swing AWT
Progress Bar  Hey if possible plz help me in making the following program work... i m using threads in order to make the progress bar auto increment..." is for manual updation of progress bar.. import java.awt.*; import javax.swing.
Progress Bar in Java
Progress Bar in Java       Progress Bar is a component used to show the status of the application... application. In Java Progress Bar is created using swing. The Swing Class used
about google map
about google map  how to add google map in website
about google map
about google map  how to add google map in website
Progress Bar implementation in Java Script
Progress Bar implementation in Java Script  Hi Friend, I am new to Java Script, but i want implement the progress bar in my html by reading... progress bar will show the status. I hope you under stand my issue. Please do
Dojo Progress Bar
Dojo Progress Bar          In this section, you will learn about the progress bar and how to create a progress bar in dojo. Try Online: Progress Bar Progress Bar
add google map javascript
add google map javascript  How can i add google map using javascript in my web page?   Search for the " Google Maps Javascript API" it will allow you to embed the Google Map into your web Page
ApplicationDevelopment Using Google Map
ApplicationDevelopment Using Google Map  I want application using google map please guide me how can i develop
Using Progress Bar in java apps
Using Progress Bar in java apps  Please, i am writing a program... write back to another file. I would like to know how to use a progress bar to mark the progress of the task.   Hi Friend, Try the following code: import
Google Map Integration - Ajax
Google Map Integration  Hi All, I am working on a vehicle tracking system project. I have to read data from sql server database and map the vehicle position in google map. I need to use ajax as the data is updated in every
Progress Bar in Java Swing
Progress Bar in Java Swing       In this section, you can learn how to handle progress bar in java swing. This section shows you how the progress bar starts and stops
Progress Bar in Java
Progress Bar in Java       Progress Bar is a component used to show the status of the application... application. In Java Progress Bar is created using swing. The Swing Class used
Create Progress Bar in SWT
Create Progress Bar in SWT   ... Bar. SWT allows to create a Progress bar by providing the class ProgressBar... the progress in the form of bar. The method setMinimum() sets the minimum value
JavaScript google map API example.
JavaScript google map API example.  How to Use Google Maps API in JavaScript?   Google Maps- A map is a way of representation of your route... routes, a road map shows you road, street information. In the same way google map
to make a google map point to user defined location
to make a google map point to user defined location  Hi, i wish to develop an google map,that takes the input from a form(city,area &Country... button, the form should be submitted and then the google map should display
Creating custom application download progress bar
Creating custom application download progress bar  ... will know how to create a customized application download progress bar... is raised. This download progress bar would not be displayed if the SWF
google map with jsf - Java Server Faces Questions
google map with jsf  hi, i am using jsf with googlemap.i load the script file with googlemap .its working fine.how can i load the database values(latlong) to googlemap from jsf bean values.i want to show mutiple markers
adding multiples markers to google map from a mysql database
adding multiples markers to google map from a mysql database   hello, i am trying to add markers to my googlemaps map. the latitudes and longitudes..." content="text/html; charset=utf-8"/> <title>Google Map API
adding multiples markers to google map from a mysql database
adding multiples markers to google map from a mysql database   hello, i am trying to add markers to my googlemaps map. the latitudes and longitudes...-type" content="text/html; charset=utf-8"/> <title>Google Map API V3
adding multiples markers to google map from a mysql database
adding multiples markers to google map from a mysql database   hello, i am trying to add markers to my googlemaps map. the latitudes and longitudes...-type" content="text/html; charset=utf-8"/> <title>Google Map API V3
adding multiples markers to google map from a mysql database
adding multiples markers to google map from a mysql database   hello, i am trying to add markers to my googlemaps map. the latitudes and longitudes...-type" content="text/html; charset=utf-8"/> <title>Google Map API V3
Google Map get Current Location on iphone and Android phones
Google Map get Current Location on iphone and Android phones  Hi, I am writing a simple javascript to get longitude and latitude for current location by using google API , but it works in my desktop browser but it doesn't
how to display the nearest palaces for the given latitude and longitude value in google map in android
how to display the nearest palaces for the given latitude and longitude value in google map in android  i m working in android. i need to display... in google map in android.. can any one help me
how to refresh google map using ajax by fetching lat long from database
how to refresh google map using ajax by fetching lat long from database ... the route travelled by it will be displayed on the google map by fetching the lat long from db. Now, i need to refresh the map using ajax.Pls help me how to do
map
map  using map, i want display message based on id selected [both are strings]   i do no   Hi Friend, Try the following code...) { Map map=new HashMap(); map.put("Message1","Hello
Map
Map  If I have an object implementing the Map interface in Java and I wish to iterate over every pair contained within it, what is the most efficient way of going through the map either iterator or for each loop or for loop
AJAX Progress Bar for KUpload+
AJAX Progress Bar for KUpload+      ... information about the current upload, just like pure HTML progress bar but instead of popup window it uses an inline progress bar with the AJAX technology