December 22nd, 2007
* * @return javax.swing.JLabel */ private javax.swing.JLabel getJLabel5() { if(jLabel5 == null) { jLabel5 = new javax.swing.JLabel(); jLabel5.setText(”"); } return jLabel5; } /** * This method initializes jLabel6 * * @return javax.swing.JLabel */ private javax.swing.JLabel getJLabel6() { if(jLabel6 == null) { jLabel6 = new javax.swing.JLabel(); jLabel6.setText(”"); } return jLabel6; } } // @jve:visual-info decl-index=0 visual-constraint=”12,9″ Listing 5.7 (Continued) The Complete Application Finally, you need a Player root class for the whole application. This class contains the main() method. Within this method you can create a new Player instance. This causes the Players constructor to create a Face and a Voice instance and to connect both with the help of the Animator class. Furthermore, a PlayerModel instance and a PlayerPanel instance are created and wired together. The Player.java class The Player class is implemented as an extension of the Swing JFrame class. When you create this class you must specify JFrame as a super class. In addition, you must checkmark the public static void main( ) option. This will generate a stub for the main() method. package com.bdaum.dukeSpeaks; import java.awt.BorderLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.net.URL; import java.util.Locale; import javax.swing.*; import com.sun.speech.freetts.Age; import com.sun.speech.freetts.Gender; 106 Chapter 5
Please check java servlet web hosting services, here you will find professional-grade java servlet web hosting with the best prices.
Posted in Java Applications with J2EE | No Comments »
December 21st, 2007
if(speakButton == null) { speakButton = new javax.swing.JButton(); speakButton.setText(”Speak Text”); speakButton.setMnemonic(java.awt.event.KeyEvent.VK_S); speakButton.setToolTipText(”Speak text in text area”); speakButton.setBackground(new java.awt.Color(250,250,250)); speakButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { String inputText = textInputArea.getText(); if (inputText.length() > 0) playerModel.play(inputText); } }); } return speakButton; } /** * This method initializes deleteButton * * @return javax.swing.JButton */ private javax.swing.JButton getDeleteButton() { if(deleteButton == null) { deleteButton = new javax.swing.JButton(); deleteButton.setText(”Delete Text”); deleteButton.setMnemonic(java.awt.event.KeyEvent.VK_D); deleteButton.setToolTipText(”Delete all text in text area”); deleteButton.setBackground(new java.awt.Color(250,250,250)); deleteButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { textInputArea.setText(”"); } }); } return deleteButton; } /** * This method initializes textInputArea * * @return javax.swing.JTextArea */ private javax.swing.JTextArea getTextInputArea() { if(textInputArea == null) { textInputArea = new javax.swing.JTextArea(); textInputArea.setLineWrap(true); textInputArea.setRows(5); textInputArea.setText(”Hello, this is your animated voice!”); } return textInputArea; } /** * This method initializes jLabel5 105 Project One: Duke Speaks Listing 5.7 (Continues)
Are you a Mac user in a search of Mac web hosting provider? We are. once upon a time, we were just like you, trying to find somebody who knows. Unfortunately, we had no luck, so we decided to help many others like you, and us. our team developed Mac friendly web hosting plans, feature packed, constantly monitored, and more than affordable. With us, you are home. Sign up.
Posted in Java Applications with J2EE | No Comments »
December 20th, 2007
/** * This method initializes textAndButtonPanel * * @return javax.swing.JPanel */ private javax.swing.JPanel getTextAndButtonPanel() { if(textAndButtonPanel == null) { textAndButtonPanel = new javax.swing.JPanel(); textAndButtonPanel.setLayout(new java.awt.BorderLayout()); textAndButtonPanel.add(getTextAreaLabel(), java.awt.BorderLayout.NORTH); textAndButtonPanel.add(getTextInputArea(), java.awt.BorderLayout.CENTER); textAndButtonPanel.add(getButtonPanel(), java.awt.BorderLayout.SOUTH); textAndButtonPanel.setBorder( javax.swing.BorderFactory.createEtchedBorder( javax.swing.border.EtchedBorder.RAISED)); } return textAndButtonPanel; } /** * This method initializes textAreaLabel * * @return javax.swing.JLabel */ private javax.swing.JLabel getTextAreaLabel() { if(textAreaLabel == null) { textAreaLabel = new javax.swing.JLabel(); textAreaLabel.setText(”Enter Text:”); textAreaLabel.setDisplayedMnemonic( java.awt.event.KeyEvent.VK_T); } return textAreaLabel; } /** * This method initializes buttonPanel * * @return javax.swing.JPanel */ private javax.swing.JPanel getButtonPanel() { if(buttonPanel == null) { buttonPanel = new javax.swing.JPanel(); buttonPanel.add(getSpeakButton(), null); buttonPanel.add(getDeleteButton(), null); } return buttonPanel; } /** * This method initializes speakButton * * @return javax.swing.JButton */ private javax.swing.JButton getSpeakButton() { 104 Chapter 5 Listing 5.7 (Continues)
If you need complete reliable cheap web hosting package, you come to right place. We offer all you need just check our cheap web hosting package section.
Posted in Java Applications with J2EE | No Comments »
December 19th, 2007
* * @return javax.swing.JPanel */ private javax.swing.JPanel getRangePanel() { if(rangePanel == null) { rangePanel = new javax.swing.JPanel(); rangePanel.setLayout(new java.awt.BorderLayout()); rangePanel.add(getRangeLabel(), java.awt.BorderLayout.NORTH); rangePanel.add(getRangeSlider(), java.awt.BorderLayout.CENTER); } return rangePanel; } /** * This method initializes rangeLabel * * @return javax.swing.JLabel */ private javax.swing.JLabel getRangeLabel() { if(rangeLabel == null) { rangeLabel = new javax.swing.JLabel(); rangeLabel.setText(”Range”); rangeLabel.setHorizontalAlignment( javax.swing.SwingConstants.CENTER); rangeLabel.setHorizontalTextPosition( javax.swing.SwingConstants.CENTER); rangeLabel.setDisplayedMnemonic(java.awt.event.KeyEvent.VK_R); } return rangeLabel; } /** * This method initializes rangeSlider * * @return javax.swing.JSlider */ private javax.swing.JSlider getRangeSlider() { if(rangeSlider == null) { rangeSlider = new javax.swing.JSlider(); rangeSlider.setOrientation(javax.swing.JSlider.VERTICAL); rangeSlider.putClientProperty(”JSlider.isFilled”, Boolean.TRUE); rangeSlider.setMaximum(50); rangeSlider.setMajorTickSpacing(10); rangeSlider.setMinorTickSpacing(5); rangeSlider.setValue(0); rangeSlider.setToolTipText(”Variation”); rangeSlider.setPaintLabels(true); rangeSlider.setPaintTicks(true); rangeSlider.addChangeListener( new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent e) { playerModel.setRange((float) rangeSlider.getValue()); } }); } return rangeSlider; } 103 Project One: Duke Speaks Listing 5.7 (Continues)
Sbc yahoo internet provider is a name that we will not do any shame to. We are as good in what we do. Our sbc yahoo web hosting team will work hard to meet and satisfy all your web hosting needs.Try us out!
Posted in Java Applications with J2EE | No Comments »
December 19th, 2007
private javax.swing.JPanel getPitchPanel() { if(pitchPanel == null) { pitchPanel = new javax.swing.JPanel(); pitchPanel.setLayout(new java.awt.BorderLayout()); pitchPanel.add(getPitchLabel(), java.awt.BorderLayout.NORTH); pitchPanel.add(getPitchSlider(), java.awt.BorderLayout.CENTER); } return pitchPanel; } /** * This method initializes pitchLabel * * @return javax.swing.JLabel */ private javax.swing.JLabel getPitchLabel() { if(pitchLabel == null) { pitchLabel = new javax.swing.JLabel(); pitchLabel.setText(”Hz”); pitchLabel.setHorizontalAlignment( javax.swing.SwingConstants.CENTER); pitchLabel.setHorizontalTextPosition( javax.swing.SwingConstants.CENTER); pitchLabel.setDisplayedMnemonic(java.awt.event.KeyEvent.VK_H); } return pitchLabel; } /** * This method initializes pitchSlider * * @return javax.swing.JSlider */ private javax.swing.JSlider getPitchSlider() { if(pitchSlider == null) { pitchSlider = new javax.swing.JSlider(); pitchSlider.putClientProperty(”JSlider.isFilled”, Boolean.TRUE); pitchSlider.setOrientation(javax.swing.JSlider.VERTICAL); pitchSlider.setMinimum(50); pitchSlider.setMaximum(200); pitchSlider.setMinorTickSpacing(25); pitchSlider.setMajorTickSpacing(50); pitchSlider.setValue(50); pitchSlider.setToolTipText(”Pitch”); pitchSlider.setPaintTicks(true); pitchSlider.addChangeListener( new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent e) { playerModel.setPitch((float) pitchSlider.getValue()); } }); } return pitchSlider; } /** * This method initializes rangePanel 102 Chapter 5 Listing 5.7 (Continues)
Posted in Java Applications with J2EE | No Comments »
December 18th, 2007
speedPanel.setLayout(new java.awt.BorderLayout()); speedPanel.add(getSpeedLabel(), java.awt.BorderLayout.NORTH); speedPanel.add(getSpeedSlider(), java.awt.BorderLayout.CENTER); } return speedPanel; } /** * This method initializes speedLabel * * @return javax.swing.JLabel */ private javax.swing.JLabel getSpeedLabel() { if(speedLabel == null) { speedLabel = new javax.swing.JLabel(); speedLabel.setText(”Words/min”); speedLabel.setHorizontalAlignment( javax.swing.SwingConstants.CENTER); speedLabel.setHorizontalTextPosition( javax.swing.SwingConstants.CENTER); speedLabel.setDisplayedMnemonic(java.awt.event.KeyEvent.VK_W); } return speedLabel; } /** * This method initializes speedSlider * * @return javax.swing.JSlider */ private javax.swing.JSlider getSpeedSlider() { if(speedSlider == null) { speedSlider = new javax.swing.JSlider(); speedSlider.setOrientation(javax.swing.JSlider.VERTICAL); speedSlider.putClientProperty(”JSlider.isFilled”, Boolean.TRUE); speedSlider.setMaximum(400); speedSlider.setMinorTickSpacing(50); speedSlider.setMajorTickSpacing(100); speedSlider.setToolTipText(”Speed”); speedSlider.setPaintLabels(true); speedSlider.setPaintTicks(true); speedSlider.setPaintTrack(true); speedSlider.addChangeListener( new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent e) { playerModel.setSpeakingRate((float) speedSlider.getValue()); } }); } return speedSlider; } /** * This method initializes pitchPanel * * @return javax.swing.JPanel */ 101 Project One: Duke Speaks Listing 5.7 (Continues)
We are comcast web hosting company willing to take you step further, please look comcat web hosting services.
Posted in Java Applications with J2EE | No Comments »
December 17th, 2007
} return volumePanel; } /** * This method initializes volumeLabel * * @return javax.swing.JLabel */ private javax.swing.JLabel getVolumeLabel() { if(volumeLabel == null) { volumeLabel = new javax.swing.JLabel(); volumeLabel.setText(”Volume”); volumeLabel.setHorizontalTextPosition( javax.swing.SwingConstants.CENTER); volumeLabel.setHorizontalAlignment( javax.swing.SwingConstants.CENTER); volumeLabel.setDisplayedMnemonic(java.awt.event.KeyEvent.VK_V); } return volumeLabel; } /** * This method initializes volumeSlider * * @return javax.swing.JSlider */ private javax.swing.JSlider getVolumeSlider() { if(volumeSlider == null) { volumeSlider = new javax.swing.JSlider(); volumeSlider.putClientProperty(”JSlider.isFilled”, Boolean.TRUE); volumeSlider.setMaximum(10); volumeSlider.setMinorTickSpacing(1); volumeSlider.setMajorTickSpacing(5); volumeSlider.setOrientation(javax.swing.JSlider.VERTICAL); volumeSlider.setToolTipText(”Volume”); volumeSlider.setPaintLabels(true); volumeSlider.setPaintTicks(true); volumeSlider.addChangeListener( new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent e) { playerModel.setVolume((float) volumeSlider.getValue()); } }); } return volumeSlider; } /** * This method initializes speedPanel * * @return javax.swing.JPanel */ private javax.swing.JPanel getSpeedPanel() { if(speedPanel == null) { speedPanel = new javax.swing.JPanel(); 100 Chapter 5 Listing 5.7 (Continues)
Our Colorado hosting facilities are located in Little Rock, Colorado. Colorado web hosting datacenter which we have is linked on five major US backbones which gives you assurance that your site will be online 24/7 a day. More details you can find out in Web Hosting Colorado part.
Posted in Java Applications with J2EE | No Comments »
December 16th, 2007
*/ private javax.swing.JPanel getLeftSlidersPanel() { if(leftSlidersPanel == null) { leftSlidersPanel = new javax.swing.JPanel(); leftSlidersPanel.setLayout(new java.awt.GridLayout(1,3)); leftSlidersPanel.add(getVolumePanel()); leftSlidersPanel.add(getSpeedPanel()); leftSlidersPanel.add(getJLabel5(), null); } return leftSlidersPanel; } /** * This method initializes centerPanel * * @return javax.swing.JPanel */ private javax.swing.JPanel getCenterPanel() { if(centerPanel == null) { centerPanel = new javax.swing.JPanel(); centerPanel.setLayout(new java.awt.GridLayout(1,1)); centerPanel.add(face); } return centerPanel; } /** * This method initializes rightSlidersPanel * * @return javax.swing.JPanel */ private javax.swing.JPanel getRightSlidersPanel() { if(rightSlidersPanel == null) { rightSlidersPanel = new javax.swing.JPanel(); java.awt.GridLayout layGridLayout1 = new java.awt.GridLayout(1, 2); layGridLayout1.setColumns(3); rightSlidersPanel.setLayout(layGridLayout1); rightSlidersPanel.add(getJLabel6(), null); rightSlidersPanel.add(getPitchPanel()); rightSlidersPanel.add(getRangePanel()); } return rightSlidersPanel; } /** * This method initializes volumePanel * * @return javax.swing.JPanel */ private javax.swing.JPanel getVolumePanel() { if(volumePanel == null) { volumePanel = new javax.swing.JPanel(); volumePanel.setLayout(new java.awt.BorderLayout()); volumePanel.add(getVolumeLabel(), java.awt.BorderLayout.NORTH); volumePanel.add(getVolumeSlider(), java.awt.BorderLayout.CENTER); 99 Project One: Duke Speaks Listing 5.7 (Continues)
We are here to provide web hosting at an affordable rate for the online Christian community. The term “Christian” is used by various groups with diverse beliefs to describe themselves. Some people, including many born-again Christians, use a fairly specific definition of “Christian”. They believe that in order to be a Christian, one must follow Jesus, and that the proof of this is found in agreeing to and following the doctrines set forth in the Bible. Others who refer to themselves as Christians require only that one believes that Jesus is the Son of God, that he died, and that he was resurrected from the dead, to claim the term Christian.Check Christian Web Hosting section.
Posted in Java Applications with J2EE | No Comments »
December 15th, 2007
int volume = (int) playerModel.getVolume(); if (volume >= 0) volumeSlider.setValue(volume); // Speed int rate = (int) playerModel.getSpeakingRate(); if (rate >= 0) speedSlider.setValue(rate); // Pitch int pitch = (int) playerModel.getPitch(); if (pitch >= 0) pitchSlider.setValue(pitch); // Variation int range = (int) playerModel.getRange(); if (range >= 0) rangeSlider.setValue(range); } public javax.swing.JPanel getContentPane() { if(contentPane == null) { contentPane = new javax.swing.JPanel(); contentPane.setLayout(new java.awt.BorderLayout()); contentPane.add(getControlAreaPane(), java.awt.BorderLayout.CENTER); contentPane.add(getTextAndButtonPanel(), java.awt.BorderLayout.SOUTH); contentPane.setSize(new java.awt.Dimension(600,500)); volumeLabel.setLabelFor(volumeSlider); speedLabel.setLabelFor(speedSlider); pitchLabel.setLabelFor(pitchSlider); rangeLabel.setLabelFor(rangeSlider); textAreaLabel.setLabelFor(textInputArea); updateSliders(); } return contentPane; } /** * This method initializes controlAreaPane * * @return javax.swing.JPanel */ private javax.swing.JPanel getControlAreaPane() { if(controlAreaPane == null) { controlAreaPane = new javax.swing.JPanel(); controlAreaPane.setLayout(new GridLayout(1, 3)); controlAreaPane.add(getLeftSlidersPanel()); controlAreaPane.add(getCenterPanel()); controlAreaPane.add(getRightSlidersPanel()); } return controlAreaPane; } /** * This method initializes leftSlidersPanel * * @return javax.swing.JPanel 98 Chapter 5 Listing 5.7 (Continues)
Adult web hosting has rich experience in providing unique solutions for the customer’s needs, just check frontpage web hosting services.
Posted in Java Applications with J2EE | No Comments »
December 14th, 2007
package com.bdaum.dukeSpeaks; import java.awt.GridLayout; import javax.swing.JPanel; public class PlayerPanel { // The data model private PlayerModel playerModel; // The JPanel instance for the face private JPanel face; private javax.swing.JPanel contentPane = null; private javax.swing.JPanel controlAreaPane = null; private javax.swing.JPanel leftSlidersPanel = null; private javax.swing.JPanel centerPanel = null; private javax.swing.JPanel rightSlidersPanel = null; private javax.swing.JPanel volumePanel = null; private javax.swing.JLabel volumeLabel = null; private javax.swing.JSlider volumeSlider = null; private javax.swing.JPanel speedPanel = null; private javax.swing.JLabel speedLabel = null; private javax.swing.JSlider speedSlider = null; private javax.swing.JPanel pitchPanel = null; private javax.swing.JLabel pitchLabel = null; private javax.swing.JSlider pitchSlider = null; private javax.swing.JPanel rangePanel = null; private javax.swing.JLabel rangeLabel = null; private javax.swing.JSlider rangeSlider = null; private javax.swing.JPanel textAndButtonPanel = null; private javax.swing.JLabel textAreaLabel = null; private javax.swing.JPanel buttonPanel = null; private javax.swing.JButton speakButton = null; private javax.swing.JButton deleteButton = null; private javax.swing.JTextArea textInputArea = null; private javax.swing.JLabel jLabel5 = null; private javax.swing.JLabel jLabel6 = null; /** * */ public PlayerPanel(PlayerModel playerModel, JPanel face) { super(); // Save parameters into fields this.playerModel = playerModel; this.face = face; } /** * Method updateSliders. * updates all the sliders with values from the PlayerModel. */ private void updateSliders() { // Volume 97 Project One: Duke Speaks Listing 5.7 (Continues)
Do you want truly affordable web hosting? With us, what you see is what you get, just click on affordable web hosting services.
Posted in Java Applications with J2EE | No Comments »