🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #11647

Re: JTable cell formatting

#11647
From: Christian Kaufhold
Date: Tue, 04 May 1999 00:00
11 lines
1160 bytes
In comp.lang.java.gui Mike Wolterink <m.wolterink@nedap.nl> wrote:
> I want to 'format' my Double that I put in the JTable,
> i.e.:   400.3000000  becomes 400.3 (I don't want that !!!)
> I want to give a precision to the Double (400.30).
> When I make a String of it, it aligns to the left and I don't want that
> either !

Use a custom TableCellRenderer, and have a look at java.text.NumberFormat/
java.text.DecimalFormat to format your numbers.

Christian
Technical Details
Message-ID: <t61ng7.uf.ln@nandus.uni-bremen.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7gmp1e$opi$1@news.worldonline.nl>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,61d4beeaae1dc2c3
X-Google-Attributes: gid111d45,public
X-Google-Thread: 10fd6d,61d4beeaae1dc2c3
X-Google-Attributes: gid10fd6d,public
X-Google-Thread: 10a146,61d4beeaae1dc2c3
X-Google-Attributes: gid10a146,public
From: Christian Kaufhold <chka@uni-bremen.de>
Subject: Re: JTable cell formatting
Date: 1999/05/04
Message-ID: <t61ng7.uf.ln@nandus.uni-bremen.de>
X-Deja-AN: 473963576
References: <7gmp1e$opi$1@news.worldonline.nl>
Organization: Uni Bremen, ZfN
User-Agent: tin/pre-1.4-980618 (UNIX) (Linux/2.0.36 (i586))
Newsgroups: borland.public.jbuilder.java.swing,comp.lang.java.gui,comp.lang.java.programmer