Java Code Examples for javax.swing.JButton.getRolloverIcon()

The following are Jave code examples for showing how to use getRolloverIcon() of the javax.swing.JButton class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: incubator-netbeans   File: ActionsTest.java   Source Code and License Vote up 6 votes
/**
 * Test whether pressed, rollover and disabled icons
 * work for SystemAction.
 */
public void testIconsSystemAction() throws Exception {
    Action saInstance = SystemAction.get(TestSystemAction.class);
    
    JButton jb = new JButton();
    Actions.connect(jb, saInstance);
    
    Icon icon = jb.getIcon();
    assertNotNull(icon);
    checkIfLoadedCorrectIcon(icon, jb, 0, "Enabled icon");
    
    Icon rolloverIcon = jb.getRolloverIcon();
    assertNotNull(rolloverIcon);
    checkIfLoadedCorrectIcon(rolloverIcon, jb, 1, "Rollover icon");
    
    Icon pressedIcon = jb.getPressedIcon();
    assertNotNull(pressedIcon);
    checkIfLoadedCorrectIcon(pressedIcon, jb, 2, "Pressed icon");
    
    Icon disabledIcon = jb.getDisabledIcon();
    assertNotNull(disabledIcon);
    checkIfLoadedCorrectIcon(disabledIcon, jb, 3, "Disabled icon");
}
 
Example 2
Project: incubator-netbeans   File: ActionsTest.java   Source Code and License Vote up 6 votes
/**
 * Test whether pressed, rollover and disabled 24x24 icons
 * work for SystemAction.
 */
public void testIconsSystemAction24() throws Exception {
    Action saInstance = SystemAction.get(TestSystemAction.class);
    
    JButton jb = new JButton();
    jb.putClientProperty("PreferredIconSize",new Integer(24));
    Actions.connect(jb, saInstance);
    
    Icon icon = jb.getIcon();
    assertNotNull(icon);
    checkIfLoadedCorrectIcon(icon, jb, 4, "Enabled icon");
    
    Icon rolloverIcon = jb.getRolloverIcon();
    assertNotNull(rolloverIcon);
    checkIfLoadedCorrectIcon(rolloverIcon, jb, 5, "Rollover icon");
    
    Icon pressedIcon = jb.getPressedIcon();
    assertNotNull(pressedIcon);
    checkIfLoadedCorrectIcon(pressedIcon, jb, 6, "Pressed icon");
    
    Icon disabledIcon = jb.getDisabledIcon();
    assertNotNull(disabledIcon);
    checkIfLoadedCorrectIcon(disabledIcon, jb, 7, "Disabled icon");
}
 
Example 3
Project: incubator-netbeans   File: ActionsTest.java   Source Code and License Vote up 5 votes
/**
 * Test whether pressed, rollover and disabled icons
 * work for javax.swing.Action.
 */
public void testIconsAction() throws Exception {
    JButton jb = new JButton();
    Actions.connect(jb, new TestAction());

    Icon icon = jb.getIcon();
    assertNotNull(icon);
    checkIfLoadedCorrectIcon(icon, jb, 0, "Enabled icon");

    Icon rolloverIcon = jb.getRolloverIcon();
    assertNotNull(rolloverIcon);
    checkIfLoadedCorrectIcon(rolloverIcon, jb, 1, "Rollover icon");

    Icon pressedIcon = jb.getPressedIcon();
    assertNotNull(pressedIcon);
    checkIfLoadedCorrectIcon(pressedIcon, jb, 2, "Pressed icon");

    Icon disabledIcon = jb.getDisabledIcon();
    assertNotNull(disabledIcon);
    checkIfLoadedCorrectIcon(disabledIcon, jb, 3, "Disabled icon");
    
    Icon selectedIcon = jb.getSelectedIcon();
    assertNotNull(selectedIcon);
    checkIfLoadedCorrectIcon(selectedIcon, jb, 8, "Selected icon");
    
    Icon rolloverSelectedIcon = jb.getRolloverSelectedIcon();
    assertNotNull(rolloverSelectedIcon);
    checkIfLoadedCorrectIcon(rolloverSelectedIcon, jb, 9, "RolloverSelected icon");

    // no pressedSelected
    
    Icon disabledSelectedIcon = jb.getDisabledSelectedIcon();
    assertNotNull(disabledSelectedIcon);
    checkIfLoadedCorrectIcon(disabledSelectedIcon, jb, 11, "DisabledSelected icon");
}
 
Example 4
Project: incubator-netbeans   File: ActionsTest.java   Source Code and License Vote up 5 votes
/**
 * Test whether pressed, rollover and disabled 24x24 icons
 * work for javax.swing.Action.
 */
public void testIconsAction24() throws Exception {
    JButton jb = new JButton();
    jb.putClientProperty("PreferredIconSize",new Integer(24));
    Actions.connect(jb, new TestAction());
    
    Icon icon = jb.getIcon();
    assertNotNull(icon);
    checkIfLoadedCorrectIcon(icon, jb, 4, "Enabled icon24");
    
    Icon rolloverIcon = jb.getRolloverIcon();
    assertNotNull(rolloverIcon);
    checkIfLoadedCorrectIcon(rolloverIcon, jb, 5, "Rollover icon24");
    
    Icon pressedIcon = jb.getPressedIcon();
    assertNotNull(pressedIcon);
    checkIfLoadedCorrectIcon(pressedIcon, jb, 6, "Pressed icon24");
    
    Icon disabledIcon = jb.getDisabledIcon();
    assertNotNull(disabledIcon);
    checkIfLoadedCorrectIcon(disabledIcon, jb, 7, "Disabled icon24");

    Icon selectedIcon = jb.getSelectedIcon();
    assertNotNull(selectedIcon);
    checkIfLoadedCorrectIcon(selectedIcon, jb, 12, "Selected icon24");

    Icon rolloverSelectedIcon = jb.getRolloverSelectedIcon();
    assertNotNull(rolloverSelectedIcon);
    checkIfLoadedCorrectIcon(rolloverSelectedIcon, jb, 13, "RolloverSelected icon24");

    // no pressedSelected

    Icon disabledSelectedIcon = jb.getDisabledSelectedIcon();
    assertNotNull(disabledSelectedIcon);
    checkIfLoadedCorrectIcon(disabledSelectedIcon, jb, 15, "DisabledSelected icon24");
}