Package javax.swing

Examples of javax.swing.JToggleButton$ToggleButtonModel


    protected JComponent getToolWidgets() {
        JPanel iconBar = new JPanel();
        // this parameters should be read from properties!
        iconBar.setLayout(new GridLayout(2, 4));
        ButtonGroup bg = new ButtonGroup();
        JToggleButton btn = null;
        boolean setFirstButtonSelected = true;

        for (Iterator it = getLoaders(); it.hasNext();) {
            LoaderHolder lh = (LoaderHolder) it.next();
            String pName = lh.prettyName;
            EditToolLoader etl = lh.loader;
            ImageIcon icon = etl.getIcon(getEditableClassName(pName));
            btn = new JToggleButton(icon);
            btn.setMargin(new Insets(0, 0, 0, 0));
            btn.setToolTipText(pName);
            btn.setActionCommand(pName);
            btn.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    setCurrentCreation(ae.getActionCommand());
                }
            });
            if (setFirstButtonSelected) {
                btn.setSelected(true);
                setCurrentCreation(pName);
                setFirstButtonSelected = false;
            }
            bg.add(btn);
            iconBar.add(btn);
View Full Code Here


        boolean limitWidth = false;
        if (maxHorNumLoaderButtons >= 0) {
            limitWidth = true;
        }

        JToggleButton btn;
        JToolBar iconBar = null;
        boolean activeSet = false;
        for (Iterator it = getLoaders(); it.hasNext();) {

            if (toolbarCount == 0) {
                iconBar = new JToolBar();
                iconBar.setFloatable(false);
                gridbag.setConstraints(iconBar, c);
                panel.add(iconBar);
            }

            LoaderHolder lh = (LoaderHolder) it.next();
            String pName = lh.prettyName;
            EditToolLoader etl = lh.loader;
            ImageIcon icon = etl.getIcon(getEditableClassName(pName));

            btn = new JToggleButton(icon, !activeSet);
            btn.setToolTipText(pName);
            btn.setActionCommand(pName);
            btn.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    setCurrentCreation(ae.getActionCommand());
                }
            });
            bg.add(btn);
View Full Code Here

                }
            });
            bGridbag.setConstraints(gotoButton, bc);
            buttonPanel.add(gotoButton);

            locateButton = new JToggleButton(i18n.get(ImageTileLayer.class,
                    "locateButton",
                    "Highlight"));
            locateButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    JToggleButton jtb = (JToggleButton) ae.getSource();
                    setSelection(getSelectedTiles(), jtb.isSelected());
                }
            });
            bGridbag.setConstraints(locateButton, bc);
            buttonPanel.add(locateButton);
View Full Code Here

            toolbar.addSeparator();
        }
        toolbar.add(bAdjust = resources.getBox("adjust", this));
        toolbar.add(bAlign = resources.getBox("align", this));
        toolbar.addSeparator();
        tbGridDisplay = new JToggleButton(resources.getIcon("gridImage"));
        tbGridDisplay.setPreferredSize(new Dimension(22, 22));
        tbGridDisplay.addActionListener(this);
        tbGridDisplay.setToolTipText(resources.getStringValue("gridButtonTip"));
        toolbar.add(tbGridDisplay);
        cbxGrid = new JComboBox();
View Full Code Here

    // insert messageTreePanel into current panel
    this.add(messageTreePanel, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0,
        GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
            0, 0, 0, 0), 0, 0));
    // Create linkbutton
    this.linkButton = new JToggleButton(ResourcesRepository
        .getImageIcon("link.png"));
    this.linkButton.setSelected(true);
    this.add(linkButton, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
        GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(
            5, 5, 5, 5), 0, 0));
View Full Code Here

    if ((flags & USE_MUTE_CONTROL) == 0)
      return null;

    if (muteButton == null) {
      muteButton = new JToggleButton();
      muteButton.setIcon(skin.getMuteOffIcon());
      muteButton.setOpaque(false);
      muteButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e)
