Archive for April, 2007

Photography web hosting - 750 Graphical User Interface Components: Part 2 Chapter

Wednesday, April 25th, 2007

750 Graphical User Interface Components: Part 2 Chapter 13 106 107 // add format menu to menu bar 108 formatMenu.add( colorMenu ); 109 formatMenu.addSeparator(); 110 111 // create Font submenu 112 String fontNames[] = { “Serif”, “Monospaced”, “SansSerif” }; 113 114 JMenu fontMenu = new JMenu( “Font” ); 115 fontMenu.setMnemonic( ‘n’ ); 116 117 fonts = new JRadioButtonMenuItem[ fontNames.length ]; 118 fontGroup = new ButtonGroup(); 119 120 // create Font radio button menu items 121 for ( int count = 0; count < fonts.length; count++ ) { 122 fonts[ count ] = 123 new JRadioButtonMenuItem( fontNames[ count ] ); 124 125 fontMenu.add( fonts[ count ] ); 126 fontGroup.add( fonts[ count ] ); 127 128 fonts[ count ].addActionListener( itemHandler ); 129 } 130 131 // select first Font menu item 132 fonts[ 0 ].setSelected( true ); 133 134 fontMenu.addSeparator(); 135 136 // set up style menu items 137 String styleNames[] = { "Bold", "Italic" }; 138 139 styleItems = new JCheckBoxMenuItem[ styleNames.length ]; 140 StyleHandler styleHandler = new StyleHandler(); 141 142 // create style checkbox menu items 143 for ( int count = 0; count < styleNames.length; count++ ) { 144 styleItems[ count ] = 145 new JCheckBoxMenuItem( styleNames[ count ] ); 146 147 fontMenu.add( styleItems[ count ] ); 148 149 styleItems[ count ].addItemListener( styleHandler ); 150 } 151 152 // put Font menu in Format menu 153 formatMenu.add( fontMenu ); 154 155 // add Format menu to menu bar 156 bar.add( formatMenu ); 157 Fig. 13.10 Using JMenus and mnemonics (part 3 of 5).
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision best web hosting services

Chapter 13 Graphical (Web space) User Interface Components: Part 2

Wednesday, April 25th, 2007

Chapter 13 Graphical User Interface Components: Part 2 749 53 // set up Exit menu item 54 JMenuItem exitItem = new JMenuItem( “Exit” ); 55 exitItem.setMnemonic( ‘x’ ); 56 57 exitItem.addActionListener( 58 59 // anonymous inner class to handle exitItem event 60 new ActionListener() { 61 62 // terminate application when user clicks exitItem 63 public void actionPerformed( ActionEvent event ) 64 { 65 System.exit( 0 ); 66 } 67 68 } // end anonymous inner class 69 70 ); // end call to addActionListener 71 72 fileMenu.add( exitItem ); 73 74 // create menu bar and attach it to MenuTest window 75 JMenuBar bar = new JMenuBar(); 76 setJMenuBar( bar ); 77 bar.add( fileMenu ); 78 79 // create Format menu, its submenus and menu items 80 JMenu formatMenu = new JMenu( “Format” ); 81 formatMenu.setMnemonic( ‘r’ ); 82 83 // create Color submenu 84 String colors[] = { “Black”, “Blue”, “Red”, “Green” }; 85 86 JMenu colorMenu = new JMenu( “Color” ); 87 colorMenu.setMnemonic( ‘C’ ); 88 89 colorItems = new JRadioButtonMenuItem[ colors.length ]; 90 colorGroup = new ButtonGroup(); 91 ItemHandler itemHandler = new ItemHandler(); 92 93 // create color radio button menu items 94 for ( int count = 0; count < colors.length; count++ ) { 95 colorItems[ count ] = 96 new JRadioButtonMenuItem( colors[ count ] ); 97 98 colorMenu.add( colorItems[ count ] ); 99 colorGroup.add( colorItems[ count ] ); 100 101 colorItems[ count ].addActionListener( itemHandler ); 102 } 103 104 // select first Color menu item 105 colorItems[ 0 ].setSelected( true ); Fig. 13.10 Using JMenus and mnemonics (part 2 of 5).
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision mysql5 web hosting services

748 Graphical User (Web site templates) Interface Components: Part 2 Chapter

Tuesday, April 24th, 2007

