Package javax.swing

Examples of javax.swing.JToggleButton$AccessibleJToggleButton


{
  public void test(TestHarness harness)
  {
   
    ButtonGroup g1 = new ButtonGroup();
    JToggleButton b1 = new JToggleButton("B1");
    ButtonModel m1 = b1.getModel();
    g1.add(b1);
    harness.check(m1.isSelected(), false);
    g1.setSelected(m1, false);
    harness.check(b1.isSelected(), false);
    harness.check(g1.isSelected(m1), false);
    harness.check(g1.getSelection(), null);
   
    ButtonGroup g2 = new ButtonGroup();
    JToggleButton b2 = new JToggleButton("B2");
    ButtonModel m2 = b2.getModel();
    g2.add(b2);
    harness.check(m2.isSelected(), false);
    g2.setSelected(m2, true);
    harness.check(b2.isSelected(), true);
    harness.check(g2.isSelected(m2), true);
    harness.check(g2.getSelection(), m2);

    ButtonGroup g3 = new ButtonGroup();
    JToggleButton b3 = new JToggleButton("B3");
    b3.setSelected(true);
    ButtonModel m3 = b3.getModel();
    g3.add(b3);
    harness.check(m3.isSelected(), true);
    g3.setSelected(m3, false);
    harness.check(b3.isSelected(), true);
    harness.check(g3.isSelected(m3), true);
    harness.check(g3.getSelection(), m3);

    ButtonGroup g4 = new ButtonGroup();
    JToggleButton b4 = new JToggleButton("B4");
    b4.setSelected(true);
    ButtonModel m4 = b4.getModel();
    g4.add(b4);
    harness.check(m4.isSelected(), true);
    g4.setSelected(m4, false);
    harness.check(b4.isSelected(), true);
    harness.check(g4.isSelected(m4), true);
    harness.check(g4.getSelection(), m4);

    // now work with a second button...
    JToggleButton b5 = new JToggleButton("B5");
    ButtonModel m5 = b5.getModel();
    g4.add(b5);
    harness.check(g4.isSelected(m5), false);
    // the following does nothing, because 'false' says we don't change the
    // state of the incoming model...
    g4.setSelected(m5, false);
    harness.check(b4.isSelected(), true);
    harness.check(g4.isSelected(m4), true);
    harness.check(g4.getSelection(), m4);
   
    // whereas this changes the selection...
    g4.setSelected(m5, true);
    harness.check(b4.isSelected(), false);
    harness.check(b5.isSelected(), true);
    harness.check(g4.isSelected(m4), false);
    harness.check(g4.isSelected(m5), true);
    harness.check(g4.getSelection(), m5);
   
  }
View Full Code Here


  public void test(TestHarness harness)
  {
    MyMetalToggleButtonUI ui = new MyMetalToggleButtonUI();
    harness.check(ui.getFocusColor(), null);
   
    ui.installDefaults(new JToggleButton("Test"));
    harness.check(ui.getFocusColor(), MetalLookAndFeel.getFocusColor());   
  }
View Full Code Here

  public void test(TestHarness harness)
  {
    MyMetalToggleButtonUI ui = new MyMetalToggleButtonUI();
    harness.check(ui.getDisabledTextColor(), null);
   
    ui.installDefaults(new JToggleButton("Test"));
    harness.check(ui.getDisabledTextColor(), MetalLookAndFeel.getInactiveControlTextColor());   
  }
View Full Code Here

        // toolbar buttons
        toolbar.add(new JLabel("Zoom:"));
        toolbar.addSeparator();

        JToggleButton tbutton = new JToggleButton("h", hZoom);
        tbutton.setActionCommand(ZOOM_H);
        tbutton.addActionListener(this);
        toolbar.add(tbutton);

        tbutton = new JToggleButton("v", vZoom);
        tbutton.setActionCommand(ZOOM_V);
        tbutton.addActionListener(this);
        toolbar.add(tbutton);
        toolbar.addSeparator();

        tbutton = new JToggleButton("in", zoomIn);
        tbutton.setActionCommand(ZOOM_IN);
        tbutton.addActionListener(this);
        toolbar.add(tbutton);
        button_zoom_in = tbutton;

        tbutton = new JToggleButton("out", !zoomIn);
        tbutton.setActionCommand(ZOOM_OUT);
        tbutton.addActionListener(this);
        toolbar.add(tbutton);
        button_zoom_out = tbutton;
        toolbar.addSeparator();

        JButton button = new JButton("reset");
View Full Code Here

    protected TriStateAction( int iconID, int normalID, int thirdID )
    {
      super();
     
      icns  = GraphicsUtil.createToolIcons( iconID );
      ab    = new JToggleButton( this );
      ab.setBorderPainted( false );
      ab.setContentAreaFilled( false );
      ab.setMargin( new Insets( 0, 0, 0, 0 ));
      ab.setOpaque( false );
      ab.setFocusable( false );
View Full Code Here

    final CatchAction    actionCatch;
    final EditModeAction  actionEditMode;
    final AbstractButton  button;
    final BlendingAction  actionBlending;
    ToolAction        toolAction;
    JToggleButton      toggle;
    ButtonGroup        bg;
    Enumeration        en;

    actionCatch    = new CatchAction( prefs ); // .node( PrefsUtil.NODE_SHARED ));
    toggle      = actionCatch.getButton();
//    root.menuFactory.addGlobalKeyCommand( new DoClickAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_V, 0 )));
GUIUtil.createKeyAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_V, 0 ));
//        HelpGlassPane.setHelp( toggle, "ToolCatch" );
        addToggleButton( toggle, 2 );
    addSeparator();

    actionEditMode  = new EditModeAction( doc );
    bg        = actionEditMode.getButtons();
    en        = bg.getElements();
    for( int i = 0; en.hasMoreElements(); i++ ) {
      toggle    = (JToggleButton) en.nextElement();
GUIUtil.createKeyAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_F1 + i, 0 ));
      addToggleButton( toggle, 3 );
    }
    addSeparator();

    toolAction    = new ToolAction( ToolAction.POINTER );
        toggle      = new JToggleButton( toolAction );
    toolAction.setIcons( toggle );
    GUIUtil.createKeyAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_F5, 0 ));
