當前位置: 首頁>>代碼示例>>Java>>正文


Java JToggleButton.setActionCommand方法代碼示例

本文整理匯總了Java中javax.swing.JToggleButton.setActionCommand方法的典型用法代碼示例。如果您正苦於以下問題:Java JToggleButton.setActionCommand方法的具體用法?Java JToggleButton.setActionCommand怎麽用?Java JToggleButton.setActionCommand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JToggleButton的用法示例。


在下文中一共展示了JToggleButton.setActionCommand方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import javax.swing.JToggleButton; //導入方法依賴的package包/類
private void init() {
    setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.X_AXIS));
    setFloatable(false);

    add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0),
            new java.awt.Dimension(10, 0),
            new java.awt.Dimension(10, 32767)));
    JLabel label = new JLabel("Properties");
    label.setFont(new Font("Default", Font.BOLD, 12));
    add(label);

    add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767)));

    add(Utils.createButton("Add Row", "add", "Ctrl+Plus", WebORTable.this));
    add(Utils.createButton("Delete Rows", "remove", "Ctrl+Minus", WebORTable.this));
    addSeparator();
    add(Utils.createButton("Move Rows Up", "up", "Ctrl+Up", WebORTable.this));
    add(Utils.createButton("Move Rows Down", "down", "Ctrl+Down", WebORTable.this));
    addSeparator();
    frameToggle = new JToggleButton(Utils.getIconByResourceName("/ui/resources/or/web/propViewer"));
    frameToggle.addItemListener(WebORTable.this);
    frameToggle.setToolTipText("Show/Hide Frame Property");
    frameToggle.setActionCommand("Toggle Frame");
    add(frameToggle);
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:26,代碼來源:WebORTable.java

示例2: create

import javax.swing.JToggleButton; //導入方法依賴的package包/類
private JToggleButton create(String text) {
    JToggleButton togg = new JToggleButton();
    togg.setIcon(Utils.getIconByResourceName("/ui/resources/or/" + text.toLowerCase()));
    togg.setToolTipText(text);
    togg.setActionCommand(text);
    togg.addItemListener(ObjectRepo.this);
    bgroup.add(togg);
    return togg;
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:10,代碼來源:ObjectRepo.java

示例3: init

import javax.swing.JToggleButton; //導入方法依賴的package包/類
private void init() {

            add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0),
                    new java.awt.Dimension(10, 0),
                    new java.awt.Dimension(10, 32767)));
            JLabel label = new JLabel("Properties");
            label.setFont(new Font("Default", Font.BOLD, 12));
            add(label);

            add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767)));
            toggleImage = new JToggleButton(Utils.getIconByResourceName("/ui/resources/or/image/image"));
            toggleImage.addItemListener(ImageORTable.this);
            toggleImage.setActionCommand("ToggleImage");
            toggleImage.setToolTipText("Show/Hide Image");
            add(toggleImage);

            JButton offset = new JButton(Utils.getIconByResourceName("/ui/resources/or/image/findOffset"));
            offset.addActionListener(ImageORTable.this);
            offset.setToolTipText("Show Offset");
            offset.setActionCommand("Show Offset");
            add(offset);

            JButton findOn = new JButton(Utils.getIconByResourceName("/ui/resources/or/image/findOnScreen"));
            findOn.addActionListener(ImageORTable.this);
            findOn.setToolTipText("Find on Screen");
            findOn.setActionCommand("Find on Screen");
            add(findOn);

            JButton editor = new JButton(Utils.getIconByResourceName("/ui/resources/or/image/propViewer"));
            editor.addActionListener(ImageORTable.this);
            editor.setToolTipText("Show Property Editor");
            editor.setActionCommand("Show Property Editor");
            add(editor);
        }
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:35,代碼來源:ImageORTable.java

示例4: createToggleButton

import javax.swing.JToggleButton; //導入方法依賴的package包/類
private JToggleButton createToggleButton() {
    JToggleButton console = new JToggleButton(Utils.getIconByResourceName("/ui/resources/toolbar/console"));
    console.setActionCommand("Console");
    console.setToolTipText("Show/Hide Console Box");
    console.addActionListener(actionListener);
    return console;
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:8,代碼來源:TestSetToolBar.java

示例5: updateToolbar

import javax.swing.JToggleButton; //導入方法依賴的package包/類
private void updateToolbar(FileObject file, Collection<CssStylesPanelProvider> activeProviders) {

        toolBar.removeAll();
        if (activeProviders.size() <= 1) {
            //remove the whole toolbar, if there's one or zero providers
            removeToolbar();
        } else {
            addToolbar();
        }

        // Button group for document and source buttons
        ButtonGroup buttonGroup = new ButtonGroup();

        boolean first = true;

        CssStylesPanelProvider selected = (file == null) ? null : selectedTabs.get(file.getMIMEType());

        //do the active providers contain the pre-selected provider for this mimetype?
        boolean containsPreselected = selected == null ? false : activeProviders.contains(selected);

        for (CssStylesPanelProvider provider : activeProviders) {
            JToggleButton button = new JToggleButton();
            button.setText(provider.getPanelDisplayName());
            button.setActionCommand(provider.getPanelID());
            button.addActionListener(toolbarListener);

            button.setFocusable(true);
            button.setFocusPainted(false);
            button.setRolloverEnabled(true);

            //copied from org.netbeans.core.multiview.TabsComponent.createButton to make the look 
            //similar to the editor tabs
            Border b = (getButtonBorder());
            if (b != null) {
                button.setBorder(b);
            }
            if (AQUA) {
                button.putClientProperty("JButton.buttonType", "square"); //NOI18N
                button.putClientProperty("JComponent.sizeVariant", "small"); //NOI18N
            }

            buttonGroup.add(button);
            toolBar.add(button);

            if (containsPreselected) {
                //one of the active providers is already pre-selected by user
                if (provider == selected) {
                    //the selected one - activate it
                    button.setSelected(true);
                    setActiveProvider(provider);
                } else {
                    button.setSelected(false);
                }
            } else {
                //no provider has been explicitly selected by the user yet
                button.setSelected(first);
                if (first) {
                    setActiveProvider(provider);
                    first = false;
                }
            }
        }

        revalidate();
        repaint();
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:67,代碼來源:CssStylesPanel.java


注:本文中的javax.swing.JToggleButton.setActionCommand方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。