748 Graphical User Interface Components: Part 2 Chapter 13 // Fig. 13.10: MenuTest.java // Demonstrating menus // Java core packages import java.awt.*; import java.awt.event.*; // Java extension packages import javax.swing.*; public class MenuTest extends JFrame { private Color colorValues[] = { Color.black, Color.blue, Color.red, Color.green }; private JRadioButtonMenuItem colorItems[], fonts[]; private JCheckBoxMenuItem styleItems[]; private JLabel displayLabel; private ButtonGroup fontGroup, colorGroup; private int style; // set up GUI public MenuTest() { super( “Using JMenus” ); // set up File menu and its menu items JMenu fileMenu = new JMenu( “File” ); fileMenu.setMnemonic( ‘F’ ); // set up About… menu item JMenuItem aboutItem = new JMenuItem( “About…” ); aboutItem.setMnemonic( ‘A’ ); aboutItem.addActionListener( // anonymous inner class to handle menu item event new ActionListener() { // display message dialog when user selects About… public void actionPerformed( ActionEvent event ) { JOptionPane.showMessageDialog( MenuTest.this, “This is an examplenof using menus”, “About”, JOptionPane.PLAIN_MESSAGE ); } } // end anonymous inner class ); // end call to addActionListener fileMenu.add( aboutItem ); Fig. 13.10 Using JMenus and mnemonics (part 1 of 5).
Note: If you are looking for high quality webhost to host and run your jsp application check Vision christian web host services


free download ringtone

Moreover, this law also restricts drivers under the age of 18 from using free download ringtone at all.

metallica truetone enter sandman ringtone

In the UK, possession of metallica truetone enter sandman ringtone in an examination can result in immediate disqualification from that subject or from all that student’s subjects.

upload ringtone

Such services automatically detect upload ringtone settings to ensure the best file type and format.

text codes ringtones individual

NMT was text codes ringtones individual text codes ringtones individual system that enabled international use of the phone, or “roaming” on other networks in other countries.

ringtones sound bird

In some developing countries with little “landline” telephone infrastructure, ringtones sound bird use has quadrupled in ringtones sound bird decade.

free boostmobile ringtones

Experiments have shown that short duration exposure to very high levels of RF radiation can cause cataracts in rabbits.

qwest free ringtones

Mobile payments were first trialled in Finland in 1998 when two coca cola machines in Espoo were enabled to work with SMS payments.

billy joel my ringtone life

First trial payments using billy joel my ringtone life to pay for a Coca Cola vending machine were set in Finland in 1998.

ringtones free pc imate pocket

The evidence of this growth can still be seen in ringtones free pc imate pocket older, tall cell site towers with no antennae on the upper parts of their towers.

ringtones kottonmouth kings

On ringtones kottonmouth kings telephone system, this is created by sending an alternating current signal of about 100 volts into the line.

Chapter 13 Graphical User Interface Components: Part 2 (Web site translator)

Tuesday, April 24th, 2007

Chapter 13 Graphical User Interface Components: Part 2 747 Finally, the application window must be sized and displayed on the screen. Line 94 sets the application window s size, and line 98 displays the window. When a Java program displays any window, all the components attached to the window receive calls to their paint methods (if they are heavyweight components) or their paintComponent methods (if they are lightweight components). Thus, displaying the application window results in a call to the applet s paint method to complete the normal start-up sequence for the applet. Try executing this program as an applet and as an application to see that it has the same functionality when executed. 13.8 Using Menus with Frames Menus are an integral part of GUIs. Menus allow the user to perform actions without unnecessarily cluttering a graphical user interface with extra GUI components. In Swing GUIs, menus can be attached only to objects of the classes that provide method setJ- MenuBar. Two such classes are JFrame and JApplet. The classes used to define menus are JMenuBar, JMenuItem, JMenu, JCheckBoxMenuItem and class JRadioButtonMenuItem. Look-and-Feel Observation 13.16 Menus simplify GUIs by reducing the number of components the user views. Class JMenuBar (a subclass of JComponent) contains the methods necessary to manage a menu bar, which is a container for menus. Class JMenuItem (a subclass of javax.swing.AbstractButton) contains the methods necessary to manage menu items. A menu item is a GUI component inside a menu that, when selected, causes an action to be performed. A menu item can be used to initiate an action or it can be a submenu that provides more menu items from which the user can select. Submenus are useful for grouping related menu items in a menu. Class JMenu (a subclass of javax.swing.JMenuItem) contains the methods necessary for managing menus. Menus contain menu items and are added to menu bars or to other menus as submenus. When a menu is clicked, the menu expands to show its list of menu items. Clicking a menu item generates an action event. Class JCheckBoxMenuItem (a subclass of javax.swing.JMenuItem) contains the methods necessary to manage menu items that can be toggled on or off. When a JCheckBoxMenuItem is selected, a check appears to the left of the menu item. When the JCheckBoxMenuItem is selected again, the check to the left of the menu item is removed. Class JRadioButtonMenuItem (a subclass of javax.swing.JMenuItem) contains the methods necessary to manage menu items that can be toggled on or off like JCheckBoxMenuItems. When multiple JRadioButtonMenuItems are maintained as part of a ButtonGroup, only one item in the group can be selected at a given time. When a JRadioButtonMenuItem is selected, a filled circle appears to the left of the menu item. When another JRadioButtonMenuItem is selected, the filled circle to the left of the previously selected menu item is removed. The application of Fig. 13.10 demonstrates various types of menu items. The program also demonstrates how to specify special characters called mnemonics that can provide quick access to a menu or menu item from the keyboard. Mnemonics can be used with objects of all classes that have subclass javax.swing.AbstractButton.
Note: If you are looking for high quality webhost to host and run your jsp application check Vision christian web host services

