Example usage for javax.swing JToggleButton JToggleButton

List of usage examples for javax.swing JToggleButton JToggleButton

Introduction

In this page you can find the example usage for javax.swing JToggleButton JToggleButton.

Prototype

public JToggleButton() 

Source Link

Document

Creates an initially unselected toggle button without setting the text or image.

Usage

From source file:Main.java

public static JToggleButton createToggleButton(ImageIcon icon, int dimension, String tooltipText) {
    JToggleButton btn = new JToggleButton();
    btn.setToolTipText(tooltipText);/*from  w  w w  .j  av a 2 s .  co m*/
    btn.setIcon(icon);

    btn.setMaximumSize(new Dimension(dimension, dimension));
    btn.setMinimumSize(new Dimension(dimension, dimension));
    btn.setPreferredSize(new Dimension(dimension, dimension));
    btn.setMargin(new Insets(0, 0, 0, 0));

    return btn;
}

From source file:components.CrayonPanel.java

protected JToggleButton createCrayon(String name, Border normalBorder) {
    JToggleButton crayon = new JToggleButton();
    crayon.setActionCommand(name);//from w w w  .  java 2  s . co m
    crayon.addActionListener(this);

    //Set the image or, if that's invalid, equivalent text.
    ImageIcon icon = createImageIcon("images/" + name + ".gif");
    if (icon != null) {
        crayon.setIcon(icon);
        crayon.setToolTipText("The " + name + " crayon");
        crayon.setBorder(normalBorder);
    } else {
        crayon.setText("Image not found. This is the " + name + " button.");
        crayon.setFont(crayon.getFont().deriveFont(Font.ITALIC));
        crayon.setHorizontalAlignment(JButton.HORIZONTAL);
        crayon.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    }

    return crayon;
}

From source file:gtu.jpa.hibernate.Rcdf002eDBUI.java

private void initGUI() {
    try {/*  w ww.j  a va 2 s  .co m*/
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                jTabbedPane1.addTab("?", null, jPanel1, null);
                {
                    executeBtn = new JButton();
                    jPanel1.add(executeBtn);
                    executeBtn.setText("\u5f9e2e\u7522\u751fxml\u6a94");
                    executeBtn.setPreferredSize(new java.awt.Dimension(115, 36));
                    executeBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            executeBtnActionPerformed(evt);
                        }
                    });
                }
                {
                    isDebug = new JToggleButton();
                    jPanel1.add(isDebug);
                    isDebug.setPreferredSize(new java.awt.Dimension(232, 38));
                    JCommonUtil.setJToggleButtonText(isDebug, new String[] { "SIT", "?" });
                }
                {
                    jLabel1 = new JLabel();
                    jPanel1.add(jLabel1);
                    jLabel1.setText("\u8a2d\u5b9axml\u8def\u5f91");
                }
                {
                    xmlFileText = new JTextField();
                    jPanel1.add(xmlFileText);
                    xmlFileText.setPreferredSize(new java.awt.Dimension(250, 24));
                }
                {
                    executeReportBtn = new JButton();
                    jPanel1.add(executeReportBtn);
                    executeReportBtn.setText("\u81eaxml\u6a94\u7522\u751f\u7d71\u8a08\u6a94");
                    executeReportBtn.setPreferredSize(new java.awt.Dimension(227, 64));
                    executeReportBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            executeReportBtnActionPerformed(evt);
                        }
                    });
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("log", null, jPanel2, null);
                jTabbedPane1.addTab("excel", null, getJPanel3(), null);
                jTabbedPane1.addTab("??", null, getJPanel4(), null);
                jTabbedPane1.addTab("", null, getJPanel5(), null);
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel2.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(407, 228));
                    {
                        logArea = new JTextArea();
                        jScrollPane1.setViewportView(logArea);
                    }
                }
            }
        }
        pack();
        this.setSize(420, 282);
        initLog();
    } catch (Exception e) {
        //add your error handling code here
        e.printStackTrace();
    }
}

From source file:com.hp.alm.ali.idea.ui.MultipleItemsDialog.java

