Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem Handling Long Data types in GUI
#1
Sir,

I have written a GUI based Address Book program where i have used long data type to store mobile number. The GUI is showing a .0 at the end of each mobile # as if it is a decimal value.

The Mobile # values in the database slightly differ with the values displayed in the GUI as well.

Please suggest a solution.
Reply
#2
You can use DecimalFormat to format the out put of numbers

package testproject;

import java.text.DecimalFormat;

public class Main {

public static void main(String[] args) {
double numberToRound = 12345.6789;

DecimalFormat df = new DecimalFormat("0");
System.out.println("Rounded number = " + df.format(numberToRound));
}
}

The output will be as
Rounded number = 12345

Let me know if you are unable to solve the problem with this.

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How find the data in ArrayList? 2011-12 Vuhelper 0 2,492 09-04-2011, 07:21 AM
Last Post: Vuhelper
  Exception Handling in Java 2011 Vuhelper 0 1,978 07-23-2011, 05:46 PM
Last Post: Vuhelper
  Error 1721: There is a problem with this Windows Installer Package Xpert 0 1,431 06-24-2011, 07:48 AM
Last Post: Xpert
  JAVA Error 1723. There is a problem with this Windows installer package Xpert 0 1,397 06-24-2011, 07:40 AM
Last Post: Xpert
  10 types or errors in java netbeans for beginners Xpert 0 1,717 06-23-2011, 11:35 PM
Last Post: Xpert
  java 3D problem 2011 Vuhelper 0 958 06-09-2011, 09:57 PM
Last Post: Vuhelper
  Data Submit Problems in Web Forms saneha 2 1,987 04-27-2011, 08:57 PM
Last Post: Xpert
  Retrieving data in a JTable saneha 1 4,823 04-27-2011, 06:35 AM
Last Post: Vuhelper
  Event Handling in java saneha 1 2,271 04-24-2011, 09:36 PM
Last Post: Vuhelper
  java problem in function saneha 1 2,291 04-24-2011, 09:31 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)