Package javax.swing

Examples of javax.swing.JToolBar$DefaultLayout


//                .getTaskSelectionManager().getSelectedTasks().isEmpty());
//        myExportSettings.setStartDate(myStartDate);
//        myExportSettings.setEndDate(myEndDate);
        myPrintable = new GanttPrintable(myChart.getChart(myExportSettings),
                GanttPrintable.REDUCE_FACTOR_DEFAULT);
        JToolBar tb = new JToolBar();
        JToolBar tb2 = new JToolBar();

        JButton bPrint = new TestGanttRolloverButton(new ImageIcon(getClass()
                .getResource("/icons/print_16.gif")));
        bPrint.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                print();
            }
        });

        JButton bClose = bClose = new TestGanttRolloverButton(new ImageIcon(
                getClass().getResource("/icons/exit_16.gif")));
        bClose.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
                dispose();
            }
        });

        final JButton bPortrait = new TestGanttRolloverButton(new ImageIcon(
                getClass().getResource("/icons/portrait_16.gif")));
        final JButton bLandscape = new TestGanttRolloverButton(new ImageIcon(
                getClass().getResource("/icons/landscape_16.gif")));

        bPortrait.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                run(new Runnable() {
                    public void run() {
                        changePageOrientation(PageFormat.PORTRAIT);
                        bLandscape.setEnabled(true);
                        bPortrait.setEnabled(false);
                    }
                });
            }
        });

        bLandscape.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                run(new Runnable() {
                    public void run() {
                        changePageOrientation(PageFormat.LANDSCAPE);
                        bLandscape.setEnabled(false);
                        bPortrait.setEnabled(true);
                    }
                });
            }
        });
        bLandscape.setEnabled(false);
        String[] scales = { "10 %", "25 %", "50 %", "100 %" };
        myComboScale = new JComboBox(scales);
        myComboScale.setSelectedIndex(2);
        myComboScale.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                run(new Runnable() {
                    public void run() {
                        changeScale();
                    }
                });
            }
        });

        myComboScale.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent arg0) {
                run(new Runnable() {
                    public void run() {
                        changeScale();
                    }
                });
            }
        });

        Dimension dim = myComboScale.getPreferredSize();
        dim.setSize(dim.getWidth() + 20, dim.getHeight());
        myComboScale.setMaximumSize(dim);
        myComboScale.setPreferredSize(dim);
        myComboScale.setEditable(true);

        boolean isDate = start != null && end != null;
        ImageIcon icon = new ImageIcon(getClass().getResource(
                "/icons/calendar_16.gif"));

        myStart.lock();
        myFinish.lock();
        if (isDate) {
            /*
            myStartDateButton = new JButton(new GanttCalendar(myStartDate)
                    .toString(), icon);
            myStartDateButton.setHorizontalTextPosition(SwingConstants.RIGHT);
            myStartDateButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    myStartDialogDate = new GanttDialogDate(new JDialog(),
                            new GanttCalendar(myStartDate), false);
                    myStartDialogDate.setVisible(true);
                    if (myStartDialogDate.getValue() == GanttDialogDate.OK) {
                        myStartDate = myStartDialogDate.getDate().getTime();
                        myStartDateButton
                                .setText(new GanttCalendar(myStartDate)
                                        .toString());
                        myExportSettings.setStartDate(myStartDate);
                        updateSourceImage(myChart.getChart(myExportSettings));
                    }
                }
            });

            myEndDateButton = new JButton(new GanttCalendar(myEndDate)
                    .toString(), icon);
            myEndDateButton.setHorizontalTextPosition(SwingConstants.RIGHT);
            myEndDateButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    myEndDialogDate = new GanttDialogDate(new JDialog(),
                            new GanttCalendar(myEndDate), false);
                    myEndDialogDate.setVisible(true);
                    if (myEndDialogDate.getValue() == GanttDialogDate.OK) {
                        myEndDate = myEndDialogDate.getDate().getTime();
                        myEndDateButton.setText(new GanttCalendar(myEndDate)
                                .toString());
                        myExportSettings.setEndDate(myEndDate);
                        updateSourceImage(myChart.getChart(myExportSettings));
                    }
                }
            });
            */
            myWholeProjectButton = new JButton(language.getText("wholeProject"));
            myWholeProjectButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    myStart.setValue(myChart.getStartDate());
                    myFinish.setValue(myChart.getEndDate());
                    /*
                    myStartDate = myChart.getStartDate();
                    myEndDate = myChart.getEndDate();
                    myExportSettings.setStartDate(myStartDate);
                    myExportSettings.setEndDate(myEndDate);

                    myEndDateButton.setText(new GanttCalendar(myExportSettings
                            .getEndDate()).toString());
                    myStartDateButton.setText(new GanttCalendar(
                            myExportSettings.getStartDate()).toString());
                    myEndDialogDate = new GanttDialogDate(new JDialog(),
                            new GanttCalendar(myEndDate), false);
                    myStartDialogDate = new GanttDialogDate(new JDialog(),
                            new GanttCalendar(myStartDate), false);
                    updateSourceImage(myChart.getChart(myExportSettings));
                    */
                }
            });
        }
        Vector vMedia = new Vector();
        ;
        // try {
        // vMedia = getAllMediaSizeNameAvailable();
        vMedia.add(MediaSizeName.ISO_A0);
        vMedia.add(MediaSizeName.ISO_A1);
        vMedia.add(MediaSizeName.ISO_A2);
        vMedia.add(MediaSizeName.ISO_A3);
        vMedia.add(MediaSizeName.ISO_A4);
        vMedia.add(MediaSizeName.ISO_A5);
        vMedia.add(MediaSizeName.ISO_A6);
        // } catch (ClassNotFoundException e1) {
        // // TODO Auto-generated catch block
        // e1.printStackTrace();
        // }

        if (vMedia != null) {
            myComboMediaSize = new JComboBox(vMedia);
            dim = myComboMediaSize.getPreferredSize();
            dim.setSize(dim.getWidth() + 20, dim.getHeight());
            myComboMediaSize.setMaximumSize(dim);
            myComboMediaSize.setPreferredSize(dim);
            myComboMediaSize.addItemListener(new ItemListener() {
                public void itemStateChanged(ItemEvent arg0) {
                    run(new Runnable() {
                        public void run() {
                            Object selectedItem = myComboMediaSize
                                    .getSelectedItem();
                            if (selectedItem != null) {
                                myMediaSizeName = (MediaSizeName) selectedItem;
                                MediaSize ms = MediaSize
                                        .getMediaSizeForName(myMediaSizeName);
                                Paper p = new Paper();
                                float[] size = ms.getSize(MediaSize.INCH);
                                p.setSize(size[0] * 72, size[1] * 72);
                                p.setImageableArea(72, 72,
                                        p.getWidth() - 72 * 2,
                                        p.getHeight() - 72 * 2);
                                myPageFormat.setPaper(p);
                                changePageOrientation(myOrientation);
                                statusBar.setText1(ms.getX(MediaSize.MM)
                                        + " x " + ms.getY(MediaSize.MM));
                                myPreviewContainer.repaint();
                            }
                        }
                    });
                }
            });
        }

        bPrint.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("printProject"))));
        bPortrait.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("portrait"))));
        bLandscape.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("landscape"))));
        bClose.setToolTipText(GanttProject.getToolTip(GanttProject
                .correctLabel(language.getText("close"))));
        final JButton bZoomOut;
        final JButton bZoomIn;
        if (isDate) {
            myWholeProjectButton.setToolTipText(GanttProject
                    .getToolTip(GanttProject.correctLabel(language
                            .getText("displayWholeProject"))));
            /*
            myStartDateButton.setToolTipText(GanttProject
                    .getToolTip(GanttProject.correctLabel(language
                            .getText("setStartDate"))));
            myEndDateButton.setToolTipText(GanttProject.getToolTip(GanttProject
                    .correctLabel(language.getText("setEndDate"))));
                    */
            //GanttProject gp = Mediator.getGanttProjectSingleton();
            final ZoomManager zoomManager = myUIfacade.getZoomManager();
            final Action zoomOut = new ZoomOutAction(zoomManager, "16");
            final Action zoomIn = new ZoomInAction(zoomManager, "16");
            bZoomOut = new JButton((Icon) zoomOut.getValue(Action.SMALL_ICON));
            bZoomIn = new JButton((Icon) zoomIn.getValue(Action.SMALL_ICON));

            bZoomOut.setHorizontalTextPosition(SwingConstants.RIGHT);
            bZoomOut.setText(language.getText("narrowChart"));
            bZoomOut.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg0) {
                    run(new Runnable() {
                        public void run() {
                            zoomOut.actionPerformed(null);
                            updateSourceImage();
                            bZoomOut.setEnabled(zoomManager.canZoomOut());
                            bZoomIn.setEnabled(zoomManager.canZoomIn());
                        }
                    });
                }
            });

            bZoomIn.setHorizontalTextPosition(SwingConstants.RIGHT);
            bZoomIn.setText(language.getText("widenChart"));
            bZoomIn.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg0) {
                    run(new Runnable() {
                        public void run() {
                            zoomIn.actionPerformed(null);
                            updateSourceImage();
                            bZoomOut.setEnabled(zoomManager.canZoomOut());
                            bZoomIn.setEnabled(zoomManager.canZoomIn());
                        }
                    });
                }
            });

        } else {
            bZoomOut = null;
            bZoomIn = null;
        }

        tb2.setFloatable(false);
        tb.setFloatable(false);
        tb.add(bClose);
        tb.addSeparator(new Dimension(16, 16));
        tb.add(bPrint);
        tb.addSeparator(new Dimension(16, 16));
        tb.add(bPortrait);
        tb.add(bLandscape);
        tb.addSeparator(new Dimension(16, 16));
        tb.add(new JLabel(language.getText("zoom") + " "));
        tb.add(myComboScale);
        if (vMedia != null && !vMedia.isEmpty()) {
            tb.addSeparator(new Dimension(16, 16));
            tb.add(new JLabel(language.getText("choosePaperFormat") + " "));
            tb.addSeparator(new Dimension(0, 10));
            tb.add(myComboMediaSize);
        }

        if (isDate) {
            tb2.add(bZoomOut);
            tb2.addSeparator(new Dimension(5, 0));
            tb2.add(bZoomIn);
            tb2.addSeparator(new Dimension(20, 0));
            tb2.add(myWholeProjectButton);
            tb2.addSeparator(new Dimension(16, 16));
            OptionsPageBuilder builder = new OptionsPageBuilder();
            builder.setOptionKeyPrefix("");
            tb2.add(builder.createStandaloneOptionPanel(myStart));
            URL iconArrow = this.getClass().getClassLoader().getResource(
                    "icons/fromto.gif");
            tb2.add(new JLabel(new ImageIcon(iconArrow)));
            tb2.add(builder.createStandaloneOptionPanel(myFinish));
        }

        JPanel topPanel = new JPanel(new BorderLayout());
        tb.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
        tb2.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
        topPanel.add(tb, BorderLayout.NORTH);
        topPanel.add(tb2, BorderLayout.SOUTH);

        getContentPane().add(topPanel, BorderLayout.NORTH);