public MultipleItemsDialog(Project project, String title, final MultipleItemsDialogModel<K, E> model) {
    super(project, title, true);

    this.model = model;

    mySelectionModel = new MySelectionModel();
    myListSelectionListener = new MyListSelectionListener();

    tooMany = new JLabel("Too many results, narrow your search");
    tooMany.setBorder(BorderFactory.createEtchedBorder());
    tooMany.setVisible(false);/* w  ww .  j a v a 2  s .  c  o  m*/
    selected = new JLabel("Showing currently selected items");
    selected.setVisible(false);
    toggleSelected = new JToggleButton();
    toggleSelected.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            model.setShowingSelected(toggleSelected.isSelected());
            if (!model.isShowingSelected() && !model.getSelectedFields().isEmpty()) {
                updateSelectionFromModel();
            } else if (model.isShowingSelected()) {
                header.getFilterEditor(1).setContent("");
            }
        }
    });
    updateSelected();

    table = new JBTable() {
        @Override
        public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) {
            int column = convertColumnIndexToModel(columnIndex);
            mySelectionModel.setFirstColumnEvent(column == 0);
            super.changeSelection(rowIndex, columnIndex, toggle, extend);
        }
    };
    table.setRowSelectionAllowed(true);
    table.setColumnSelectionAllowed(false);
    table.setAutoCreateColumnsFromModel(false);
    table.setModel(model);
    final MyTableRowSorter sorter = new MyTableRowSorter(model);
    table.setRowSorter(sorter);
    table.setDefaultRenderer(Boolean.class, new MyRenderer());
    table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
    table.setSelectionModel(mySelectionModel);

    sorter.setIgnoreAddRowSorterListener(true); // prevent auto-selection (functionality not accessible via proper API)
    header = new TableFilterHeader(table);
    sorter.setIgnoreAddRowSorterListener(false);

    sorter.setSortKeys(Arrays.asList(new RowSorter.SortKey(1, SortOrder.ASCENDING)));
    JPanel panel = new JPanel(new BorderLayout());
    JPanel toolbar = new JPanel(new BorderLayout());
    toolbar.setBorder(BorderFactory.createEtchedBorder());
    panel.add(toolbar, BorderLayout.NORTH);
    toolbar.add(toggleSelected, BorderLayout.EAST);

    if (model.isMultiple()) {
        table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

        table.getColumnModel().addColumn(createColumn(0, model, 45, 45));
        header.getFilterEditor(0).setEditable(false);
        header.getFilterEditor(0).setUserInteractionEnabled(false);

        final LinkListener selectUnselect = new LinkListener() {
            public void linkSelected(LinkLabel aSource, Object aLinkData) {
                if (model.isShowingSelected()) {
                    if (!Boolean.TRUE.equals(aLinkData)) {
                        List<Integer> ixs = new ArrayList<Integer>();
                        for (int i = 0; i < sorter.getViewRowCount(); i++) {
                            ixs.add(sorter.convertRowIndexToModel(i));
                        }
                        // make sure indexes are not affected by removal by starting from the last
                        Collections.sort(ixs);
                        Collections.reverse(ixs);
                        for (int ix : ixs) {
                            model.setValueAt(aLinkData, ix, 0);
                        }
                    }
                } else {
                    if (Boolean.TRUE.equals(aLinkData)) {
                        mySelectionModel.doAddSelectionInterval(0, table.getRowCount() - 1);
                    } else {
                        mySelectionModel.removeSelectionInterval(0, table.getRowCount() - 1);
                    }
                }
            }
        };

        JPanel left = new JPanel(new FlowLayout(FlowLayout.LEFT));
        left.add(new LinkLabel("Select All", IconLoader.getIcon("/actions/selectall.png"), selectUnselect,
                true));
        left.add(new LinkLabel("Unselect All", IconLoader.getIcon("/actions/unselectall.png"), selectUnselect,
                false));
        toolbar.add(left, BorderLayout.WEST);
    } else {
        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    }
    table.getColumnModel().addColumn(createColumn(1, model, 450, null));
    table.getSelectionModel().addListSelectionListener(myListSelectionListener);

    model.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            selected.setVisible(model.isShowingSelected());
            tooMany.setVisible(model.hasMore() && !model.isShowingSelected());
            updateSelected();
        }
    });

    JPanel contentPanel = new JPanel(new BorderLayout());
    contentPanel.add(selected, BorderLayout.NORTH);
    contentPanel.add(new JBScrollPane(table), BorderLayout.CENTER);
    contentPanel.add(tooMany, BorderLayout.SOUTH);
    panel.add(contentPanel, BorderLayout.CENTER);
    JPanel buttons = new JPanel();
    okButton = new JButton("OK");
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            ok = true;
            close(true);
        }
    });
    buttons.add(okButton);
    JButton cancel = new JButton("Cancel");
    cancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            close(false);
        }
    });
    buttons.add(cancel);
    panel.add(buttons, BorderLayout.SOUTH);
    getContentPane().add(panel, BorderLayout.CENTER);

    pack();
    setResizable(false);
    centerOnOwner();

    requestPropertyFilterFocus(header);

    load(true, null);
}