//        HelpGlassPane.setHelp( toggle, "TimelineToolPointer" );
      addToggleButton( toggle, 0 );
    mapToolButtons.put( new Integer( toolAction.getID() ), toggle );
       
//    toolAction    = new ToolAction( ToolAction.LINE );
//        toggle      = new JToggleButton( toolAction );
//    toolAction.setIcons( toggle );
//    GUIUtil.createKeyAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_F6, 0 ));
////        HelpGlassPane.setHelp( toggle, "TimelineToolLine" );
//toolAction.setEnabled( false );  // XXX not yet implemented
//      addToggleButton( toggle, 0 );
//    mapToolButtons.put( new Integer( toolAction.getID() ), toggle );
//
//    toolAction    = new ToolAction( ToolAction.PENCIL );
//        toggle      = new JToggleButton( toolAction );
//    toolAction.setIcons( toggle );
//    GUIUtil.createKeyAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_F7, 0 ));
////        HelpGlassPane.setHelp( toggle, "TimelineToolPencil" );
//toolAction.setEnabled( false );  // XXX not yet implemented
//      addToggleButton( toggle, 0 );
//    mapToolButtons.put( new Integer( toolAction.getID() ), toggle );
     
    toolAction    = new ToolAction( ToolAction.ZOOM );
        toggle      = new JToggleButton( toolAction );
    toolAction.setIcons( toggle );
    GUIUtil.createKeyAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_F6, 0 ));
//        HelpGlassPane.setHelp( toggle, "TimelineToolZoom" );
      addToggleButton( toggle, 0 );
    mapToolButtons.put( new Integer( toolAction.getID() ), toggle );