My space web page - 746 Graphical User Interface Components: Part 2 Chapter

Tuesday, April 24th, 2007

746 Graphical User Interface Components: Part 2 Chapter 13 and height. [Note: This program assumes that the user inputs whole-number values for the command-line arguments; if not, an exception will occur. In Chapter 14, we discuss how to make our programs more robust by dealing with improper values when they occur.] When an applet executes, the window in which it executes is supplied by the applet container (i.e., the appletviewer or browser). When a program executes as an application, the application must create its own window (if one is required). Lines 75 76 create the JFrame to which the program will attach the applet. As with any JFrame that is used as the application s primary window, you should provide a mechanism to terminate the application. Lines 78 79 specify that the application should terminate when the user closes the window. Software Engineering Observation 13.3 To execute an applet as an application, the application must provide a window in which the applet can be displayed. When an applet executes in an applet container, the container creates one object of the applet class to execute the applet s tasks. In an application, objects are not created unless the application explicitly contains statements that create objects. Line 82 defines one instance of applet class DrawShapes. Notice the call to the no-argument constructor. We did not define a constructor in class DrawShapes (applet classes typically do not define constructors). Remember that the compiler provides a default constructor for a class that does not define any constructors. Lines 83 84 call DrawShapes methods setWidth and setHeight to validate the values for width and height (improper values are set to 300 and 200, respectively). Software Engineering Observation 13.4 To execute an applet as an application, the application must create an instance of the applet class to execute. When an applet executes in an applet container, the container guarantees that methods init, start and paint will be called to begin the applet s execution. However, these methods are not special to an application. Method init and start are not invoked automatically or required by an application. (Method paint is part of any window and will be called when it is necessary to repaint the window.) Lines 87 88 invoke appletObject s init method to initialize the applet and set up its GUI, then invoke method start. [Note: In our example, we did not override method start. It is called here to mimic the start-up sequence normally followed for an applet.] Software Engineering Observation 13.5 When executing an applet as an application, the application must call initand startexplicitly to simulate the normal applet start-up sequence of method calls. When an applet executes in an applet container, the applet is normally attached to the applet container s window. An application must explicitly attach an applet object to the application window. Line 91 obtains a reference to the applicationWindow s content pane and adds the appletObject to the default CENTER of the content pane s BorderLayout. The appletObject will occupy the entire window. Software Engineering Observation 13.6 When one is executing an applet as an application, the application must attach the applet object to its window.
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision shared web hosting services

Chapter 13 Graphical User Interface Components: Part 2 (Web file server)

Tuesday, April 24th, 2007

Chapter 13 Graphical User Interface Components: Part 2 745 144 case 1: 145 g.drawRect( randomX(), randomY(), 146 randomX(), randomY() ); 147 break; 148 149 case 2: 150 g.drawOval( randomX(), randomY(), 151 randomX(), randomY() ); 152 break; 153 } 154 155 } // end method paintComponent 156 157 // specify current shape choice and repaint 158 public void setCurrentChoice( int choice ) 159 { 160 currentChoice = choice; 161 repaint(); 162 } 163 164 // pick random x coordinate 165 private int randomX() 166 { 167 return ( int ) ( Math.random() * width ); 168 } 169 170 // pick random y coordinate 171 private int randomY() 172 { 173 return ( int ) ( Math.random() * height ); 174 } 175 176 } // end class DrawPanel Fig. 13.9Creating a GUI-based application from an applet (part 4 of 4). Fig. 13.9 Lines 65 72 determine the initial width and height of the application window. The if condition determines the length of array args. If the number of elements is not 2, the width and heightare set to 300 and 200 by default. Otherwise, lines 70 71 convert the command- line arguments from Strings to intvalues with parseIntand use them as the width
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check Vision mysql hosting services

