Package javax.swing

Examples of javax.swing.JRadioButton


            panelText = new JPanel(new BorderLayout());
            panelText.add(jsp, BorderLayout.CENTER);
        }
        {
            // Boolean
            radioTrue = new JRadioButton(language.getText("yes"));
            radioFalse = new JRadioButton(language.getText("no"));
            ButtonGroup group = new ButtonGroup();
            group.add(radioFalse);
            group.add(radioTrue);
            radioTrue.setSelected(true);
            panelBoolean = new JPanel(new GridBagLayout());
View Full Code Here


                public void actionPerformed(ActionEvent e) {
                    nextRealAction.actionPerformed(e);
                    updateSelectionUI(selectedIndex);
                }
            };
            JRadioButton nextButton = new JRadioButton(nextWrapperAction);
            nextButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
            JPanel nextExporterPanel = new JPanel(new BorderLayout());
            nextExporterPanel.add(nextButton, BorderLayout.NORTH);
            myButtons[i] = nextButton;
            myExporterToggles.add(nextButton);
            JComponent nextOptionComponent = choiceComponents[i];
View Full Code Here

            panelText = new JPanel(new BorderLayout());
            panelText.add(jsp, BorderLayout.CENTER);
        }
        {
            // Boolean
            radioTrue = new JRadioButton(language.getText("yes"));
            radioFalse = new JRadioButton(language.getText("no"));
            ButtonGroup group = new ButtonGroup();
            group.add(radioFalse);
            group.add(radioTrue);
            radioTrue.setSelected(true);
           
View Full Code Here

                .getSize()));
        genePanel.add(lblSeparatedField, BorderLayout.WEST);
        vb.add(genePanel);

        JPanel fixedPanel = new JPanel(new BorderLayout());
        fixedPanel.add(bFixedSize = new JRadioButton(), BorderLayout.WEST);
        // bFixedSize.setEnabled(false);
        bFixedSize.addActionListener(this);
        fixedPanel.add(new JLabel(language.getText("fixedWidth")),
                BorderLayout.CENTER);
        vb.add(fixedPanel);

        JPanel separatedPanel = new JPanel(new BorderLayout());
        separatedPanel.add(bSeparatedText = new JRadioButton(),
                BorderLayout.WEST);
        bSeparatedText.addActionListener(this);
        separatedPanel.add(new JLabel(language.getText("separated")),
                BorderLayout.CENTER);
        vb.add(separatedPanel);

        JPanel separatorFieldPanel = new JPanel(new GridBagLayout());
        vb.add(separatorFieldPanel);
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets.right = 15;
        gbc.insets.left = 10;
        gbc.insets.top = 10;

        addUsingGBL(separatorFieldPanel, bDoubleDot = new JRadioButton(), gbc,
                0, 0, 1, 1);
        bDoubleDot.addActionListener(this);
        addUsingGBL(separatorFieldPanel, new JLabel(language
                .getText("doubledot")), gbc, 1, 0, 1, 1);
        addUsingGBL(separatorFieldPanel, bDotComa = new JRadioButton(), gbc, 3,
                0, 1, 1);
        bDotComa.addActionListener(this);
        addUsingGBL(separatorFieldPanel,
                new JLabel(language.getText("dotComa")), gbc, 4, 0, 1, 1);
        addUsingGBL(separatorFieldPanel, bComa = new JRadioButton(), gbc, 6, 0,
                1, 1);
        bComa.addActionListener(this);
        addUsingGBL(separatorFieldPanel, new JLabel(language.getText("coma")),
                gbc, 7, 0, 1, 1);
        bSpace = new JRadioButton();
        // addUsingGBL(separatorFieldPanel, bSpace , gbc, 0, 1, 1, 1);
        bSpace.addActionListener(this);
        // addUsingGBL(separatorFieldPanel, new
        // JLabel(language.getText("space")), gbc, 1, 1, 1, 1);
        addUsingGBL(separatorFieldPanel, bOther = new JRadioButton(), gbc, 6,
                1, 1, 1);
        bOther.addActionListener(this);
        addUsingGBL(separatorFieldPanel, new JLabel(language.getText("other")),
                gbc, 7, 1, 1, 1);
        addUsingGBL(separatorFieldPanel, tfOther = new JTextField(5), gbc, 8,
View Full Code Here

    }

    /** Action performed. */
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() instanceof JRadioButton) {
            JRadioButton selectedButton = (JRadioButton) e.getSource();
            if (!selectedButton.isSelected())
                selectedButton.setSelected(true);
        }

        if (e.getSource() == bFixedSize && bFixedSize.isSelected()) {
            bSeparatedText.setSelected(false);
            enableSeparatedButton(false);
View Full Code Here

         * true); bNonWork = new JRadioButton("Working Day", new
         * ImageIcon(getClass().getResource("/icons/non_working_day_16.gif")),
         * false);
         */

        bWork = new JRadioButton("Working Day", true);
        bNonWork = new JRadioButton("Non-Working Day", false);

        /*
         * panel3.add(bWork, BorderLayout.WEST); panel3.add(bNonWork,
         * BorderLayout.EAST);
         */
 