From source file:com.petersoft.advancedswing.enhancedtextarea.EnhancedTextArea.java

private void initGUI() {
    try {// www .  ja  v a  2  s . c  om
        BorderLayout thisLayout = new BorderLayout();
        this.setLayout(thisLayout);
        this.setPreferredSize(new java.awt.Dimension(725, 290));
        {
            jToolBar = new JToolBar();
            this.add(jToolBar, BorderLayout.NORTH);
            {
                jSaveButton = new JButton();
                jToolBar.add(jSaveButton);
                jSaveButton.setText("Save");
                jSaveButton.setIcon(new ImageIcon(getClass().getClassLoader()
                        .getResource("com/petersoft/advancedswing/enhancedtextarea/disk.png")));
                jSaveButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        jSaveButtonActionPerformed(evt);
                    }
                });
            }
            {
                jLineWrapButton = new JToggleButton();
                jToolBar.add(jLineWrapButton);
                jLineWrapButton.setText("Wrap");
                jLineWrapButton.setIcon(new ImageIcon(getClass().getClassLoader()
                        .getResource("com/petersoft/advancedswing/enhancedtextarea/linewrap.png")));
                jLineWrapButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        jLineWrapButtonActionPerformed(evt);
                    }
                });
            }
            {
                jFontBiggerButton = new JButton();
                jToolBar.add(jFontBiggerButton);
                jFontBiggerButton.setIcon(new ImageIcon(getClass().getClassLoader()
                        .getResource("com/petersoft/advancedswing/enhancedtextarea/font_add.png")));
                jFontBiggerButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        jFontBiggerButtonActionPerformed(evt);
                    }
                });
            }
            {
                jFontSmallerButton = new JButton();
                jToolBar.add(jFontSmallerButton);
                jFontSmallerButton.setIcon(new ImageIcon(getClass().getClassLoader()
                        .getResource("com/petersoft/advancedswing/enhancedtextarea/font_delete.png")));
                jFontSmallerButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        jFontSmallerButtonActionPerformed(evt);
                    }
                });
            }
            {
                jLabel1 = new JLabel();
                jToolBar.add(jLabel1);
                jLabel1.setText(" ");
            }
            {
                jSearchTextField = new JSearchTextField();
                jToolBar.add(jSearchTextField);
                jSearchTextField.setMaximumSize(new java.awt.Dimension(100, 22));
                jSearchTextField.setPreferredSize(new java.awt.Dimension(100, 22));
                jSearchTextField.setSize(new java.awt.Dimension(100, 22));
                jSearchTextField.addKeyListener(new KeyAdapter() {
                    public void keyReleased(KeyEvent evt) {
                        jSearchTextFieldKeyReleased(evt);
                    }
                });

            }
            {
                jSeparatorLabel = new JLabel();
                jToolBar.add(jSeparatorLabel);
                jSeparatorLabel.setText(" ");
            }
            {
                GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
                Font[] fonts = e.getAllFonts();
                String fontNames[] = new String[fonts.length];
                int x = 0;
                for (Font f : fonts) {
                    fontNames[x++] = f.getFontName();
                }
                ComboBoxModel jFontComboBoxModel = new DefaultComboBoxModel(fontNames);
                jFontComboBox = new JComboBox();
                jToolBar.add(jFontComboBox);
                jFontComboBox.setModel(jFontComboBoxModel);
                jFontComboBox.setMaximumSize(new java.awt.Dimension(180, 22));
                jFontComboBox.setPreferredSize(new java.awt.Dimension(180, 22));
                jFontComboBox.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        jFontComboBoxActionPerformed(evt);
                    }
                });
            }
            {
                pager = new Pager();
                jToolBar.add(pager);
                pager.setVisible(false);
            }
        }
        {
            jScrollPane1 = new JScrollPane();
            this.add(jScrollPane1, BorderLayout.CENTER);
            {
                jTextArea = new JTextArea();
                jTextArea.getDocument().addDocumentListener(this);
                lines = new JTextArea(" 1 ");
                lines.setBackground(new Color(200, 230, 245));
                lines.setEditable(false);
                jScrollPane1.setRowHeaderView(lines);

                jTextArea.getDocument().addDocumentListener(new DocumentListener() {
                    public String getText() {
                        int caretPosition = jTextArea.getDocument().getLength();
                        Element root = jTextArea.getDocument().getDefaultRootElement();

                        int base = 0;
                        if (separateByLine == false) {
                            if (str != null) {
                                base = StringUtils.countMatches(
                                        str.substring(0, (pager.getPage() - 1) * pageSize),
                                        System.getProperty("line.separator"));
                                if (base == 1) {
                                    base = 0;
                                }
                            }
                        } else {
                            base = (pager.getPage() - 1) * pageSize;
                        }
                        base += lineNoBase;
                        String text = " " + (base + 1) + " " + System.getProperty("line.separator");
                        for (int i = 2; i < root.getElementIndex(caretPosition) + 2; i++) {
                            text += " " + (base + i) + " " + System.getProperty("line.separator");
                        }
                        return text;
                    }

                    @Override
                    public void changedUpdate(DocumentEvent de) {
                        lines.setText(getText());
                    }

                    @Override
                    public void insertUpdate(DocumentEvent de) {
                        lines.setText(getText());
                    }

                    @Override
                    public void removeUpdate(DocumentEvent de) {
                        lines.setText(getText());
                    }

                });
                jScrollPane1.setViewportView(jTextArea);
            }
        }
        {
            jStatusPanel = new JPanel();
            FlowLayout jStatusPanelLayout = new FlowLayout();
            jStatusPanelLayout.setAlignment(FlowLayout.LEFT);
            jStatusPanel.setLayout(jStatusPanelLayout);
            this.add(jStatusPanel, BorderLayout.SOUTH);
            {
                jStatusLabel = new JLabel();
                jStatusPanel.add(jStatusLabel);
            }
            {
                jSearchLabel = new JLabel();
                jStatusPanel.add(jSearchLabel);
            }
        }
        this.jFontComboBox.setSelectedItem(jTextArea.getFont().getFamily() + ".plain");
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:de.wusel.partyplayer.gui.LockingStatusbar.java

