Java 类javax.swing.plaf.basic.BasicOptionPaneUI.ButtonAreaLayout 实例源码

项目:cn1    文件:BasicOptionPaneUITest.java   
public void testAddButtonComponents() {
    Object option1 = new JRadioButton("Tarara");
    Object option2 = new Integer(100);
    Object option3 = "Eminem must tsum menimE";
    Object option4 = new Button("Tarara");
    Container buttonArea = new JPanel();
    buttonArea.setLayout(new ButtonAreaLayout(true, 6));
    paneUI.addButtonComponents(buttonArea, new Object[] { option1, option2, option3,
            option4 }, 0);
    assertEquals("number of buttons", 4, buttonArea.getComponentCount());
    assertEquals("button class", JRadioButton.class, buttonArea.getComponent(0).getClass());
    assertEquals("button text", "Tarara", ((JRadioButton) (buttonArea.getComponent(0)))
            .getText());
    assertEquals("button class", JButton.class, buttonArea.getComponent(1).getClass());
    assertEquals("button text", "100", ((JButton) (buttonArea.getComponent(1))).getText());
    assertEquals("button class", JButton.class, buttonArea.getComponent(2).getClass());
    assertEquals("button text", option3, ((JButton) (buttonArea.getComponent(2))).getText());
    assertEquals("button class", Button.class, buttonArea.getComponent(3).getClass());
    assertEquals("button text", "Tarara", ((Button) (buttonArea.getComponent(3)))
            .getLabel());
}
项目:freeVM    文件:BasicOptionPaneUITest.java   
public void testAddButtonComponents() {
    Object option1 = new JRadioButton("Tarara");
    Object option2 = new Integer(100);
    Object option3 = "Eminem must tsum menimE";
    Object option4 = new Button("Tarara");
    Container buttonArea = new JPanel();
    buttonArea.setLayout(new ButtonAreaLayout(true, 6));
    paneUI.addButtonComponents(buttonArea, new Object[] { option1, option2, option3,
            option4 }, 0);
    assertEquals("number of buttons", 4, buttonArea.getComponentCount());
    assertEquals("button class", JRadioButton.class, buttonArea.getComponent(0).getClass());
    assertEquals("button text", "Tarara", ((JRadioButton) (buttonArea.getComponent(0)))
            .getText());
    assertEquals("button class", JButton.class, buttonArea.getComponent(1).getClass());
    assertEquals("button text", "100", ((JButton) (buttonArea.getComponent(1))).getText());
    assertEquals("button class", JButton.class, buttonArea.getComponent(2).getClass());
    assertEquals("button text", option3, ((JButton) (buttonArea.getComponent(2))).getText());
    assertEquals("button class", Button.class, buttonArea.getComponent(3).getClass());
    assertEquals("button text", "Tarara", ((Button) (buttonArea.getComponent(3)))
            .getLabel());
}
项目:freeVM    文件:BasicOptionPaneUITest.java   
public void testAddButtonComponents() {
    Object option1 = new JRadioButton("Tarara");
    Object option2 = new Integer(100);
    Object option3 = "Eminem must tsum menimE";
    Object option4 = new Button("Tarara");
    Container buttonArea = new JPanel();
    buttonArea.setLayout(new ButtonAreaLayout(true, 6));
    paneUI.addButtonComponents(buttonArea, new Object[] { option1, option2, option3,
            option4 }, 0);
    assertEquals("number of buttons", 4, buttonArea.getComponentCount());
    assertEquals("button class", JRadioButton.class, buttonArea.getComponent(0).getClass());
    assertEquals("button text", "Tarara", ((JRadioButton) (buttonArea.getComponent(0)))
            .getText());
    assertEquals("button class", JButton.class, buttonArea.getComponent(1).getClass());
    assertEquals("button text", "100", ((JButton) (buttonArea.getComponent(1))).getText());
    assertEquals("button class", JButton.class, buttonArea.getComponent(2).getClass());
    assertEquals("button text", option3, ((JButton) (buttonArea.getComponent(2))).getText());
    assertEquals("button class", Button.class, buttonArea.getComponent(3).getClass());
    assertEquals("button text", "Tarara", ((Button) (buttonArea.getComponent(3)))
            .getLabel());
}