| 
| Spinner default [message #121273] | Sat, 01 April 2006 11:23  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: milnfalcon4163.yahoo.com 
 I using Eclipse 3.2M5a with VE 1.2M2. I want to set the swing number
 spinner default to 300 when it displays initially. I know how to hardcode
 it. However, I want to set the default in the number spinner's VE
 properties. How do I do it in VE?
 |  |  |  | 
|  | 
|  | 
|  | 
|  | 
|  | 
|  | 
|  | 
|  | 
|  | 
|  | 
|  | 
|  | 
|  | 
|  | 
|  | 
|  | 
|  | 
| 
| Re: Spinner default [message #612528 is a reply to message #121273] | Fri, 07 April 2006 10:45  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: richkulp.us.NO_SPAM.ibm.com 
 How do you do it through code?
 
 Richard wrote:
 > I using Eclipse 3.2M5a with VE 1.2M2. I want to set the swing number
 > spinner default to 300 when it displays initially. I know how to
 > hardcode it. However, I want to set the default in the number spinner's
 > VE properties. How do I do it in VE?
 >
 
 --
 Thanks,
 Rich Kulp
 |  |  |  | 
| 
| Re: Spinner default [message #612529 is a reply to message #121649] | Fri, 07 April 2006 11:11  |  | 
| Eclipse User  |  |  |  |  | private JSpinner getJSpinner() { if (jSpinner == null) {
 jSpinner = new JSpinner();
 jSpinner.setBounds(new Rectangle(40, 17, 54, 20));
 jSpinner.setValue(300);  <--- My code
 }
 return jSpinner;
 }
 |  |  |  | 
| 
| Re: Spinner default [message #612531 is a reply to message #121660] | Fri, 07 April 2006 12:23  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: richkulp.us.NO_SPAM.ibm.com 
 The problem is that setValue takes a java.lang.Object and so it can take
 anything. This is because JSpinner uses a model, and a model takes
 java.lang.Objects. The problem is that the default model for a JSpinner
 takes Integers (not int's, so you must be using 1.5 code with AutoBoxing
 if setValue(300) works. We don't support 1.5 new syntax features like
 autoboxing). But since it takes an Object we don't know what is valid so
 we can't put up a property editor to handle this.
 
 Richard wrote:
 >     private JSpinner getJSpinner() {
 >         if (jSpinner == null) {
 >             jSpinner = new JSpinner();
 >             jSpinner.setBounds(new Rectangle(40, 17, 54, 20));
 >             jSpinner.setValue(300);  <--- My code
 >         }
 >         return jSpinner;
 >     }
 >
 >
 
 --
 Thanks,
 Rich Kulp
 |  |  |  | 
|  | 
| 
| Re: Spinner default [message #612535 is a reply to message #121684] | Fri, 07 April 2006 12:37  |  | 
| Eclipse User  |  |  |  |  | sorry, Rich. i guess we were responding at the same time. Why can't you let the programmer set property values in the bean properties and let
 eclipse assemble or compile a constructor for that property?
 |  |  |  | 
| 
| Re: Spinner default [message #612538 is a reply to message #121697] | Fri, 07 April 2006 13:45  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: richkulp.us.NO_SPAM.ibm.com 
 Because we don't have a code editor there. The property editors are for
 it where it knows the type. If it needs to be some piece of code then
 the java editor pane should be used instead.
 
 Richard wrote:
 > sorry, Rich. i guess we were responding at the same time. Why can't you
 > let the programmer set property values in the bean properties and let
 > eclipse assemble or compile a constructor for that property?
 >
 
 --
 Thanks,
 Rich Kulp
 |  |  |  | 
|  | 
|  | 
| 
| Re: Spinner default [message #612545 is a reply to message #121749] | Fri, 07 April 2006 14:28  |  | 
| Eclipse User  |  |  |  |  | And even if the VE supported autoboxing syntax, there's still no way to divine that it's looking for an int value to be passed into the Object
 parameter to the setValue() method.
 
 - Keff
 |  |  |  | 
|  | 
|  | 
| 
| Re: Spinner default [message #612569 is a reply to message #121273] | Mon, 10 April 2006 02:34  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: johannes.testori.shark-soft.com 
 hi,
 i had the same problem. so i subclassed SpinnerNumberModel to create my
 own model and added getters and setters with type "int" that delegate to
 the original getters/setters (min, max, value).
 kind regards,
 hannes
 |  |  |  | 
| 
| Re: Spinner default [message #612574 is a reply to message #121922] | Mon, 10 April 2006 08:28  |  | 
| Eclipse User  |  |  |  |  | Thanks. In this case, some kind of code editor and/or something automatic that compiles java code like the constructors or the getters/setters would
 nice to  have. I hate to say this but it is the truth. I have seen
 something in another open source IDE. However, since this is not a show
 stopper, just a SMALL inconvenience SO FAR and the eclipse
 support/maintenance is light years better than the other open source java
 IDE SO FAR, I will wait for eclipse to catch up with their competitors.
 |  |  |  | 
|  | 
|  | 
Powered by 
FUDForum. Page generated in 0.65716 seconds