View Full Code Here

    // 14. Edit 3D view modal dialog box to change ground texture
    attributesDialog = showHome3DAttributesPanel(preferences, controller, frame, tester);
    panel = (Home3DAttributesPanel)TestUtilities.findComponent(
        attributesDialog, Home3DAttributesPanel.class);
    panelController = (Home3DAttributesController)TestUtilities.getField(panel, "controller");
    JRadioButton groundColorRadioButton =
        (JRadioButton)TestUtilities.getField(panel, "groundColorRadioButton");
    final TextureChoiceComponent groundTextureButton =
        (TextureChoiceComponent)panelController.getGroundTextureController().getView();
    JRadioButton groundTextureRadioButton =
        (JRadioButton)TestUtilities.getField(panel, "groundTextureRadioButton");
   
    // Check color and texture radio buttons
    assertTrue("Ground color radio button isn't checked",
        groundColorRadioButton.isSelected());
    assertFalse("Ground texture radio button is checked",
        groundTextureRadioButton.isSelected());
    // Click on ground texture button
    tester.invokeLater(new Runnable() {
        public void run() {
          // Display texture dialog later in Event Dispatch Thread to avoid blocking test thread
          groundTextureButton.doClick();
        }
      });
    // Wait for 3D view to be shown
    String groundTextureTitle = preferences.getLocalizedString(
        Home3DAttributesController.class, "groundTextureTitle");
    tester.waitForFrameShowing(new AWTHierarchy(), groundTextureTitle);
    // Check texture dialog box is displayed
    JDialog textureDialog = (JDialog)new BasicFinder().find(attributesDialog,
        new WindowMatcher(groundTextureTitle));
    assertTrue("Texture dialog not showing", textureDialog.isShowing());
   
    JList availableTexturesList = (JList)new BasicFinder().find(textureDialog,
        new ClassMatcher(JList.class, true));
    availableTexturesList.setSelectedIndex(0);
    CatalogTexture firstTexture = preferences.getTexturesCatalog().getCategories().get(0).getTexture(0);
    assertEquals("Wrong first texture in list", firstTexture,
        availableTexturesList.getSelectedValue());
   
    // Click on OK in texture dialog box
    doClickOnOkInDialog(textureDialog, tester);
    // Check color and texture radio buttons
    assertFalse("Ground color radio button is checked",
        groundColorRadioButton.isSelected());
    assertTrue("Ground texture radio button isn't checked",
        groundTextureRadioButton.isSelected());
   
    // Click on OK in 3D attributes dialog box
    doClickOnOkInDialog(attributesDialog, tester);
   
    // Check home attributes are modified accordingly