View Full Code Here


    return panel;
  }

  private JPanel createRegexDetailsPanel() {
    final JToolBar toolBar = WidgetFactory.createToolBar();
    toolBar.add(Box.createHorizontalGlue());
    toolBar.add(_importRegexButton);
    toolBar.add(_viewOnlineButton);

    final DCPanel toolBarPanel = new DCPanel(WidgetUtils.BG_COLOR_DARK, WidgetUtils.BG_COLOR_LESS_DARK);
    toolBarPanel.setLayout(new BorderLayout());
    toolBarPanel.add(toolBar, BorderLayout.CENTER);
View Full Code Here

  /**
   * Returns the tool bar displayed in this pane.
   */
  private JToolBar createToolBar(Home home) {
    final JToolBar toolBar = new UnfocusableToolBar();
    addActionToToolBar(ActionType.NEW_HOME, toolBar);
    addActionToToolBar(ActionType.OPEN, toolBar);
    addActionToToolBar(ActionType.SAVE, toolBar);
    toolBar.addSeparator();

    addActionToToolBar(ActionType.UNDO, toolBar);
    addActionToToolBar(ActionType.REDO, toolBar);
    toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
    addActionToToolBar(ActionType.CUT, toolBar);
    addActionToToolBar(ActionType.COPY, toolBar);
    addActionToToolBar(ActionType.PASTE, toolBar);
    toolBar.addSeparator();

    addActionToToolBar(ActionType.ADD_HOME_FURNITURE, toolBar);
    toolBar.addSeparator();
  
    addToggleActionToToolBar(ActionType.SELECT, this.selectToggleModel, toolBar);
    addToggleActionToToolBar(ActionType.PAN, this.panToggleModel, toolBar);
    addToggleActionToToolBar(ActionType.CREATE_WALLS, this.createWallsToggleModel, toolBar);
    addToggleActionToToolBar(ActionType.CREATE_ROOMS, this.createRoomsToggleModel, toolBar);
    addToggleActionToToolBar(ActionType.CREATE_DIMENSION_LINES, this.createDimensionLinesToggleModel, toolBar);
    addToggleActionToToolBar(ActionType.CREATE_LABELS, this.createLabelsToggleModel, toolBar);
    toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
   
    addActionToToolBar(ActionType.INCREASE_TEXT_SIZE, toolBar);
    addActionToToolBar(ActionType.DECREASE_TEXT_SIZE, toolBar);
    addToggleActionToToolBar(ActionType.TOGGLE_BOLD_STYLE, this.boldStyleToggleModel, toolBar);
    addToggleActionToToolBar(ActionType.TOGGLE_ITALIC_STYLE, this.italicStyleToggleModel, toolBar);
    toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
   
    addActionToToolBar(ActionType.ZOOM_IN, toolBar);
    addActionToToolBar(ActionType.ZOOM_OUT, toolBar);
    toolBar.addSeparator();
    addActionToToolBar(ActionType.CREATE_PHOTO, toolBar);
    addActionToToolBar(ActionType.CREATE_VIDEO, toolBar);
    toolBar.addSeparator();
   
    // Add plugin actions buttons
    boolean pluginActionsAdded = false;
    for (Action pluginAction : this.pluginActions) {
      if (Boolean.TRUE.equals(pluginAction.getValue(PluginAction.Property.TOOL_BAR.name()))) {
        toolBar.add(new ResourceAction.ToolBarAction(pluginAction));
        pluginActionsAdded = true;
      }
    }
    if (pluginActionsAdded) {
      toolBar.addSeparator();
    }
   
    addActionToToolBar(ActionType.HELP, toolBar);

    // Remove useless separators
    for (int i = toolBar.getComponentCount() - 1; i > 0; i--) {
      Component child = toolBar.getComponent(i);
      if (child instanceof JSeparator
          && (i == toolBar.getComponentCount() - 1
              || toolBar.getComponent(i - 1) instanceof JSeparator)) {
        toolBar.remove(i);
      }
    }

    return toolBar;
  }
View Full Code Here

            planController.splitSelectedWall();
          }
        });
      // Add a tool bar to the frame with mode toggle button,
      // undo and redo buttons
      JToolBar toolBar = new JToolBar();
      toolBar.add(this.modeButton);
      toolBar.add(this.undoButton);
      toolBar.add(this.redoButton);
      toolBar.add(this.reverseDirectionButton);
      toolBar.add(this.splitButton);
      // Add the tool bar at top of the window
      add(toolBar, BorderLayout.NORTH);
      // Pack frame to ensure home plan component is at its preferred size
      pack();
    }