744 Graphical User Interface (Cool web site) Components: Part 2 Chapter

Monday, April 23rd, 2007

744 Graphical User Interface Components: Part 2 Chapter 13 93 // set the window’s size 94 applicationWindow.setSize( width, height ); 95 96 // showing the window causes all GUI components 97 // attached to the window to be painted 98 applicationWindow.setVisible( true ); 99 } 100 101 // private inner class to handle button events 102 private class ButtonHandler implements ActionListener { 103 104 // determine button user pressed and set drawing area’s 105 // current choice 106 public void actionPerformed( ActionEvent event ) 107 { 108 for ( int count = 0; count < choices.length; count++ ) 109 110 if ( event.getSource() == choices[ count ] ) { 111 drawingPanel.setCurrentChoice( count ); 112 break; 113 } 114 } 115 116 } // end private inner class ButtonHandler 117 118 } // end class DrawShapes 119 120 // subclass of JPanel to allow drawing in a separate area 121 class DrawPanel extends JPanel { 122 private int currentChoice = -1; // don't draw first time 123 private int width = 100, height = 100; 124 125 // initialize width and height of DrawPanel 126 public DrawPanel( int newWidth, int newHeight ) 127 { 128 width = ( newWidth >= 0 ? newWidth : 100 ); 129 height = ( newHeight >= 0 ? newHeight : 100 ); 130 } 131 132 // draw line, rectangle or oval based on user’s choice 133 public void paintComponent( Graphics g ) 134 { 135 super.paintComponent( g ); 136 137 switch( currentChoice ) { 138 139 case 0: 140 g.drawLine( randomX(), randomY(), 141 randomX(), randomY() ); 142 break; 143 Fig. 13.9Creating a GUI-based application from an applet (part 3 of 4). Fig. 13.9
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision best web hosting services

Chapter 13 (Professional web hosting) Graphical User Interface Components: Part 2

Monday, April 23rd, 2007

Chapter 13 Graphical User Interface Components: Part 2 743 40 41 // attach components to content pane 42 Container container = getContentPane(); 43 container.add( buttonPanel, BorderLayout.NORTH ); 44 container.add( drawingPanel, BorderLayout.CENTER ); 45 } 46 47 // enables application to specify width of drawing area 48 public void setWidth( int newWidth ) 49 { 50 width = ( newWidth >= 0 ? newWidth : 300 ); 51 } 52 53 // enables application to specify height of drawing area 54 public void setHeight( int newHeight ) 55 { 56 height = ( newHeight >= 0 ? newHeight : 200 ); 57 } 58 59 // execute applet as an application 60 public static void main( String args[] ) 61 { 62 int width, height; 63 64 // check for command-line arguments 65 if ( args.length != 2 ) { 66 width = 300; 67 height = 200; 68 } 69 else { 70 width = Integer.parseInt( args[ 0 ] ); 71 height = Integer.parseInt( args[ 1 ] ); 72 } 73 74 // create window in which applet will execute 75 JFrame applicationWindow = 76 new JFrame( “An applet running as an application” ); 77 78 applicationWindow.setDefaultCloseOperation( 79 JFrame.EXIT_ON_CLOSE ); 80 81 // create one applet instance 82 DrawShapes appletObject = new DrawShapes(); 83 appletObject.setWidth( width ); 84 appletObject.setHeight( height ); 85 86 // call applet’s init and start methods 87 appletObject.init(); 88 appletObject.start(); 89 90 // attach applet to center of window 91 applicationWindow.getContentPane().add( appletObject ); 92 Fig. 13.9Creating a GUI-based application from an applet (part 2 of 4). Fig. 13.9
Note: If you are looking for high quality webhost to host and run your jsp application check Vision christian web host services

742 Graphical User (Vps web hosting) Interface Components: Part 2 Chapter

Monday, April 23rd, 2007