public LockingStatusbar(Application application, final JFrame mainFrame, final Settings settings) {
    this.application = application;
    this.settings = settings;
    this.application.getContext().getTaskMonitor().addPropertyChangeListener(listener);
    statusLabel = new JLabel("Ready");
    fileReaderProgressBar = new JProgressBar(0, 100);

    pinCodeInputField = new JPasswordField();
    PromptSupport.setPrompt("pin-code", pinCodeInputField);
    PromptSupport.setForeground(Color.GRAY, pinCodeInputField);

    pinCodeInputField.addMouseListener(new MouseAdapter() {

        @Override// ww w .  ja v  a2  s  . com
        public void mouseClicked(MouseEvent e) {
            if (!pinCodeInputField.isEnabled()) {
                ChangePasswordDialog dialog = new ChangePasswordDialog(mainFrame, settings);
                dialog.setVisible(true);
                if (dialog.getStatus() == DialogStatus.CONFIRMED) {
                    settings.setNewPassword(dialog.getPassDigest());
                    settings.backup(PathUtil.getSettingsFile());
                }
            }
        }
    });
    pinCodeInputField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            boolean unlocked = settings
                    .isPasswordValid(DigestUtils.md5Hex(new String(pinCodeInputField.getPassword())));
            if (unlocked) {
                pinCodeInputField.transferFocus();
                unlock();
            }
            pinCodeInputField.setText(null);
        }
    });

    lockButton = new JToggleButton();
    lockButton.setIcon(getIcon("lock"));
    lockButton.setSelectedIcon(getIcon("lock_open"));
    lockButton.setEnabled(false);
    lockButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            lock();
        }
    });

    this.settingsButton = new JButton(getIcon("cog_edit"));
    this.settingsButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            showSettings();
        }
    });
    add(statusLabel, new JXStatusBar.Constraint(JXStatusBar.Constraint.ResizeBehavior.FILL));
    add(fileReaderProgressBar, new JXStatusBar.Constraint(200));
    add(pinCodeInputField, new JXStatusBar.Constraint(100));
    add(lockButton, new JXStatusBar.Constraint());
    add(settingsButton, new JXStatusBar.Constraint());
    this.mainFrame = mainFrame;
}

