Here the reason for your problem: 0.1 cannot be represented as double... (!). Ok this post is old, but I recently found this stuff while reading the BigDecimal javadoc: BigDecimal(double). The recommended way is to use the BigDecimal(String) constructor.
This could help: SkinLF SkinRegion. (and please perform a search on the forum before you post, this will prevent the same topics to be answered every week)
[This message has been edited by PierreArnaud Galiana (edited July 05, 2001).]
I'd suggest to use the Document, as described in the Tutorial. Take advantage of the MVC architecture of Swing: the model (Document) contains the text, the view/controler (JTextField) displays/controls it.
Originally posted by karl koch: it occured to me that i could develop, compile and run an application on my computer and when i gave it to the customer he could not since some classes were not present in jre that were in jdk
I'd be happy to know which classes were missing, on which version... Have a look at the J2SE. The diagram at the end says it should not be so...
jre = java runtime environment jdk = java development kit (includes the jre) you need to install the jre to RUN java applications (if you don't have a jdk) you need to install the jdk to DEVELOP and RUN java applications the jre is installed in your jdk directory, under... 'jre' ;) it contains the jars, some jvms and a few exe (java...) it's basically a subset of the jdk targeted to java app user [This message has been edited by PierreArnaud Galiana (edited June 26, 2001).] [This message has been edited by PierreArnaud Galiana (edited June 26, 2001).]
Dear Remi, please have a look here: How to Use Menus (go under the "Bringing up a popup menu" paragraph). You'll see you have to use the isPopupTrigger() method of the MouseEvent to decide whether to call show() or not. If you do not, then it happens on each mouse event... 'gld 2 hlp'... [This message has been edited by PierreArnaud Galiana (edited June 25, 2001).]
mmh, looks like you need to implement the singleton pattern... (and this has nothing to do with Swing/JFC/AWT) have a look here: GoF singleton pattern Singleton in Java your ChildWin will implement the singleton pattern, and when ParentWin wants to get a ChildWin, it will call the instance() method [This message has been edited by PierreArnaud Galiana (edited June 23, 2001).]
Well, it depends how new you are to Java... (anyway welcome) And being french is not a problem either ;) If your problem is to use a JTable, then have a look at the tutorial: How to Use Tables. For the circles, try this: Shapes.
More generally, elements in a JComboBox are Objects. The toString() method is then applied to the objects in order to display them in the list or on the button. So you could use any Object with an appropriate toString method for display, whereas the getSelectedItem() methods returns you the Object, not the String (much more comfortable than the awt Choice, isn't it ?). In your case, you could use a java.lang.Integer. Now more details on rendering: the JComboBox uses a ListCellRenderer to... render the objects in a JList. The default implementation of the ListCellRenderer, DefaultListCellRenderer simply extends JLabel, and call toString on the Object to render.
[This message has been edited by PierreArnaud Galiana (edited June 22, 2001).]
Try this: subclass a JTable, make it implement the ListCellRenderer interface, and attach this to your JComboBox using the setRenderer method. [This message has been edited by PierreArnaud Galiana (edited June 22, 2001).]
How can I set a different width for the arrow button and the popup of a JComboBox ?
I looked at javax.swing.plaf.ComboBoxUI and its subclasses, but it's getting deep in the API, and I have a kind of "the deeper the more dangerous" feeling...