View Full Code Here

                                        JToggleButton.ToggleButtonModel toggleButtonModel,
                                        JToolBar toolBar) {
    Action action = getActionMap().get(actionType);
    if (action!= null && action.getValue(Action.NAME) != null) {
      Action toolBarAction = new ResourceAction.ToolBarAction(action);   
      JToggleButton toggleButton = new JToggleButton(toolBarAction);
      toggleButton.setModel(toggleButtonModel);
      toolBar.add(toggleButton);
    }
  }
View Full Code Here

      undoSupport.addUndoableEditListener(undoManager);
      this.planController = new PlanController(this.home, this.preferences, viewFactory, null, undoSupport);
      // Add plan component to frame at its preferred size
      add(new JScrollPane((JComponent)this.planController.getView()));
      // Create a toggle button for plan component mode
      this.modeButton = new JToggleButton(new ImageIcon(
          getClass().getResource("resources/Add16.gif")));
      // Add listeners to modeButton that manages plan planController mode
      this.modeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
          if (modeButton.isSelected()) {
View Full Code Here

    if (addHomeFurnitureAction != null) {
      toolBar.add(addHomeFurnitureAction);
      toolBar.addSeparator();
    }
   
    final JToggleButton selectToggleButton =
        new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.SELECT));
    selectToggleButton.setSelected(true);
    toolBar.add(selectToggleButton);
    final JToggleButton panToggleButton =
        new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.PAN));
    toolBar.add(panToggleButton);
    final JToggleButton createWallsToggleButton =
        new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.CREATE_WALLS));
    toolBar.add(createWallsToggleButton);
    final JToggleButton createRoomsToggleButton =
        new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.CREATE_ROOMS));
    toolBar.add(createRoomsToggleButton);
    final JToggleButton createDimensionLinesToggleButton =
        new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.CREATE_DIMENSION_LINES));
    toolBar.add(createDimensionLinesToggleButton);
    final JToggleButton createLabelsToggleButton =
        new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.CREATE_LABELS));
    toolBar.add(createLabelsToggleButton);
    // Add Select, Create Walls and Create dimensions buttons to radio group
    ButtonGroup group = new ButtonGroup();
    group.add(selectToggleButton);
    group.add(panToggleButton);
    group.add(createWallsToggleButton);
    group.add(createRoomsToggleButton);
    group.add(createDimensionLinesToggleButton);
    group.add(createLabelsToggleButton);
    controller.getPlanController().addPropertyChangeListener(PlanController.Property.MODE,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            PlanController.Mode mode = controller.getPlanController().getMode();
            selectToggleButton.setSelected(mode == PlanController.Mode.SELECTION);
            panToggleButton.setSelected(mode == PlanController.Mode.PANNING);
            createWallsToggleButton.setSelected(mode == PlanController.Mode.WALL_CREATION);
            createRoomsToggleButton.setSelected(mode == PlanController.Mode.ROOM_CREATION);
            createDimensionLinesToggleButton.setSelected(mode == PlanController.Mode.DIMENSION_LINE_CREATION);
            createLabelsToggleButton.setSelected(mode == PlanController.Mode.LABEL_CREATION);
          }
        });
    toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
   
    addToolBarAction(homeView, HomeView.ActionType.ZOOM_OUT, toolBar);
View Full Code Here

      ViewFactory viewFactory = new SwingViewFactory();
      this.homeController = new HomeController(home, preferences, viewFactory);
      JComponent homeView = (JComponent)this.homeController.getView();
      ActionMap actions = homeView.getActionMap();
      // Create buttons from HomePane actions map
      this.selectButton = new JToggleButton(actions.get(HomePane.ActionType.SELECT));
      this.createWallsButton = new JToggleButton(actions.get(HomePane.ActionType.CREATE_WALLS));
      this.createDimensionsButton = new JToggleButton(actions.get(HomePane.ActionType.CREATE_DIMENSION_LINES));
      ButtonGroup group = new ButtonGroup();
      group.add(this.selectButton);
      group.add(this.createWallsButton);
      group.add(this.createDimensionsButton);
      this.addButton = new JButton(actions.get(HomePane.ActionType.ADD_HOME_FURNITURE));
View Full Code Here

TOP

Related Classes of javax.swing.JToggleButton$ToggleButtonModel

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.