From source file:de.unibayreuth.bayeos.goat.panels.timeseries.JPanelChart.java

private JToolBar createChartToolbar() {
    JToolBar toolbar = new JToolBar();

    ButtonGroup groupedButtons = new ButtonGroup();

    // ACTION_CMD_PAN
    chartPanButton = new JToggleButton();
    prepareButton(chartPanButton, ACTION_CHART_PAN, "de/unibayreuth/bayeos/goat/panels/Pan16.gif", "Pan mode");
    groupedButtons.add(chartPanButton);//from   w  w w . ja va  2s . c  o  m
    toolbar.add(chartPanButton);

    // ACTION_CMD_ZOOM_BOX
    chartZoomButton = new JToggleButton();
    prepareButton(chartZoomButton, ACTION_CHART_ZOOM_BOX, "de/unibayreuth/bayeos/goat/panels/Zoom16.gif",
            "Zoom mode");
    groupedButtons.add(chartZoomButton);
    chartZoomButton.setSelected(true); // no other makes sense after startup
    toolbar.add(chartZoomButton);

    // end of toggle-button group for select/pan/zoom-box
    toolbar.addSeparator();

    // ACTION_CMD_ZOOM_IN
    chartZoomInButton = new JButton();
    prepareButton(chartZoomInButton, ACTION_CHART_ZOOM_IN, "de/unibayreuth/bayeos/goat/panels/ZoomIn16.gif",
            "Zoom in");
    toolbar.add(chartZoomInButton);

    // ACTION_CMD_ZOOM_OUT
    chartZoomOutButton = new JButton();
    prepareButton(chartZoomOutButton, ACTION_CHART_ZOOM_OUT, "de/unibayreuth/bayeos/goat/panels/ZoomOut16.gif",
            "Zoom out");
    toolbar.add(chartZoomOutButton);

    // ACTION_CMD_ZOOM_TO_FIT
    chartFitButton = new JButton();
    prepareButton(chartFitButton, ACTION_CHART_ZOOM_TO_FIT,
            "de/unibayreuth/bayeos/goat/panels/ZoomExtent16.gif", "Zoom to extent");
    toolbar.add(chartFitButton);

    toolbar.addSeparator();

    chartExportButton = new JButton();
    prepareButton(chartExportButton, ACTION_CHART_EXPORT, "de/unibayreuth/bayeos/goat/panels/Export16.gif",
            "Export chart image ...");
    toolbar.add(chartExportButton);

    // ACTION_CMD_PRINT
    chartPrintButton = new JButton();
    prepareButton(chartPrintButton, ACTION_CHART_PRINT, "de/unibayreuth/bayeos/goat/panels/Print16.gif",
            "Print chart ...");
    toolbar.add(chartPrintButton);

    toolbar.addSeparator();
    // ACTION_CMD_PROPERTIES
    chartPropertiesButton = new JButton();
    prepareButton(chartPropertiesButton, ACTION_CHART_PROPERTIES,
            "de/unibayreuth/bayeos/goat/panels/Properties16.gif", "Chart properties ...");
    toolbar.add(chartPropertiesButton);

    chartZoomOutButton.setEnabled(false);
    chartFitButton.setEnabled(false);

    return toolbar;
}