View Full Code Here

    }

    protected JToolBar createToolBar() {

        // Build jtoolbar and jtoolbar Buttons
        JToolBar jtoolbar = new JToolBar();

        jtoolbar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);

        // I'm dropping "Statement" from  "Execute SQL Statement", etc.,
        // because it may or may not be "one statement", but it is SQL.
        // Build jbuttonClear Buttons - blaine
        jbuttonClear =
            new JButton("Clear SQL",
                        new ImageIcon(CommonSwing.getIcon("Clear")));

        jbuttonClear.putClientProperty("is3DEnabled", Boolean.TRUE);
        tipMap.put(jbuttonClear, "Clear SQL");
        jbuttonClear.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent actionevent) {

                if (sqlScriptBuffer == null
                        && txtCommand.getText().length() < 1) {
                    CommonSwing.errorMessage("No SQL to clear");

                    return;
                }

                clear();
            }
        });

        jbuttonExecute =
            new JButton("Execute SQL",
                        new ImageIcon(CommonSwing.getIcon("Execute")));

        tipMap.put(jbuttonExecute, "Execute SQL");
        jbuttonExecute.putClientProperty("is3DEnabled", Boolean.TRUE);
        jbuttonExecute.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent actionevent) {
                executeCurrentSQL();
            }
        });
        jtoolbar.addSeparator();
        jtoolbar.add(jbuttonClear);
        jtoolbar.addSeparator();
        jtoolbar.add(jbuttonExecute);
        jtoolbar.addSeparator();
        jbuttonClear.setAlignmentY(0.5F);
        jbuttonClear.setAlignmentX(0.5F);
        jbuttonExecute.setAlignmentY(0.5F);
        jbuttonExecute.setAlignmentX(0.5F);