742 Graphical User Interface Components: Part 2 Chapter 13 java DrawShapes 600 400 contains two command-line arguments 600 and 400 that specify the width and height of the application window. Java passes the command-line arguments to mainas the array of Strings called args, which we have declared in the parameter list of every application s mainmethod, but not used until this point. The first argument after the application class name is the first String in the array args, and the length of the array is the total number of command-line arguments. Line 60 begins the definition of main and declares array argsas an array of Strings that allows the application to access the command-line arguments. Line 62 defines variables widthand heightthat are used to specify the size of the application window. 1 // Fig. 13.9: DrawShapes.java 2 // Draw random lines, rectangles and ovals 3 4 // Java core packages 5 import java.awt.*; 6 import java.awt.event.*; 7 8 // Java extension packages 9 import javax.swing.*; 10 11 public class DrawShapes extends JApplet { 12 private JButton choices[]; 13 private String names[] = { “Line”, “Rectangle”, “Oval” }; 14 private JPanel buttonPanel; 15 private DrawPanel drawingPanel; 16 private int width = 300, height = 200; 17 18 // initialize applet; set up GUI 19 public void init() 20 { 21 // set up DrawPanel 22 drawingPanel = new DrawPanel( width, height ); 23 24 // create array of buttons 25 choices = new JButton[ names.length ]; 26 27 // set up panel for buttons 28 buttonPanel = new JPanel(); 29 buttonPanel.setLayout( 30 new GridLayout( 1, choices.length ) ); 31 32 // set up buttons and register their listeners 33 ButtonHandler handler = new ButtonHandler(); 34 35 for ( int count = 0; count < choices.length; count++ ) { 36 choices[ count ] = new JButton( names[ count ] ); 37 buttonPanel.add( choices[ count ] ); 38 choices[ count ].addActionListener( handler ); 39 } Fig. 13.9Creating a GUI-based application from an applet (part 1 of 4). Fig. 13.9
Note: If you are looking for cheap webhost to host and run your apache application check Vision jboss web hosting services

Submit web site - Chapter 13 Graphical User Interface Components: Part 2

Sunday, April 22nd, 2007

Chapter 13 Graphical User Interface Components: Part 2 741 Window. Interface WindowListener (implemented by window event listeners) provides seven methods for handling window events windowActivated (called when the user makes a window the active window), windowClosed (called after the window is closed), windowClosing (called when the user initiates closing of the window), windowDeactivated (called when the user makes another window the active window), windowIconified (called when the user minimizes a window), windowDeiconified (called when the user restores a window from being minimized) and windowOpened (called when a program first displays a window on the screen). Most windows have an icon at the top-left or top-right corner that enables a user to close the window and terminate a program. Most windows also have an icon in the upper- left corner of the window that displays a menu when the user clicks the icon. This menu normally contains a Close option to close the window and several other options for manipulating the window. 13.7 Designing Programs that Execute as Applets orApplications It is sometimes desirable to design a Java program that can execute both as a stand-alone application and as an applet in a Web browser. Such a program can be used to provide the same functionality to users worldwide by making the applet available for download via Web and can be installed on a computer as a stand-alone application. The next example discusses how to create a small program that can execute both as an applet and as an application. [Note: In Chapter 16 and Chapter 17, we discuss several issues that make applets different from applications and security restrictions placed on applets that prevent certain application features from working in an applet.] Frequently, programs use JFrames to create GUI-based applications. The JFrame provides the space in which the application GUI appears. When the user closes the JFrame, the application terminates. In this section, we demonstrate how to convert an applet into a GUI-based application. The program of Fig. 13.9 presents an applet that also can be executed as an application. Software Engineering Observation 13.2 When designing a program to execute as both an applet and an application, begin by defining it as an applet, because applets have limitations due to security restrictions imposed on them by Web browsers. If the program executes properly as an applet, it can be made to work properly as an application. However, the reverse is not always true. Our applet class DrawShapes presents the user with three buttons which, when pressed, cause an instance of class DrawPanel (lines 121 126) to draw a random line, rectangle or oval (depending on which button is pressed). The applet does not contain any new features as far as GUI components, layouts or drawing are concerned. The only new feature is that the DrawShapes class now also contains a main method (lines 60 99) that can be used to execute the program as an application. We discuss this method in detail below. The HTML document that loads the applet into the appletviewer or a Web browser specifies the applet s width and height as 300 and 200, respectively. When the program executes as an application with the java interpreter, you can supply arguments to the program (called command-line arguments) that specify the width and height of the application window. For example, the command
Note: If you are looking for high quality webhost to host and run your jsp application check Vision florida web design services