View Full Code Here

   
    if (controller.isPropertyEditable(UserPreferencesController.Property.UNIT)) {
      // Create unit label and radio buttons bound to controller UNIT property
      this.unitLabel = new JLabel(preferences.getLocalizedString(
          UserPreferencesPanel.class, "unitLabel.text"));
      this.centimeterRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "centimeterRadioButton.text"),
          controller.getUnit() == LengthUnit.CENTIMETER);
      this.centimeterRadioButton.setActionCommand(LengthUnit.CENTIMETER.name());
      this.inchRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "inchRadioButton.text"),
          controller.getUnit() == LengthUnit.INCH);
      this.inchRadioButton.setActionCommand(LengthUnit.INCH.name());
      this.millimeterRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "millimeterRadioButton.text"),
          controller.getUnit() == LengthUnit.MILLIMETER);
      this.millimeterRadioButton.setActionCommand(LengthUnit.MILLIMETER.name());
      this.meterRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "meterRadioButton.text"),
          controller.getUnit() == LengthUnit.METER);
      this.meterRadioButton.setActionCommand(LengthUnit.METER.name());
      final ButtonGroup unitButtonGroup = new ButtonGroup();
      unitButtonGroup.add(this.centimeterRadioButton);
      unitButtonGroup.add(this.inchRadioButton);
      unitButtonGroup.add(this.millimeterRadioButton);
      unitButtonGroup.add(this.meterRadioButton);

      ItemListener unitChangeListener = new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            controller.setUnit(LengthUnit.valueOf(unitButtonGroup.getSelection().getActionCommand()));
          }
        };
      this.centimeterRadioButton.addItemListener(unitChangeListener);
      this.inchRadioButton.addItemListener(unitChangeListener);
      this.millimeterRadioButton.addItemListener(unitChangeListener);
      this.meterRadioButton.addItemListener(unitChangeListener);
      controller.addPropertyChangeListener(UserPreferencesController.Property.UNIT,
          new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent ev) {
              switch (controller.getUnit()) {
                case CENTIMETER :
                  centimeterRadioButton.setSelected(true);
                  break;
                case INCH :
                  inchRadioButton.setSelected(true);
                  break;
                case MILLIMETER :
                  millimeterRadioButton.setSelected(true);
                  break;
                case METER :
                  meterRadioButton.setSelected(true);
                  break;
              }
            }
          });
    }
   
    if (controller.isPropertyEditable(UserPreferencesController.Property.FURNITURE_CATALOG_VIEWED_IN_TREE)) {
      // Create furniture catalog label and radio buttons bound to controller FURNITURE_CATALOG_VIEWED_IN_TREE property
      this.furnitureCatalogViewLabel = new JLabel(preferences.getLocalizedString(
          UserPreferencesPanel.class, "furnitureCatalogViewLabel.text"));
      this.treeRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "treeRadioButton.text"),
          controller.isFurnitureCatalogViewedInTree());
      this.listRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "listRadioButton.text"),
          !controller.isFurnitureCatalogViewedInTree());
      ButtonGroup furnitureCatalogViewButtonGroup = new ButtonGroup();
      furnitureCatalogViewButtonGroup.add(this.treeRadioButton);
      furnitureCatalogViewButtonGroup.add(this.listRadioButton);
 
      ItemListener furnitureCatalogViewChangeListener = new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            controller.setFurnitureCatalogViewedInTree(treeRadioButton.isSelected());
          }
        };
      this.treeRadioButton.addItemListener(furnitureCatalogViewChangeListener);
      this.listRadioButton.addItemListener(furnitureCatalogViewChangeListener);
      controller.addPropertyChangeListener(UserPreferencesController.Property.FURNITURE_CATALOG_VIEWED_IN_TREE,
          new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent ev) {
              treeRadioButton.setSelected(controller.isFurnitureCatalogViewedInTree());
            }
          });
    }

    if (controller.isPropertyEditable(UserPreferencesController.Property.NAVIGATION_PANEL_VISIBLE)
        && !"true".equalsIgnoreCase(System.getProperty("com.eteks.sweethome3d.no3D"))) {
      // Create navigation panel label and check box bound to controller NAVIGATION_PANEL_VISIBLE property
      this.navigationPanelLabel = new JLabel(preferences.getLocalizedString(
          UserPreferencesPanel.class, "navigationPanelLabel.text"));
      this.navigationPanelCheckBox = new JCheckBox(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "navigationPanelCheckBox.text"));
      if (!OperatingSystem.isMacOSX()
          || OperatingSystem.isMacOSXLeopardOrSuperior()) {
        this.navigationPanelCheckBox.setSelected(controller.isNavigationPanelVisible());
        this.navigationPanelCheckBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent ev) {
              controller.setNavigationPanelVisible(navigationPanelCheckBox.isSelected());
            }
          });
        controller.addPropertyChangeListener(UserPreferencesController.Property.NAVIGATION_PANEL_VISIBLE,
            new PropertyChangeListener() {
              public void propertyChange(PropertyChangeEvent ev) {
                navigationPanelCheckBox.setSelected(controller.isNavigationPanelVisible());
              }
            });
      } else {
        // No support for navigation panel under Mac OS X Tiger (too unstable)
        this.navigationPanelCheckBox.setEnabled(false);
      }
    }

    if (controller.isPropertyEditable(UserPreferencesController.Property.MAGNETISM_ENABLED)) {
      // Create magnetism label and check box bound to controller MAGNETISM_ENABLED property
      this.magnetismLabel = new JLabel(preferences.getLocalizedString(
          UserPreferencesPanel.class, "magnetismLabel.text"));
      this.magnetismCheckBox = new JCheckBox(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "magnetismCheckBox.text"), controller.isMagnetismEnabled());
      this.magnetismCheckBox.addItemListener(new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            controller.setMagnetismEnabled(magnetismCheckBox.isSelected());
          }
        });
      controller.addPropertyChangeListener(UserPreferencesController.Property.MAGNETISM_ENABLED,
          new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent ev) {
              magnetismCheckBox.setSelected(controller.isMagnetismEnabled());
            }
          });
    }

    if (controller.isPropertyEditable(UserPreferencesController.Property.RULERS_VISIBLE)) {
      // Create rulers label and check box bound to controller RULERS_VISIBLE property
      this.rulersLabel = new JLabel(preferences.getLocalizedString(
          UserPreferencesPanel.class, "rulersLabel.text"));
      this.rulersCheckBox = new JCheckBox(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "rulersCheckBox.text"), controller.isRulersVisible());
      this.rulersCheckBox.addItemListener(new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            controller.setRulersVisible(rulersCheckBox.isSelected());
          }
        });
      controller.addPropertyChangeListener(UserPreferencesController.Property.RULERS_VISIBLE,
          new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent ev) {
              rulersCheckBox.setSelected(controller.isRulersVisible());
            }
          });
    }
   
    if (controller.isPropertyEditable(UserPreferencesController.Property.GRID_VISIBLE)) {
      // Create grid label and check box bound to controller GRID_VISIBLE property
      this.gridLabel = new JLabel(preferences.getLocalizedString(
          UserPreferencesPanel.class, "gridLabel.text"));
      this.gridCheckBox = new JCheckBox(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "gridCheckBox.text"), controller.isGridVisible());
      this.gridCheckBox.addItemListener(new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            controller.setGridVisible(gridCheckBox.isSelected());
          }
        });
      controller.addPropertyChangeListener(UserPreferencesController.Property.GRID_VISIBLE,
          new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent ev) {
              gridCheckBox.setSelected(controller.isGridVisible());
            }
          });
    }
   
    if (controller.isPropertyEditable(UserPreferencesController.Property.FURNITURE_VIEWED_FROM_TOP)) {
      // Create furniture appearance label and radio buttons bound to controller FURNITURE_VIEWED_FROM_TOP property
      this.furnitureIconLabel = new JLabel(preferences.getLocalizedString(
          UserPreferencesPanel.class, "furnitureIconLabel.text"));
      this.catalogIconRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "catalogIconRadioButton.text"),
          !controller.isFurnitureViewedFromTop());
      this.topViewRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "topViewRadioButton.text"),
          controller.isFurnitureViewedFromTop());
      if ("true".equalsIgnoreCase(System.getProperty("com.eteks.sweethome3d.no3D"))) {
        this.catalogIconRadioButton.setEnabled(false);
        this.topViewRadioButton.setEnabled(false);
      } else {
        if (Component3DManager.getInstance().isOffScreenImageSupported()) {
          ButtonGroup furnitureAppearanceButtonGroup = new ButtonGroup();
          furnitureAppearanceButtonGroup.add(this.catalogIconRadioButton);
          furnitureAppearanceButtonGroup.add(this.topViewRadioButton);
     
          ItemListener furnitureAppearanceChangeListener = new ItemListener() {
              public void itemStateChanged(ItemEvent ev) {
                controller.setFurnitureViewedFromTop(topViewRadioButton.isSelected());
              }
            };
          this.catalogIconRadioButton.addItemListener(furnitureAppearanceChangeListener);
          this.topViewRadioButton.addItemListener(furnitureAppearanceChangeListener);
          controller.addPropertyChangeListener(UserPreferencesController.Property.FURNITURE_VIEWED_FROM_TOP,
              new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent ev) {
                  topViewRadioButton.setSelected(controller.isFurnitureViewedFromTop());
                }
              });
        } else {
          this.catalogIconRadioButton.setEnabled(false);
          this.topViewRadioButton.setEnabled(false);
        }
      }
    }

    if (controller.isPropertyEditable(UserPreferencesController.Property.ROOM_FLOOR_COLORED_OR_TEXTURED)) {
      // Create room rendering label and radio buttons bound to controller ROOM_FLOOR_COLORED_OR_TEXTURED property
      this.roomRenderingLabel = new JLabel(preferences.getLocalizedString(
          UserPreferencesPanel.class, "roomRenderingLabel.text"));
      this.monochromeRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "monochromeRadioButton.text"),
          !controller.isRoomFloorColoredOrTextured());
      this.floorColorOrTextureRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
          UserPreferencesPanel.class, "floorColorOrTextureRadioButton.text"),
          controller.isRoomFloorColoredOrTextured());
      ButtonGroup roomRenderingButtonGroup = new ButtonGroup();
      roomRenderingButtonGroup.add(this.monochromeRadioButton);
      roomRenderingButtonGroup.add(this.floorColorOrTextureRadioButton);