From source file:gtu._work.ui.LoadJspCheckTagUI.java

private void initGUI() {
    try {//from   w  ww .j  a v a  2s .c  om
        BorderLayout thisLayout = new BorderLayout();
        getContentPane().setLayout(thisLayout);
        this.setTitle("\u8b80\u53d6Jsp\u8cc7\u8a0a");
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("jPanel1", null, jPanel1, null);
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel1.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(475, 328));
                    {
                        jTree1 = new JTree();
                        jScrollPane1.setViewportView(jTree1);
                        jTree1.setModel(null);
                        jTree1.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                jTree1MouseClicked(evt);
                            }
                        });
                        jTree1.addTreeSelectionListener(new TreeSelectionListener() {
                            public void valueChanged(TreeSelectionEvent evt) {
                                jTree1ValueChanged(evt);
                            }
                        });
                    }
                }
            }
            {
                jPanel2 = new JPanel();
                jTabbedPane1.addTab("jPanel2", null, jPanel2, null);
                {
                    subFileNameText = new JTextField();
                    jPanel2.add(subFileNameText);
                    subFileNameText.setPreferredSize(new java.awt.Dimension(95, 24));
                    subFileNameText.setText("xhtml");
                }
                {
                    ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(
                            new String[] { "??", "?" });
                    modifyFileBox = new JComboBox();
                    jPanel2.add(modifyFileBox);
                    modifyFileBox.setModel(jComboBox1Model);
                }
                {
                    exportReportToogleBtn = new JToggleButton();
                    jPanel2.add(exportReportToogleBtn);
                    exportReportToogleBtn.setText("\u662f\u5426\u532f\u51fa\u5831\u8868");
                    exportReportToogleBtn.setPreferredSize(new java.awt.Dimension(120, 24));
                    exportReportToogleBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            JCommonUtil.setJToggleButtonText(exportReportToogleBtn,
                                    new String[] { "", "?" });
                        }
                    });
                }
                {
                    projectSrcPathBtn = new JButton();
                    jPanel2.add(projectSrcPathBtn);
                    projectSrcPathBtn.setText("\u8a2d\u5b9a\u5c08\u6848\u76ee\u8def\u4e26\u6383\u63cf");
                    projectSrcPathBtn.setPreferredSize(new java.awt.Dimension(233, 95));
                    projectSrcPathBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            jButton1ActionPerformed(evt);
                        }
                    });
                }
            }
        }
        this.setSize(496, 395);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.nbheaven.sqe.codedefects.history.controlcenter.panels.SQEHistoryPanel.java

