facebook

Button group BUG

  1. MyEclipse Archived
  2.  > 
  3. Matisse/Swing UI Development
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #329064 Reply

    Medioman
    Member

    hi,
    i’m trying to use a simple button group with 3 radio buttons, when i run my class radio buttons bheave like checkboxes.

    i tried to manually add buttons to button group but nothing seems to be solved.

    if i select all the radio buttons and then try to use “Binding menu” to bind them to the button group i get this error :

    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException
        at java.lang.Class.cast(Class.java:2990)
        at org.jdesktop.beansbinding.Binding.convertForward(Binding.java:1312)
        at org.jdesktop.beansbinding.Binding.getSourceValueForTarget(Binding.java:844)
        at org.jdesktop.beansbinding.Binding.refreshUnmanaged(Binding.java:1222)
        at org.jdesktop.beansbinding.Binding.refresh(Binding.java:1207)
        at org.jdesktop.beansbinding.AutoBinding.tryRefreshThenSave(AutoBinding.java:162)
        at org.jdesktop.beansbinding.AutoBinding.bindImpl(AutoBinding.java:199)
        at org.jdesktop.beansbinding.Binding.bindUnmanaged(Binding.java:959)
        at org.jdesktop.beansbinding.Binding.bind(Binding.java:944)
        at org.jdesktop.beansbinding.BindingGroup.bind(BindingGroup.java:143)
        at it.mediosoft.mostra.view.test.initComponents(test.java:108)
        at it.mediosoft.mostra.view.test.<init>(test.java:17)
        at it.mediosoft.mostra.view.test$1.run(test.java:120)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    

    this is the class code

    /*
     * CensimentoGabbie.java
     *
     * Created on __DATE__, __TIME__
     */
    
    package it.mediosoft.mostra.view;
    
    /**
     *
     * @author  __USER__
     */
    public class CensimentoGabbie extends javax.swing.JInternalFrame {
    
        /** Creates new form CensimentoGabbie */
        public CensimentoGabbie() {
            initComponents();
        }
    
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
        //GEN-BEGIN:initComponents
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
    bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
    
    
    buttonGroup1 = new javax.swing.ButtonGroup();
    jLabel1 = new javax.swing.JLabel();
    numerazioneContinua = new javax.swing.JRadioButton();
    numerazioneDiscontinua = new javax.swing.JRadioButton();
    numerazioneSingola = new javax.swing.JRadioButton();
    jLabel2 = new javax.swing.JLabel();
    jSeparator1 = new javax.swing.JSeparator();
    jSeparator2 = new javax.swing.JSeparator();
    jSeparator3 = new javax.swing.JSeparator();
    da = new javax.swing.JTextField();
    jLabel3 = new javax.swing.JLabel();
    a = new javax.swing.JTextField();
    jSeparator4 = new javax.swing.JSeparator();
    jLabel4 = new javax.swing.JLabel();
    jTextField1 = new javax.swing.JTextField();
    jLabel5 = new javax.swing.JLabel();
    jTextField2 = new javax.swing.JTextField();
    tipologiaGabbie = new javax.swing.JComboBox();
    jLabel6 = new javax.swing.JLabel();
    posizione = new javax.swing.JTextField();
    
    setClosable(true);
    setIconifiable(true);
    setMaximizable(true);
    setResizable(true);
    setTitle("Censimento Gabbie");
    
    jLabel1.setText("Tipologia Gabbia :");
    
    numerazioneContinua.setText("Numerazione Continua");
    
    org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, buttonGroup1, org.jdesktop.beansbinding.ObjectProperty.create(), numerazioneSingola, org.jdesktop.beansbinding.BeanProperty.create("selected"));
    bindingGroup.addBinding(binding);
    
    
    numerazioneDiscontinua.setText("Numerazione Discontinua");
    
    binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, buttonGroup1, org.jdesktop.beansbinding.ObjectProperty.create(), numerazioneSingola, org.jdesktop.beansbinding.BeanProperty.create("selected"));
    bindingGroup.addBinding(binding);
    
    
    numerazioneSingola.setText("Numerazione Singola");
    
    binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, buttonGroup1, org.jdesktop.beansbinding.ObjectProperty.create(), numerazioneSingola, org.jdesktop.beansbinding.BeanProperty.create("selected"));
    bindingGroup.addBinding(binding);
    
    
    jLabel2.setText("Numeri da :");
    
    jLabel3.setText("a");
    
    jLabel4.setText("Numeri separati :");
    
    jLabel5.setText("Numero Gabbia :");
    
    tipologiaGabbie.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selezionare dall'elenco" }));
    
    jLabel6.setText("Posizione :");
    
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createSequentialGroup()
    .add(90, 90, 90)
    .add(jLabel1)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
    .add(tipologiaGabbie, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 144, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addContainerGap(106, Short.MAX_VALUE))
    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(numerazioneDiscontinua)
    .add(numerazioneContinua))
    .add(25, 25, 25)
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createSequentialGroup()
    .add(4, 4, 4)
    .add(jLabel2)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(da, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(12, 12, 12)
    .add(jLabel3)
    .add(12, 12, 12)
    .add(a, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    .add(layout.createSequentialGroup()
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
    .add(jLabel4)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 153, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    .add(org.jdesktop.layout.GroupLayout.TRAILING, jSeparator4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE)
    .add(org.jdesktop.layout.GroupLayout.TRAILING, jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE)
    .add(layout.createSequentialGroup()
    .add(numerazioneSingola)
    .add(48, 48, 48)
    .add(jLabel5)
    .add(18, 18, 18)
    .add(jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addContainerGap(107, Short.MAX_VALUE))
    .add(jSeparator2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE)
    .add(jSeparator3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE)
    .add(layout.createSequentialGroup()
    .add(109, 109, 109)
    .add(jLabel6)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
    .add(posizione, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 140, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addContainerGap(131, Short.MAX_VALUE))
    );
    layout.setVerticalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createSequentialGroup()
    .addContainerGap()
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(jLabel1)
    .add(tipologiaGabbie, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    .add(38, 38, 38)
    .add(jSeparator4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(5, 5, 5)
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(jLabel2)
    .add(da, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(jLabel3)
    .add(a, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(numerazioneContinua))
    .add(14, 14, 14)
    .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(jLabel4)
    .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(numerazioneDiscontinua))
    .add(9, 9, 9)
    .add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(numerazioneSingola)
    .add(jLabel5)
    .add(jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
    .add(jSeparator3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(jLabel6)
    .add(posizione, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    .addContainerGap(98, Short.MAX_VALUE))
    );
    
    bindingGroup.bind();
    
    pack();
    }// </editor-fold>
    
        //GEN-END:initComponents
    
        //GEN-BEGIN:variables
        // Variables declaration - do not modify
        private javax.swing.JTextField a;
        private javax.swing.ButtonGroup buttonGroup1;
        private javax.swing.JTextField da;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JLabel jLabel4;
        private javax.swing.JLabel jLabel5;
        private javax.swing.JLabel jLabel6;
        private javax.swing.JSeparator jSeparator1;
        private javax.swing.JSeparator jSeparator2;
        private javax.swing.JSeparator jSeparator3;
        private javax.swing.JSeparator jSeparator4;
        private javax.swing.JTextField jTextField1;
        private javax.swing.JTextField jTextField2;
        private javax.swing.JRadioButton numerazioneContinua;
        private javax.swing.JRadioButton numerazioneDiscontinua;
        private javax.swing.JRadioButton numerazioneSingola;
        private javax.swing.JTextField posizione;
        private javax.swing.JComboBox tipologiaGabbie;
        private org.jdesktop.beansbinding.BindingGroup bindingGroup;
        // End of variables declaration//GEN-END:variables
    
    }

    i use Myeclipse for spring 8.6 , sorry for my bad english but i’m italian 🙂

    #329108 Reply

    support-swapna
    Moderator

    Medioman,

    Can you please make sure if you have added all three buttons to the binding?
    In the code I see only button 3 i.e numerazioneSingola in all the three createautobinding calls.

    I also suggest you cross post to development forums for better support.

    Hope this helps.

    #329115 Reply

    Medioman
    Member

    Can you please make sure if you have added all three buttons to the binding?
    In the code I see only button 3 i.e numerazioneSingola in all the three createautobinding calls.

    this is a BUG of myeclipse Matisse, if you select more than one radio button to create the binding, myeclipse generates the code only for the first radio button of your selection and repeats it for the number of selected elements.

    furthermore i’ve updated my IDE yesterday and now when i use matisse plugin, each time i place any component the IDE move the view to the source code.

    #329116 Reply

    support-swapna
    Moderator

    Medioman ,

    1. Can you please copy paste the Installation Details from MyEclipse > Installation Summary > Installation Details ?

    2. For the problem with switching the view to Source from design view , it appears to be related to a particular plugin. It’s the plugin that contributes the Spring Annotations view, JPA Annotations view and the JAX-WS Annotations view.

    Can you please try these steps to see if it gets around the problem for you?

    1. Make sure the three views listed above are not open (they are not open by default in the MyEclipse Swing/Matisse perspective).
    2. Open the Window > Preferences dialog.
    3. Type “Start” into the filter box on the top left (without the quotes).
    4. Select the “Startup and Shutdown” item in the tree.
    5. Find the “Skyway Composite Editor Framework” item in the list and un-check it.
    6. Press Apply, then OK.
    7. Restart MyEclipse for Spring.
    8. Try your Matisse editor again.

    3. We are investigating the issue with the radio button binding. I will get back to you on this.

    Sorry for inconvenience caused.

    #329123 Reply

    Medioman
    Member

    Posted: Aug 13, 2012 – 08:41 AM
    Medioman ,

    1. Can you please copy paste the Installation Details from MyEclipse > Installation Summary > Installation Details ?

    2. For the problem with switching the view to Source from design view , it appears to be related to a particular plugin. It’s the plugin that contributes the Spring Annotations view, JPA Annotations view and the JAX-WS Annotations view.

    Can you please try these steps to see if it gets around the problem for you?

    1. Make sure the three views listed above are not open (they are not open by default in the MyEclipse Swing/Matisse perspective).
    2. Open the Window > Preferences dialog.
    3. Type “Start” into the filter box on the top left (without the quotes).
    4. Select the “Startup and Shutdown” item in the tree.
    5. Find the “Skyway Composite Editor Framework” item in the list and un-check it.
    6. Press Apply, then OK.
    7. Restart MyEclipse for Spring.
    8. Try your Matisse editor again.

    this didn’t solve the problem. I’ve reinstalled myeclipse without updating it, and the problem is gone.

    i founded an other bug in Matisse/swing plugin, if i place components using the visual editor all work fine, but if i write some code to add components they are not shown in the visual prospective; seems like it’s not refreshing or it is only one-way use.

    #329124 Reply

    Medioman
    Member

    *** Date:
    lunedì 13 agosto 2012 18.00.35 CEST

    ** System properties:
    OS=WindowsVista
    OS version=6.1.0
    Java version=1.6.0_13

    *** MyEclipse details:
    MyEclipse Enterprise Workbench
    Version: 8.6
    Build id: 8.6-20100723

    *** Eclipse details:
    MyEclipse for Spring

    Version: 8.6.0

    Eclipse startup command=-os
    win32
    -ws
    win32
    -arch
    x86
    -showsplash
    -launcher
    C:\MyEclipse for Spring 8.6\myeclipseforspring.exe
    -name
    Myeclipseforspring
    –launcher.library
    C:\MyEclipse for Spring 8.6\../Users/Mattia/AppData/Local/Genuitec/Common/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519\eclipse_1206.dll
    -startup
    C:\MyEclipse for Spring 8.6\../Users/Mattia/AppData/Local/Genuitec/Common/plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
    -install
    C:/MyEclipse for Spring 8.6
    -configuration
    configuration
    -vm
    C:/Users/Mattia/AppData/Local/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin/client/jvm.dll

    #329254 Reply

    Brian Fernandes
    Moderator

    Medioman,

    We were able to replicate the problems you mentioned here and I’ve filed a bug for investigation. I’m afraid, for now, I cannot suggest any workarounds.

    If you are starting a new project, I would recommend using the “Swing Designer for MyEclipse” which you can install from our configuration center – Help > MyEclipse Configuration Center – the Dashboard tab under the MyEclipse Features section. This designer does support synching both ways.

    We will be deprecating the Matisse designer in the near future in favor of using the the Swing Designer.

    I apologize for the inconvenience caused.

    #329317 Reply

    Medioman
    Member

    thanks for your support,

    if i generate my swing interfaces using NetBeans, will this mess myeclipse project up ?

    #329337 Reply

    Brian Fernandes
    Moderator

    medioman,

    No, using NetBeans for the visual interface development should not cause problems with the MyEclipse project.

    I’m assuming you will need a NetBeans project structure at the same place as the MyEclipse project (in the same folder) – obviously, any changes made to this project structure by Netbeans (like the addition of a library for instance) will not be reflected in the MyEclipse project.

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Button group BUG

You must be logged in to post in the forum log in