View Full Code Here

          controller.addPropertyChangeListener(HomeFurnitureController.Property.MODEL_MIRRORED, mirroredModelChangeListener);
        }
      });
   
    // Create radio buttons bound to COLOR and TEXTURE controller properties
    this.defaultColorAndTextureRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        HomeFurniturePanel.class, "defaultColorAndTextureRadioButton.text"));
    this.defaultColorAndTextureRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          if (defaultColorAndTextureRadioButton.isSelected()) {
            controller.setPaint(HomeFurnitureController.FurniturePaint.DEFAULT);
          }
        }
      });
    controller.addPropertyChangeListener(HomeFurnitureController.Property.PAINT,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            updateColorAndTextureRadioButtons(controller);
          }
        });
    this.colorRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        HomeFurniturePanel.class, "colorRadioButton.text"));
    this.colorRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          if (colorRadioButton.isSelected()) {
            controller.setPaint(HomeFurnitureController.FurniturePaint.COLORED);
          }
        }
      });
   
    this.colorButton = new ColorButton();
    this.colorButton.setColorDialogTitle(preferences.getLocalizedString(
        HomeFurniturePanel.class, "colorDialog.title"));
    this.colorButton.setColor(controller.getColor());
    this.colorButton.addPropertyChangeListener(ColorButton.COLOR_PROPERTY,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            controller.setColor(colorButton.getColor());
            controller.setPaint(HomeFurnitureController.FurniturePaint.COLORED);
          }
        });
    controller.addPropertyChangeListener(HomeFurnitureController.Property.COLOR,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            colorButton.setColor(controller.getColor());
          }
        });

    this.textureRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        HomeFurniturePanel.class, "textureRadioButton.text"));
    this.textureRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          if (textureRadioButton.isSelected()) {
            controller.setPaint(HomeFurnitureController.FurniturePaint.TEXTURED);
          }
        }
      });
   
    TextureChoiceController textureController = controller.getTextureController();
    if (textureController != null) {
      this.textureComponent = (JComponent)textureController.getView();
    }

    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(this.defaultColorAndTextureRadioButton);
    buttonGroup.add(this.colorRadioButton);
    buttonGroup.add(this.textureRadioButton);
    updateColorAndTextureRadioButtons(controller);

    // Create radio buttons bound to SHININESS controller properties
    this.defaultShininessRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        HomeFurniturePanel.class, "defaultShininessRadioButton.text"));
    this.defaultShininessRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          if (defaultShininessRadioButton.isSelected()) {
            controller.setShininess(HomeFurnitureController.FurnitureShininess.DEFAULT);
          }
        }
      });
    controller.addPropertyChangeListener(HomeFurnitureController.Property.SHININESS,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            updateShininessRadioButtons(controller);
          }
        });
    this.mattRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        HomeFurniturePanel.class, "mattRadioButton.text"));
    this.mattRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          if (mattRadioButton.isSelected()) {
            controller.setShininess(HomeFurnitureController.FurnitureShininess.MATT);
          }
        }
      });
    this.shinyRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        HomeFurniturePanel.class, "shinyRadioButton.text"));
    this.shinyRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          if (shinyRadioButton.isSelected()) {
            controller.setShininess(HomeFurnitureController.FurnitureShininess.SHINY);
View Full Code Here

          controller.addPropertyChangeListener(RoomController.Property.FLOOR_VISIBLE, floorVisibleChangeListener);
        }
      });
   
    // Floor color and texture buttons bound to floor controller properties
    this.floorColorRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        RoomPanel.class, "floorColorRadioButton.text"));
    this.floorColorRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          if (floorColorRadioButton.isSelected()) {
            controller.setFloorPaint(RoomController.RoomPaint.COLORED);
          }
        }
      });
    controller.addPropertyChangeListener(RoomController.Property.FLOOR_PAINT,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            updateFloorColorRadioButtons(controller);
          }
        });
   
    this.floorColorButton = new ColorButton();
    this.floorColorButton.setColorDialogTitle(preferences.getLocalizedString(
        RoomPanel.class, "floorColorDialog.title"));
    this.floorColorButton.setColor(controller.getFloorColor());
    this.floorColorButton.addPropertyChangeListener(ColorButton.COLOR_PROPERTY,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            controller.setFloorColor(floorColorButton.getColor());
            controller.setFloorPaint(RoomController.RoomPaint.COLORED);
          }
        });
    controller.addPropertyChangeListener(RoomController.Property.FLOOR_COLOR,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            floorColorButton.setColor(controller.getFloorColor());
          }
        });

    this.floorTextureRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        RoomPanel.class, "floorTextureRadioButton.text"));
    this.floorTextureRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          if (floorTextureRadioButton.isSelected()) {
            controller.setFloorPaint(RoomController.RoomPaint.TEXTURED);
          }
        }
      });
   
    this.floorTextureComponent = (JComponent)controller.getFloorTextureController().getView();
   
    ButtonGroup floorButtonColorGroup = new ButtonGroup();
    floorButtonColorGroup.add(this.floorColorRadioButton);
    floorButtonColorGroup.add(this.floorTextureRadioButton);
    updateFloorColorRadioButtons(controller);
   
    // Floor shininess radio buttons bound to FLOOR_SHININESS controller property
    this.floorMattRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        RoomPanel.class, "floorMattRadioButton.text"));
    this.floorMattRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          if (floorMattRadioButton.isSelected()) {
            controller.setFloorShininess(0f);
          }
        }
      });
    PropertyChangeListener floorShininessListener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent ev) {
          updateFloorShininessRadioButtons(controller);
        }
      };
    controller.addPropertyChangeListener(RoomController.Property.FLOOR_SHININESS,
        floorShininessListener);

    this.floorShinyRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        RoomPanel.class, "floorShinyRadioButton.text"));
    this.floorShinyRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          if (floorShinyRadioButton.isSelected()) {
            controller.setFloorShininess(0.25f);
          }
        }
      });
    controller.addPropertyChangeListener(RoomController.Property.FLOOR_SHININESS,
        floorShininessListener);
   
    ButtonGroup floorShininessButtonGroup = new ButtonGroup();
    floorShininessButtonGroup.add(this.floorMattRadioButton);
    floorShininessButtonGroup.add(this.floorShinyRadioButton);
    updateFloorShininessRadioButtons(controller);

    // Create ceiling visible check box bound to CEILING_VISIBLE controller property
    this.ceilingVisibleCheckBox = new NullableCheckBox(SwingTools.getLocalizedLabelText(preferences,
        RoomPanel.class, "ceilingVisibleCheckBox.text"));
    this.ceilingVisibleCheckBox.setNullable(controller.getCeilingVisible() == null);
    this.ceilingVisibleCheckBox.setValue(controller.getCeilingVisible());
    final PropertyChangeListener ceilingVisibleChangeListener = new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent ev) {
        ceilingVisibleCheckBox.setNullable(ev.getNewValue() == null);
        ceilingVisibleCheckBox.setValue((Boolean)ev.getNewValue());
      }
    };
    controller.addPropertyChangeListener(RoomController.Property.CEILING_VISIBLE, ceilingVisibleChangeListener);
    this.ceilingVisibleCheckBox.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          controller.removePropertyChangeListener(RoomController.Property.CEILING_VISIBLE, ceilingVisibleChangeListener);
          controller.setCeilingVisible(ceilingVisibleCheckBox.getValue());
          controller.addPropertyChangeListener(RoomController.Property.CEILING_VISIBLE, ceilingVisibleChangeListener);
        }
      });

    // Ceiling color and texture buttons bound to ceiling controller properties
    this.ceilingColorRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        RoomPanel.class, "ceilingColorRadioButton.text"));
    this.ceilingColorRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
          if (ceilingColorRadioButton.isSelected()) {
            controller.setCeilingPaint(RoomController.RoomPaint.COLORED);
          }
        }
      });
    controller.addPropertyChangeListener(RoomController.Property.CEILING_PAINT,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            updateCeilingColorRadioButtons(controller);
          }
        });

    this.ceilingColorButton = new ColorButton();
    this.ceilingColorButton.setColor(controller.getCeilingColor());
    this.ceilingColorButton.setColorDialogTitle(preferences.getLocalizedString(
        RoomPanel.class, "ceilingColorDialog.title"));
    this.ceilingColorButton.addPropertyChangeListener(ColorButton.COLOR_PROPERTY,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            controller.setCeilingColor(ceilingColorButton.getColor());
            controller.setCeilingPaint(RoomController.RoomPaint.COLORED);
          }
        });
    controller.addPropertyChangeListener(RoomController.Property.CEILING_COLOR,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            ceilingColorButton.setColor(controller.getCeilingColor());
          }
        });
   
    this.ceilingTextureRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        RoomPanel.class, "ceilingTextureRadioButton.text"));
    this.ceilingTextureRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
          if (ceilingTextureRadioButton.isSelected()) {
            controller.setCeilingPaint(RoomController.RoomPaint.TEXTURED);
          }
        }
      });
 
    this.ceilingTextureComponent = (JComponent)controller.getCeilingTextureController().getView();

    ButtonGroup ceilingColorButtonGroup = new ButtonGroup();
    ceilingColorButtonGroup.add(this.ceilingColorRadioButton);
    ceilingColorButtonGroup.add(this.ceilingTextureRadioButton);
    updateCeilingColorRadioButtons(controller);

    // Ceiling shininess radio buttons bound to CEILING_SHININESS controller property
    this.ceilingMattRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        RoomPanel.class, "ceilingMattRadioButton.text"));
    this.ceilingMattRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          if (ceilingMattRadioButton.isSelected()) {
            controller.setCeilingShininess(0f);
          }
        }
      });
    PropertyChangeListener ceilingShininessListener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent ev) {
          updateCeilingShininessRadioButtons(controller);
        }
      };
    controller.addPropertyChangeListener(RoomController.Property.CEILING_SHININESS,
        ceilingShininessListener);

    this.ceilingShinyRadioButton = new JRadioButton(SwingTools.getLocalizedLabelText(preferences,
        RoomPanel.class, "ceilingShinyRadioButton.text"));
    this.ceilingShinyRadioButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          if (ceilingShinyRadioButton.isSelected()) {
            controller.setCeilingShininess(0.25f);
View Full Code Here

TOP

Related Classes of javax.swing.JRadioButton

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.