/** Creates new form SQEHistoryPanel */
public SQEHistoryPanel() {
    historyChart = org.jfree.chart.ChartFactory.createStackedXYAreaChart(null, "Snapshot", "CodeDefects",
            perProjectDataSet, PlotOrientation.VERTICAL, false, true, false);
    historyChart.setBackgroundPaint(Color.WHITE);
    historyChart.getXYPlot().setRangeGridlinePaint(Color.BLACK);
    historyChart.getXYPlot().setDomainGridlinePaint(Color.BLACK);
    historyChart.getXYPlot().setBackgroundPaint(Color.WHITE);

    XYPlot plot = historyChart.getXYPlot();
    plot.setForegroundAlpha(0.7f);//w  w  w.  j a  va2s  .com
    //        plot.getRenderer();

    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    LogarithmicAxis rangeAxis = new LogarithmicAxis("CodeDefects");
    rangeAxis.setStrictValuesFlag(false);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.setRangeAxis(rangeAxis);

    StackedXYAreaRenderer2 categoryItemRenderer = new StackedXYAreaRenderer2(); //3D();
    categoryItemRenderer.setSeriesPaint(0, Color.RED);
    categoryItemRenderer.setSeriesPaint(1, Color.ORANGE);
    categoryItemRenderer.setSeriesPaint(2, Color.YELLOW);

    plot.setRenderer(categoryItemRenderer);

    ChartPanel historyChartPanel = new ChartPanel(historyChart);
    historyChartPanel.setBorder(null);
    historyChartPanel.setPreferredSize(new Dimension(150, 200));
    historyChartPanel.setBackground(Color.WHITE);
    initComponents();

    historyView.setLayout(new BorderLayout());
    historyView.add(historyChartPanel, BorderLayout.CENTER);

    JPanel selectorPanel = new JPanel();
    selectorPanel.setOpaque(false);

    GroupLayout layout = new GroupLayout(selectorPanel);
    selectorPanel.setLayout(layout);

    // Turn on automatically adding gaps between components
    layout.setAutocreateGaps(true);

    // Turn on automatically creating gaps between components that touch
    // the edge of the container and the container.
    layout.setAutocreateContainerGaps(true);

    ParallelGroup horizontalParallelGroup = layout.createParallelGroup(GroupLayout.LEADING);
    SequentialGroup verticalSequentialGroup = layout.createSequentialGroup();

    layout.setHorizontalGroup(layout.createSequentialGroup().add(horizontalParallelGroup));

    layout.setVerticalGroup(verticalSequentialGroup);

    clearHistoryButton = new JButton();
    clearHistoryButton.setEnabled(false);
    clearHistoryButton.setIcon(ImageUtilities
            .image2Icon(ImageUtilities.loadImage("org/nbheaven/sqe/codedefects/history/resources/trash.png")));
    clearHistoryButton.setOpaque(false);
    clearHistoryButton.setFocusPainted(false);
    clearHistoryButton.setToolTipText(
            NbBundle.getBundle("org/nbheaven/sqe/codedefects/history/controlcenter/panels/Bundle")
                    .getString("HINT_clear_button"));
    horizontalParallelGroup.add(clearHistoryButton);
    verticalSequentialGroup.add(clearHistoryButton);
    clearHistoryButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (null != activeHistory) {
                activeHistory.clear();
            }
        }

    });

    Component createVerticalStrut = Box.createVerticalStrut(10);

    horizontalParallelGroup.add(createVerticalStrut);
    verticalSequentialGroup.add(createVerticalStrut);

    for (final QualityProvider provider : SQEUtilities.getProviders()) {
        final JToggleButton providerButton = new JToggleButton();
        providerButton.setIcon(provider.getIcon());
        providerButton.setOpaque(false);
        providerButton.setFocusPainted(false);
        horizontalParallelGroup.add(providerButton);
        verticalSequentialGroup.add(providerButton);
        ActionListener listener = new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (providerButton.isSelected()) {
                    addSelectedProvider(provider);
                } else {
                    removeSelectedProvider(provider);
                }
                updateView();
            }
        };
        providerButton.addActionListener(listener);
        addSelectedProvider(provider);
        providerButton.setSelected(true);
    }

    historyView.add(selectorPanel, BorderLayout.EAST);
}

From source file:org.gvsig.remotesensing.profiles.gui.ZProfileOptionsPanel.java

public JToggleButton getDeleteButton() {
    if (deleteButton == null) {
        deleteButton = new JToggleButton();
        ImageIcon icono = new ImageIcon(
                ZProfileOptionsPanel.class.getClassLoader().getResource("images/delete.png"));
        deleteButton.setSize(30, 30);/*from  w  ww.  j av a 2  s .c o m*/
        deleteButton.setIcon(icono);
    }
    return deleteButton;
}