View Full Code Here

            updatePlaybackTimer();
          }
        });

    // Create tool bar to play recorded animation in 3D view
    this.videoToolBar = new JToolBar();
    this.videoToolBar.setFloatable(false);
    final ActionMap actionMap = getActionMap();
    this.videoToolBar.add(actionMap.get(ActionType.DELETE_CAMERA_PATH));
    this.videoToolBar.addSeparator();
    this.videoToolBar.add(actionMap.get(ActionType.SKIP_BACKWARD));
View Full Code Here

 
  /**
   * Layouts the components displayed by this view.
   */
  private void layoutComponents() {
    final JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    // Change layout because BoxLayout glue doesn't work well under Linux
    toolBar.setLayout(new GridBagLayout());
    ActionMap actions = getActionMap();   
    final JButton previousButton = new JButton(actions.get(ActionType.SHOW_PREVIOUS));
    final JButton nextButton = new JButton(actions.get(ActionType.SHOW_NEXT));
    toolBar.add(previousButton);
    toolBar.add(nextButton);
    layoutToolBarButtons(toolBar, previousButton, nextButton);
    toolBar.addPropertyChangeListener("componentOrientation",
        new PropertyChangeListener () {
          public void propertyChange(PropertyChangeEvent evt) {
            layoutToolBarButtons(toolBar, previousButton, nextButton);
          }
        });
    toolBar.add(new JLabel(),
        new GridBagConstraints(2, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
   
    if (!OperatingSystem.isMacOSXLeopardOrSuperior()) {
      toolBar.add(this.searchLabel,
          new GridBagConstraints(3, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
              GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
    }
    toolBar.add(this.searchTextField,
        new GridBagConstraints(4, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    this.searchTextField.setMaximumSize(this.searchTextField.getPreferredSize());
    // Ignore search button under Mac OS X 10.5 (it's included in the search field)
    if (!OperatingSystem.isMacOSXLeopardOrSuperior()) {
      toolBar.add(new JButton(actions.get(ActionType.SEARCH)),
          new GridBagConstraints(5, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
              GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0));         
    }
    // Remove focusable property on buttons
    for (int i = 0, n = toolBar.getComponentCount(); i < n; i++) {     
      Component component = toolBar.getComponent(i);
      if (component instanceof JButton) {
        component.setFocusable(false);
      }
    }
   
View Full Code Here

    info = new JDetail(entry);

    scrollPane = new JScrollPane(info);
    //    contentPane.setPreferredSize(new Dimension(400, 200));

    cmdPanel = new JToolBar(JToolBar.VERTICAL);
    cmdPanel.setFloatable(false);

    nextButton = new JButton(arrowDownIcon) {   {
      setToolTipText("Next log entry");
      addActionListener(new ActionListener() {
View Full Code Here

    statusBar.add(comp, c1);
    return statusBar;
  }

  public static JToolBar createToolBar() {
    JToolBar toolBar = new JToolBar(JToolBar.HORIZONTAL);
    toolBar.setOpaque(false);
    toolBar.setBorder(null);
    toolBar.setRollover(true);
    toolBar.setFloatable(false);
    toolBar.setAlignmentY(JToolBar.LEFT_ALIGNMENT);
    return toolBar;
  }
View Full Code Here

    final List<LicensedProject> licensedProjects = getLicensedProjects();
    for (LicensedProject licensedProject : licensedProjects) {
      librariesComboBox.addItem(licensedProject);
    }

    final JToolBar toolBar = WidgetFactory.createToolBar();
    toolBar.add(DCLabel.dark("DataCleaners license: "));
    toolBar.add(dcLicenseButton);
    toolBar.add(WidgetFactory.createToolBarSeparator());
    toolBar.add(DCLabel.dark("Included libraries: "));
    toolBar.add(librariesComboBox);
    toolBar.add(visitProjectButton);

    final JScrollPane licenseLabelScroll = WidgetUtils.scrolleable(licenseLabel);
    licenseLabelScroll.setBorder(new CompoundBorder(new EmptyBorder(10, 0, 10, 0), WidgetUtils.BORDER_THIN));

    final DCPanel headerPanel = new DCPanel();
View Full Code Here

TOP

Related Classes of javax.swing.JToolBar$DefaultLayout

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.