View Full Code Here

        fixUnifiedToolBarOnMacIfNeccessary(fPreferencesTabBar);
    }

    public void addTab(String title, Icon icon, ActionListener listener) {
        AbstractButton button = MacButtonFactory.makePreferencesTabBarButton(
                new JToggleButton(title, icon));
        fButtonGroup.add(button);
        button.addActionListener(listener);

        fPreferencesTabBar.addComponentToLeft(button);
    }
View Full Code Here

//        macWidgetsButton.setEnabled(false);
        unifiedToolBar.addComponentToLeft(MacWidgetFactory.createSpacer(0, 0));
        unifiedToolBar.addComponentToLeft(macWidgetsButton);

        JToolBar regularToolBar = new JToolBar();
        JToggleButton javaPreferencesButton = new JToggleButton("Preferences", preferences);
//        javaPreferencesButton.setEnabled(false);
        javaPreferencesButton.setHorizontalTextPosition(AbstractButton.CENTER);
        javaPreferencesButton.setVerticalTextPosition(AbstractButton.BOTTOM);
        javaPreferencesButton.setIconTextGap(0);
        javaPreferencesButton.setMargin(new Insets(0, 0, 0, 0));
        regularToolBar.add(javaPreferencesButton);

        JFrame frame = new JFrame();
        unifiedToolBar.installWindowDraggerOnWindow(frame);
        MacUtils.makeWindowLeopardStyle(frame.getRootPane());
View Full Code Here

        return new LabeledComponentGroup("Group Label", itemA, itemB, itemC);
    }

    public static LabeledComponentGroup createViewExample() {
        JToggleButton leftButton = new JToggleButton(new ImageIcon(
                DLabeledComponentGroup.class.getResource("/com/explodingpixels/macwidgets/icons/sourceViewNormal.png")));
        leftButton.setSelectedIcon(new ImageIcon(
                DLabeledComponentGroup.class.getResource("/com/explodingpixels/macwidgets/icons/sourceViewNormalSelected.png")));
        leftButton.putClientProperty("JButton.buttonType", "segmentedTextured");
        leftButton.putClientProperty("JButton.segmentPosition", "first");
        leftButton.setFocusable(false);

        JToggleButton rightButton = new JToggleButton(new ImageIcon(
                DLabeledComponentGroup.class.getResource("/com/explodingpixels/macwidgets/icons/ColumnViewTemplate.png")));
        rightButton.putClientProperty("JButton.buttonType", "segmentedTextured");
        rightButton.putClientProperty("JButton.segmentPosition", "last");
        rightButton.setFocusable(false);

        return new LabeledComponentGroup("View", leftButton, rightButton);
    }
View Full Code Here

public class DUnifiedToolbar {

    public static void main(String[] args) {

        JToggleButton leftButton = new JToggleButton(new ImageIcon(
                DUnifiedToolbar.class.getResource("/com/explodingpixels/macwidgets/icons/sourceViewNormal.png")));
        leftButton.setSelectedIcon(new ImageIcon(
                DUnifiedToolbar.class.getResource("/com/explodingpixels/macwidgets/icons/sourceViewNormalSelected.png")));
        leftButton.putClientProperty("JButton.buttonType", "segmentedTextured");
        leftButton.putClientProperty("JButton.segmentPosition", "first");
        leftButton.setFocusable(false);

        JToggleButton rightButton = new JToggleButton(new ImageIcon(
                DUnifiedToolbar.class.getResource("/com/explodingpixels/macwidgets/icons/ColumnViewTemplate.png")));
        rightButton.putClientProperty("JButton.buttonType", "segmentedTextured");
        rightButton.putClientProperty("JButton.segmentPosition", "last");
        rightButton.setFocusable(false);

        ButtonGroup group = new ButtonGroup();
        group.add(leftButton);
        group.add(rightButton);
View Full Code Here

TOP

Related Classes of javax.swing.JToggleButton$AccessibleJToggleButton

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.