Package nextapp.echo2.app

Examples of nextapp.echo2.app.Button


       
        Row controlRow = new Row();
        controlRow.setStyleName("ControlPane");
        splitPane.add(controlRow);
       
        Button button = new Button(Messages.getString("LoginScreen.Continue"), Styles.ICON_24_YES);
        button.setStyleName("ControlPane.Button");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                processLogin();
            }
        });
        controlRow.add(button);
View Full Code Here


        text.append(runTimeInSeconds == 0 ? "Indefinite" : (runTimeInSeconds + "s"));
        text.append(", Callback interval: ");
        text.append(callbackInterval);
        text.append("ms, Clicks Per Iteration: ");
        text.append(clicksPerIteration);
        Button startButton = new Button(text.toString());
        startButton.setStyleName("Default");
        startButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                InteractiveApp app = (InteractiveApp)getApplicationInstance();
                GhostTask ghostTask = new GhostTask();
                ghostTask.setClicksPerIteration(clicksPerIteration);
                if (runTimeInSeconds > 0) {
View Full Code Here

     * Test behavior of <code>ActionListener</code>s.
     */
    public void testActionListener() {
        ActionHandler buttonActionListener = new ActionHandler();
        ActionHandler modelActionListener = new ActionHandler();
        Button button = new Button("Test");
        ButtonModel model = button.getModel();
        button.addActionListener(buttonActionListener);
        model.addActionListener(modelActionListener);
        assertEquals(0, buttonActionListener.eventCount);
        assertEquals(0, modelActionListener.eventCount);
        button.doAction();
        assertEquals(1, buttonActionListener.eventCount);
        assertEquals(1, modelActionListener.eventCount);
        assertEquals(button, buttonActionListener.lastEvent.getSource());
        assertEquals(model, modelActionListener.lastEvent.getSource());

View Full Code Here

   
    /**
     * Test default button values.
     */
    public void testDefaults() {
        Button button = new Button();
        assertTrue(button.isLineWrap());
        assertFalse(button.isPressedEnabled());
        assertFalse(button.isRolloverEnabled());
        assertNull(button.getActionCommand());
    }
View Full Code Here

   
    /**
     * Attempt to illegally add children, test for failure.
     */
    public void testIllegalChildren() {
        Button button = new Button();
        boolean exceptionThrown = false;
        try {
            button.add(new Label("you can't add children to this component, right?"));
        } catch (IllegalChildException ex) {
            exceptionThrown = true;
        }
        assertTrue(exceptionThrown);
    }
View Full Code Here

    /**
     * Ensure setting model to null fails.
     */
    public void testNullModelException() {
        boolean exceptionThrown = false;
        Button button = new Button();
        try {
            button.setModel(null);
        } catch (IllegalArgumentException ex) {
            exceptionThrown = true;
        }
        assertTrue(exceptionThrown);
    }
View Full Code Here

   
    /**
     * Test pressed-state-related property accessors and mutators.
     */
    public void testPressedProperties() {
        Button button = new Button();
       
        button.setPressedBackground(Color.GREEN);
        button.setPressedBackgroundImage(TestConstants.BACKGROUND_IMAGE);
        button.setPressedBorder(TestConstants.BORDER_THICK_ORANGE);
        button.setPressedEnabled(true);
        button.setPressedFont(TestConstants.TIMES_72);
        button.setPressedForeground(Color.YELLOW);
        button.setPressedIcon(TestConstants.PRESSED_ICON);
       
        assertEquals(Color.GREEN, button.getPressedBackground());
        assertEquals(TestConstants.BACKGROUND_IMAGE, button.getPressedBackgroundImage());
        assertEquals(TestConstants.BORDER_THICK_ORANGE, button.getPressedBorder());
        assertTrue(button.isPressedEnabled());
        assertEquals(TestConstants.TIMES_72, button.getPressedFont());
        assertEquals(Color.YELLOW, button.getPressedForeground());
        assertEquals(TestConstants.PRESSED_ICON, button.getPressedIcon());
    }
View Full Code Here

   
    /**
     * Test property accessors and mutators.
     */
    public void testProperties() {
        Button button = new Button();
       
        button.setText("Alpha");
        assertEquals("Alpha", button.getText());
       
        button.setBackgroundImage(TestConstants.BACKGROUND_IMAGE);
        assertEquals(TestConstants.BACKGROUND_IMAGE, button.getBackgroundImage());
       
        button.setIcon(TestConstants.ICON);
        assertEquals(TestConstants.ICON, button.getIcon());
        button.setIconTextMargin(TestConstants.EXTENT_100_PX);
        assertEquals(TestConstants.EXTENT_100_PX, button.getIconTextMargin());
       
        button.setBorder(TestConstants.BORDER_THIN_YELLOW);
        assertEquals(TestConstants.BORDER_THIN_YELLOW, button.getBorder());
       
        button.setHeight(TestConstants.EXTENT_500_PX);
        assertEquals(TestConstants.EXTENT_500_PX, button.getHeight());
        button.setWidth(TestConstants.EXTENT_200_PX);
        assertEquals(TestConstants.EXTENT_200_PX, button.getWidth());
       
        button.setTextAlignment(new Alignment(Alignment.LEADING, Alignment.BOTTOM));
        assertEquals(new Alignment(Alignment.LEADING, Alignment.BOTTOM), button.getTextAlignment());
       
        button.setTextPosition(new Alignment(Alignment.DEFAULT, Alignment.TOP));
        assertEquals(new Alignment(Alignment.DEFAULT, Alignment.TOP), button.getTextPosition());
    }
View Full Code Here

   
    /**
     * Test rollover-state-related property accessors and mutators.
     */
    public void testRolloverProperties() {
        Button button = new Button();
       
        button.setRolloverEnabled(true);
        button.setRolloverBackgroundImage(TestConstants.BACKGROUND_IMAGE);
        button.setRolloverBackground(Color.RED);
        button.setRolloverForeground(Color.BLUE);
        button.setRolloverFont(TestConstants.MONOSPACE_12);
        button.setRolloverBorder(TestConstants.BORDER_THIN_YELLOW);
        button.setRolloverIcon(TestConstants.ROLLOVER_ICON);
       
        assertTrue(button.isRolloverEnabled());
        assertEquals(TestConstants.BACKGROUND_IMAGE, button.getRolloverBackgroundImage());
        assertEquals(Color.RED, button.getRolloverBackground());
        assertEquals(Color.BLUE, button.getRolloverForeground());
        assertEquals(TestConstants.MONOSPACE_12, button.getRolloverFont());
        assertEquals(TestConstants.BORDER_THIN_YELLOW, button.getRolloverBorder());
        assertEquals(TestConstants.ROLLOVER_ICON, button.getRolloverIcon());

        button.setRolloverEnabled(false);
        assertFalse(button.isRolloverEnabled());
    }
View Full Code Here

               
                ContentPane subContentPane3 = new ContentPane();
                splitPane2.add(subContentPane3);
               
               
                final Button button = new Button("Alpha");
                button.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        button.setText("Alpha".equals(button.getText()) ? "Omega" : "Alpha");
                    }
                });
                subContentPane3.add(button);

                layoutData = new SplitPaneLayoutData();
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.Button

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.