| | |
need help...
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2006
Posts: 7
Reputation:
Solved Threads: 0
this is what i did........
/**
* @(#)VowelAnalyzer.java
*
* Sample Applet application
*
* @author
* @version 1.00 06/01/13
*/
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class VowelAnalyzer extends Applet implements ActionListener,AdjustmentListener {
Label L1,L2,L3,L4,L5,L6,L7;
Button B1;
Panel p=new Panel();
Panel p1=new Panel();
Panel p2=new Panel();
Panel p3=new Panel();
Panel p4=new Panel();
TextField T1;
int R=0,G=0,B=0,size;
Scrollbar S1,S2,S3;
String word="";
int aCount = 0,eCount = 0,iCount = 0,oCount = 0,uCount = 0;
public void init() {
L1=new Label(" INPUT TEXT:");
L3=new Label(" ");
L4=new Label(" ");
L2=new Label(" COLOR OF VOWELS:");
L5=new Label(" Red");
L6=new Label(" Green");
L7=new Label(" Blue");
T1=new TextField(30);
B1=new Button("Submit");
B1.addActionListener (this);
S1=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
add(S1);
S1.addAdjustmentListener(this);
S2=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
add(S2);
S2.addAdjustmentListener(this);
S3=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
add(S3);
S3.addAdjustmentListener(this);
p.setLayout(new BorderLayout());
p.add("East",L4);
p.add("Center",L1);
p.add("West",L3);
p.add("South",T1);
add(p);
p1.setLayout(new BorderLayout());
p1.add("North",p);
p1.add("South",L2);
add(p1);
p2.setLayout(new GridLayout(2,3,5,1));
p2.add(L5);
p2.add(L6);
p2.add(L7);
p2.add(S1);
p2.add(S2);
p2.add(S3);
add(p2);
p3.setLayout(new BorderLayout());
p3.add("North",p1);
p3.add("South",p2);
add(p3);
p4.setLayout(new BorderLayout(0,2));
p4.add("North",p3);
p4.add("South",B1);
add(p4);
}
public void actionPerformed(ActionEvent e){
word=T1.getText();
repaint();
}
public void adjustmentValueChanged(AdjustmentEvent e){
if(e.getSource()==S1)
R=S1.getValue();
if(e.getSource()==S2)
G=S2.getValue();
if( e.getSource()==S3)
B=S3.getValue();
// setForeground(new Color(R,G,B));
repaint();
}
public void paint(Graphics g) {
g.drawString("Vowels are displayed in RGB color of ("+R+","+G+","+B+").", 10,200);
Font font=new Font("Serif",Font.BOLD,17);
g.setFont(font);
g.setColor(new Color(R,G,B));
g.drawString(""+word, 8, 180 );
}
}
i need some help from here onnnnn.....
/**
* @(#)VowelAnalyzer.java
*
* Sample Applet application
*
* @author
* @version 1.00 06/01/13
*/
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class VowelAnalyzer extends Applet implements ActionListener,AdjustmentListener {
Label L1,L2,L3,L4,L5,L6,L7;
Button B1;
Panel p=new Panel();
Panel p1=new Panel();
Panel p2=new Panel();
Panel p3=new Panel();
Panel p4=new Panel();
TextField T1;
int R=0,G=0,B=0,size;
Scrollbar S1,S2,S3;
String word="";
int aCount = 0,eCount = 0,iCount = 0,oCount = 0,uCount = 0;
public void init() {
L1=new Label(" INPUT TEXT:");
L3=new Label(" ");
L4=new Label(" ");
L2=new Label(" COLOR OF VOWELS:");
L5=new Label(" Red");
L6=new Label(" Green");
L7=new Label(" Blue");
T1=new TextField(30);
B1=new Button("Submit");
B1.addActionListener (this);
S1=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
add(S1);
S1.addAdjustmentListener(this);
S2=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
add(S2);
S2.addAdjustmentListener(this);
S3=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
add(S3);
S3.addAdjustmentListener(this);
p.setLayout(new BorderLayout());
p.add("East",L4);
p.add("Center",L1);
p.add("West",L3);
p.add("South",T1);
add(p);
p1.setLayout(new BorderLayout());
p1.add("North",p);
p1.add("South",L2);
add(p1);
p2.setLayout(new GridLayout(2,3,5,1));
p2.add(L5);
p2.add(L6);
p2.add(L7);
p2.add(S1);
p2.add(S2);
p2.add(S3);
add(p2);
p3.setLayout(new BorderLayout());
p3.add("North",p1);
p3.add("South",p2);
add(p3);
p4.setLayout(new BorderLayout(0,2));
p4.add("North",p3);
p4.add("South",B1);
add(p4);
}
public void actionPerformed(ActionEvent e){
word=T1.getText();
repaint();
}
public void adjustmentValueChanged(AdjustmentEvent e){
if(e.getSource()==S1)
R=S1.getValue();
if(e.getSource()==S2)
G=S2.getValue();
if( e.getSource()==S3)
B=S3.getValue();
// setForeground(new Color(R,G,B));
repaint();
}
public void paint(Graphics g) {
g.drawString("Vowels are displayed in RGB color of ("+R+","+G+","+B+").", 10,200);
Font font=new Font("Serif",Font.BOLD,17);
g.setFont(font);
g.setColor(new Color(R,G,B));
g.drawString(""+word, 8, 180 );
}
}
i need some help from here onnnnn.....
•
•
Join Date: Jan 2006
Posts: 7
Reputation:
Solved Threads: 0
/**
* @(#)VowelAnalyzer.java
*
* Sample Applet application
*
* @author
* @version 1.00 06/01/13
*/
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class VowelAnalyzer extends Applet implements ActionListener,AdjustmentListener {
Label L1,L2,L3,L4,L5,L6,L7;
Button B1;
Panel p=new Panel();
Panel p1=new Panel();
Panel p2=new Panel();
Panel p3=new Panel();
Panel p4=new Panel();
TextField T1;
int R=0,G=0,B=0,size;
Scrollbar S1,S2,S3;
String word="";
public void init() {
L1=new Label(" INPUT TEXT:");
L3=new Label(" ");
L4=new Label(" ");
L2=new Label(" COLOR OF VOWELS:");
L5=new Label(" Red");
L6=new Label(" Green");
L7=new Label(" Blue");
T1=new TextField(30);
B1=new Button("Submit");
B1.addActionListener (this);
S1=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
add(S1);
S1.addAdjustmentListener(this);
S2=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
add(S2);
S2.addAdjustmentListener(this);
S3=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
add(S3);
S3.addAdjustmentListener(this);
p.setLayout(new BorderLayout());
p.add("East",L4);
p.add("Center",L1);
p.add("West",L3);
p.add("South",T1);
add(p);
p1.setLayout(new BorderLayout());
p1.add("North",p);
p1.add("South",L2);
add(p1);
p2.setLayout(new GridLayout(2,3,5,1));
p2.add(L5);
p2.add(L6);
p2.add(L7);
p2.add(S1);
p2.add(S2);
p2.add(S3);
add(p2);
p3.setLayout(new BorderLayout());
p3.add("North",p1);
p3.add("South",p2);
add(p3);
p4.setLayout(new BorderLayout(0,2));
p4.add("North",p3);
p4.add("South",B1);
add(p4);
}
public void actionPerformed(ActionEvent e){
word=T1.getText();
size= word.length();
repaint();
}
public void adjustmentValueChanged(AdjustmentEvent e){
if(e.getSource()==S1)
R=S1.getValue();
if(e.getSource()==S2)
G=S2.getValue();
if( e.getSource()==S3)
B=S3.getValue();
// setForeground(new Color(R,G,B));
repaint();
}
public void paint(Graphics g) {
int pos=0;
int aCount = 0,eCount = 0,iCount = 0,oCount = 0,uCount = 0;
while(pos<size){
switch (word.charAt(pos))
{
case 'a': case 'A':
++aCount;g.setColor(new Color(R,G,B)); break;
case 'e': case 'E':
++eCount;g.setColor(new Color(R,G,B)); break;
case 'i': case 'I':
++iCount;g.setColor(new Color(R,G,B)); break;
case 'o': case 'O':
++oCount;g.setColor(new Color(R,G,B)); break;
case 'u': case 'U':
++uCount;g.setColor(new Color(R,G,B)); break;
}
++pos;
}
g.setColor(new Color(0,0,0)) ;
g.drawString(" A = "+aCount, 8,220);
g.drawString(" E = "+eCount, 8, 240 );
g.drawString(" I = "+iCount, 8, 260 );
g.drawString(" O = "+oCount, 8, 280 );
g.drawString(" U = "+uCount, 8, 300 );
g.drawString("Vowels are displayed in RGB color of ("+R+","+G+","+B+").", 10,200);
Font font=new Font("Serif",Font.BOLD,17);
g.setFont(font);
// g.setColor(new Color(R,G,B));
g.drawString(""+word, 8, 180 );
}
}
this is what i did..but not working..i just want only my vowels 2 change color when i change ma scrollbar
* @(#)VowelAnalyzer.java
*
* Sample Applet application
*
* @author
* @version 1.00 06/01/13
*/
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class VowelAnalyzer extends Applet implements ActionListener,AdjustmentListener {
Label L1,L2,L3,L4,L5,L6,L7;
Button B1;
Panel p=new Panel();
Panel p1=new Panel();
Panel p2=new Panel();
Panel p3=new Panel();
Panel p4=new Panel();
TextField T1;
int R=0,G=0,B=0,size;
Scrollbar S1,S2,S3;
String word="";
public void init() {
L1=new Label(" INPUT TEXT:");
L3=new Label(" ");
L4=new Label(" ");
L2=new Label(" COLOR OF VOWELS:");
L5=new Label(" Red");
L6=new Label(" Green");
L7=new Label(" Blue");
T1=new TextField(30);
B1=new Button("Submit");
B1.addActionListener (this);
S1=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
add(S1);
S1.addAdjustmentListener(this);
S2=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
add(S2);
S2.addAdjustmentListener(this);
S3=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);
add(S3);
S3.addAdjustmentListener(this);
p.setLayout(new BorderLayout());
p.add("East",L4);
p.add("Center",L1);
p.add("West",L3);
p.add("South",T1);
add(p);
p1.setLayout(new BorderLayout());
p1.add("North",p);
p1.add("South",L2);
add(p1);
p2.setLayout(new GridLayout(2,3,5,1));
p2.add(L5);
p2.add(L6);
p2.add(L7);
p2.add(S1);
p2.add(S2);
p2.add(S3);
add(p2);
p3.setLayout(new BorderLayout());
p3.add("North",p1);
p3.add("South",p2);
add(p3);
p4.setLayout(new BorderLayout(0,2));
p4.add("North",p3);
p4.add("South",B1);
add(p4);
}
public void actionPerformed(ActionEvent e){
word=T1.getText();
size= word.length();
repaint();
}
public void adjustmentValueChanged(AdjustmentEvent e){
if(e.getSource()==S1)
R=S1.getValue();
if(e.getSource()==S2)
G=S2.getValue();
if( e.getSource()==S3)
B=S3.getValue();
// setForeground(new Color(R,G,B));
repaint();
}
public void paint(Graphics g) {
int pos=0;
int aCount = 0,eCount = 0,iCount = 0,oCount = 0,uCount = 0;
while(pos<size){
switch (word.charAt(pos))
{
case 'a': case 'A':
++aCount;g.setColor(new Color(R,G,B)); break;
case 'e': case 'E':
++eCount;g.setColor(new Color(R,G,B)); break;
case 'i': case 'I':
++iCount;g.setColor(new Color(R,G,B)); break;
case 'o': case 'O':
++oCount;g.setColor(new Color(R,G,B)); break;
case 'u': case 'U':
++uCount;g.setColor(new Color(R,G,B)); break;
}
++pos;
}
g.setColor(new Color(0,0,0)) ;
g.drawString(" A = "+aCount, 8,220);
g.drawString(" E = "+eCount, 8, 240 );
g.drawString(" I = "+iCount, 8, 260 );
g.drawString(" O = "+oCount, 8, 280 );
g.drawString(" U = "+uCount, 8, 300 );
g.drawString("Vowels are displayed in RGB color of ("+R+","+G+","+B+").", 10,200);
Font font=new Font("Serif",Font.BOLD,17);
g.setFont(font);
// g.setColor(new Color(R,G,B));
g.drawString(""+word, 8, 180 );
}
}
this is what i did..but not working..i just want only my vowels 2 change color when i change ma scrollbar
•
•
•
•
Originally Posted by jwenting
no, I'm not going to help you asap. I MIGHT help you if you ask nicely in a year or so.
Try this.
Java Syntax (Toggle Plain Text)
class isYou { public static void main(String[] args) { String thwee = "iamthwee"; char[] what = thwee.toCharArray(); for(int dex=0; dex<what.length; dex++) { System.out.print(what[dex]); System.out.println("\n"); } } }
*Voted best profile in the world*
![]() |
Other Threads in the Java Forum
- Previous Thread: first project in netbeans
- Next Thread: hi,urgent
| Thread Tools | Search this Thread |
Tag cloud for Java
addressbook android api apple applet application arguments array arrays automation awt binary bluetooth button calculator chat class classes client code columns component converter database draw eclipse error errors event exception file fractal ftp game givemetehcodez graphics gridlayout gui helpwithhomework html ide image inetaddress input integer invokingapacheantprogrammatically j2me java javaprojects jme jmf jni jpanel julia link linux list loop map method methods midlethttpconnection mobile netbeans newbie number object objects openjavafx oracle php print problem program programming project projects recursion rim scanner screen server set signing size smart sms socket sort sql storm string support swing test threads time tree webservices windows







hey any one know how to convert a string in to char...