Can someone check this code?
What I am trying to achieve is an "active" button state. I
have six buttons. When one is clicked, i need it to change to a
color which denotes that it is the active button.
someone provided me with this code, but I can't seem to get
it to work. I followed the directions precisely.
The directions were as follows:
One thing I think you could do is create another invisible
layer of buttons above all your other buttons. You could make them
all invisible, unless a button is clicked.
Let's say your original layer of buttons is called a_but,
b_but, and c_but.
Then you could have another invisible layer of buttons called
invA_but, invB_but, and invC_but. This layer of buttons would each
be the color you want displayed while the button is selected. The
code would look something like-
invA_but._visible=false;
invB_but._visible=false;
invC_but._visible=false;
a_but.onRelease=function(){
invA_but._visible=true;
invB_but._visible=false;
invB_but._visible=false;
b_but.onRelease=function(){
invA_but._visible=false;
invB_but._visible=true;
invC_but._visible=false;
c_but.onRelease=function(){
invA_but._visible=false;
invB_but._visible=false;
invC_but._visible=true
invA_but, invB_but, and invC_but refer to instance names for
your buttons, not layer names as suggested in the description. It
should work if you have the instance names for the buttons right. I
would probably add code to make the nomal state invisible instead
of just having the active button covering the inactive one. EX:
a_but.onRelease=function(){
invA_but._visible=true; //show the buttons active state
a_but._visible = false; //hide the off state of the button
invB_but._visible=false; //hides the active state of button b
invC_but._visible=false; //hides the active state of button c
Similar Messages
-
HI,
CAN SOMEONE EXPLAIN TO ME THIS CODE:
FUNCTION DISP_QATD return VARCHAR2 is
BEGIN
SRW.REFERENCE(:P_CURRENCY_CODE);
SRW.REFERENCE(:P_QATD1);
SRW.USER_EXIT('FND FORMAT_CURRENCY
CODE = ":P_CURRENCY_CODE"
DISPLAY_WIDTH = "19"
AMOUNT = ":P_QATD1"
DISPLAY = ":DISP_QATD"
PRECISION = "STANDARD"');
RETURN(:DISP_QATD);
END;Hello,
For details about SRW.REFERENCE :
http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/plsql/builtins/srw/srw_reference.htm?tp=true
Regards -
Hi Everyone,
I'm just wondering if these two classes Movie and Viewer and the Application class look right for what I've done so far for the following problem. Any comments are greatly appreciated.
Also, using if statements, how am I going to check if the user is actually permitted to see the film and in what class will I put it in?
Using a class to represent each of the major entities involved and an application class which controls object and user interaction.
Write a program which implements a cinema entry system, according to the following rules:
Anyone can go to see a U rated film.
Only those aged 12 or over, or accompanied by an adult can go to see a PG rated film.
Only those aged 12 or over can go to see a 12s rated film.
Only those aged 15 or over can go to see a 15s rated film.
Only those aged 18 or over can go to see an 18s rated film.
Your program should present the user with the following list of film options:
(a) Blair Witch Project, 18s
(b) American Pie, 15s
(c) Lord of the Rings, 12s
(d) It?s a Wonderful Life, PG
(e) Aladdin, U
The program should ask the user what film they want to see, and then determine whether or not they are permitted to see the film. If they are not permitted, then
a list of the films they can see will be displayed.
Thanks,
A novice Java programmer
public class Movie
private final int EIGHTEEN = "18";
private final int FIFTEEN = "15";
private final int TWELVE = "12";
private final String PG = "PG";
private final String U = "U";
private String title; //title of the movie
private String rating; //rating of the movie
private Boolean isAcompaniedByAdult; //if viewer is accompanied by an adult
public Movie (String t, String r)
title = t;
rating = r;
//Method to get the title of the movie
public String getTitle()
return title;
//Method to set the title of the movie
public void setTiltle(String t)
title = t;
//Method to get the rating of the movie
public String getRating()
return rating;
//Method to set the rating of the movie
public void setRating(String r)
rating = r;
public class Viewer
//age of the viewer
private int age;
private boolean isWithAdult;
public Viewer (int a, boolean w)
age = a;
isWithAdult = w;
//Method to get the age of the viewer
public int getAge()
return age;
//Method to set the age of the viewer
public void setAge(int a)
age = a;
//Method for if the viewer is with an adult
public boolean isWithAdult(Viewer v1)
if (isWithAdult(v1))
return true;
else
return false;
public class CinemaApp
public static void main(String [] args)
int Movie;
int Age;
Boolean isWithAdult;
System.out.println();
System.out.println("Welcome to the Cinema Entry Program");
System.out.println();
System.out.println("Movies Currently Available to View:");
System.out.println("1. Blair Witch Project, 18s");
System.out.println("2. American Pie, 15s");
System.out.println("3. Lord of the Rings, 12s");
System.out.println("4. It's a Wonderful Life, PG");
System.out.println("5. Aladdin, U");
System.out.println();
do
Movie = Input.readInt("Please enter the number which corresponds to the movie you wish to view: ");
while ((Movie<1) || (Movie>12));
if (Movie == 1)
Movie m1 = new Movie("Blair Witch Project","18s");
else if (Movie == 2)
Movie m1 = new Movie("American Pie","15s");
else if (Movie == 3)
Movie m1 = new Movie("Lord of the Rings","12s");
else if (Movie == 4)
Movie m1 = new Movie("It's a Wonderful Life","PG");
else if (Movie == 5)
Movie m1 = new Movie("Aladdin","U");
Viewer v1 = new Viewer(Input.readInt("Please enter your age: "), Input.readBoolean("Are you acompanied by an adult? (y/n): "));There are a few things I don't quite understand. I'd love to explain!
Why would you declare and initialise the ratings in the
movie class if your using them in the viewer class.First, a little clarification: those ratings are static final variables. This means that, no matter how many instances of Movie you make, there is only one set of those ratings. If you've ever used enumerations in C++, it's a way of simulating those. In effect, it makes the logic easier and more efficient. Basically, NEVER refer to a rating by it's int value (don't use "1" instead of "RATED_U"). Anytime you want to refer to the rating 15s, always use Movie.RATED_18S.
Why did I put them in the Movie class? Because the rating is a property of a Movie, not a Viewer. Thus, the rating should be kept in the Movie class.
Basically, look at my suggestions as a lesson in some principles of Object Oriented design. You don't want to make the rating a String, because of the following case:
Using this as the variable declaration for the ratings:
private final String U = "U";
//etc...What if someone tried to assign "R" as the rating for a movie? They would be able to, because there are no control structures on what a String can be. If you use static final variables, however, they're given a set list of values they can assign as a rating.
This methodology is used commonly in the Java APIs (for example, MimeMessage.RecipientType.TO). It's a good practice, and in this program, it would simplify the logic greatly.
Secondly, I don't understand this if(this.getAge()
= 12 || this.isWithAdult()), what is gt?
"this" refers to the current instance of the class. It's not actually necessary in this context. You could just as easily replace those lines with if(getAge() >=12 || isWithAdult())
ThanksAnytime! This stuff I've thrown at you isn't exactly basic programming... if it's still unclear, feel free to ask more questions. -
PKGBUILD for swiftfox: can someone check this for me?
I just finished my first PKGBUILD, one for swiftfox. Its pre-compiled, so essentially I just dumped all the contents of a tarball into a directory in /opt. If you guys could check it out before I submit it to the aur, I'd really appreciate it.
pkgname=swiftfox
pkgver=1.5.0.3
pkgrel=1
_pkgarch=athlon-xp
pkgdesc="Swiftfox is a prebuilt version of Firefox,optimized for AMD AthlonXP processors"
url="http://www.getswiftfox.com"
license="MPL"
depends=(gtk2 libidl2 mozilla-common nss desktop-file-utils)
makedepends=()
conflicts=()
replaces=()
backup=()
install=('swiftfox.install')
source=(http://www.getswiftfox.com/builds/releases/$pkgname-$pkgver-$_pkgarch.tar.bz2)
md5sums=('d3b810d27f655c4908bcd4c7730d9427')
build() {
cd $startdir/src/
mkdir $startdir/pkg/opt/
cp -r $pkgname $startdir/pkg/opt/$pkgname
and here is the swiftfox.install file
# arg 1: the new package version
pre_install() {
/bin/true
# arg 1: the new package version
post_install() {
ln -s /opt/swiftfox/swiftfox /usr/bin/swiftfox
/bin/true
# arg 1: the new package version
# arg 2: the old package version
pre_upgrade() {
/bin/true
# arg 1: the new package version
# arg 2: the old package version
post_upgrade() {
/bin/true
# arg 1: the old package version
pre_remove() {
/bin/true
# arg 1: the old package version
post_remove() {
rm /usr/bin/swiftfox
/bin/true
op=$1
shift
$op $*
Edit1: added dependenciesAllright, you do have a point about having something in the title, so I've added that, and I've also added to the description. Unless there are any more suggestions, I'll put this into the aur tonight.
pkgname=swiftfox-amd
_pkgname=swiftfox
pkgver=1.5.0.3
pkgrel=1
_pkgarch=athlon-xp
pkgdesc="Swiftfox is a prebuilt version of Firefox,optimized for AMD AthlonXP processors. To install the build for a different architecture, go to getswiftfox.com, find the name they use for your processor, and replace the _pkgarch variable."
url="http://www.getswiftfox.com"
license="MPL"
depends=(gconf libgnomecanvas nss mozilla-common desktop-file-utils libidl2)
makedepends=()
conflicts=()
replaces=()
backup=()
install=
source=(http://www.getswiftfox.com/builds/releases/$_pkgname-$pkgver-$_pkgarch.tar.bz2)
md5sums=('d3b810d27f655c4908bcd4c7730d9427')
build() {
cd $startdir/src/
mkdir $startdir/pkg/opt/
cp -r $_pkgname $startdir/pkg/opt/$_pkgname
mkdir -p $startdir/pkg/usr/bin
ln -s /opt/$_pkgname/$_pkgname $startdir/pkg/usr/bin/$_pkgname -
Can soemone explain this code to me
can someone explain this code to me
import javax.swing.*;
import BreezySwing.*;
import java.util.Random;
public class PennyPinch extends GBFrame
private JButton enterButton;
private JTextArea outputArea;
private int[][] board = {{1,1,1,1,1},{1,2,2,2,1},{1,2,3,2,1},{1,2,2,2,1},{1,1,1,1,1}};
private boolean[][] landing = new boolean[5][5];
private int total;
public PennyPinch()
enterButton = addButton ("Pitch",2,1,1,1);
outputArea = addTextArea("",4,1,3,4);
public void pitch()
Random generator = new Random();
int randomRow = generator.nextInt(5);
int randomColumn = generator.nextInt(5);
total += board[randomRow][randomColumn];
landing[randomRow][randomColumn] = true;
public void buttonClicked (JButton buttonObj)
pitch();
displayList(board, outputArea);
private void displayList(int a[][], JTextArea output)
output.setText("");
for (int row = 0; row < 5; row++)
for (int col = 0; col < 5; col++){
if(landing[row][col] ==true)
output.append(Format.justify('r',"P", 3) + " ");
if (col == 4)
output.append("\n");
else
output.append(Format.justify('r', a[row][col], 3) + " ");
if (col == 4)
output.append("\n"); }
output.append("the total is " + total);
public static void main (String[] args)
PennyPinch theGUI = new PennyPinch();
theGUI.setSize (300, 300);
theGUI.setVisible(true);
}Knowing toilets or studying under George?What kind pervert are you?
What is written in public toilets o/c!Ah yes I see, I found example questions.
2:3.4 please complete the following well known saying
by filling in the blank
Whilst you are reading what I put
You are blank on your foot
2:3.5 Upon seeing the announcement 'Toilet
tennis' and following the instruction ' please
see other wall for details' what is the standard
message on the other wall.2:3.4. is the correct answer 'micturating' ?
2:3.5. I believe the answer is Ibidem. -
Cffunction and how to ? can someone explain the code to me line by line
Hello i went to get this online and i want to test it.
the udf is supposed to
* CSVFormat accepts the name of an existing query and
converts it to csv format.
* Updated version of UDF orig. written by Simon Horwith
my question how to break it down.
can someone explain the code to me line by line
thankssilviasalsa wrote:
> thanks
>
> but line by line
>
> what is
> if(ArrayLen(Arguments) GTE 2) qualifier = Arguments[2];
> if(ArrayLen(Arguments) GTE 3 AND Len(Arguments[3]))
columns = Arguments[3];
> returnValue[1] = ListQualify(columns, qualifier);
> ArrayResize(returnValue, query.recordcount + 1);
> columns = ListToArray(columns);
> for(i = 1; i LTE query.recordcount; i = i + 1)
> {
> rowValue = ArrayNew(1);
> ArrayResize(rowValue, ArrayLen(columns));
> for(j = 1; j LTE ArrayLen(columns); j = j + 1)
> rowValue[j] = qualifier & query[columns[j]]
& qualifier;
> returnValue[i + 1] = ArrayToList(rowValue);
> }
> returnValue = ArrayToList(returnValue, Chr(13));
> return returnValue;
> }
>
> thanks
Apparently this UDF takes two optional parameters so that one
can define
(A) a text "qualifier" to use in the CSV file, this is
usually the
single quote|tick ['] mark - but sometimes one wants this to
be a
different character and (B) what columns to use in the
output in case
one does not want to use all the columns in the record set
in the
outputted CSV file.
The if statements are checking for these optional parameters
and if
found setting the values in them to internal variables.
These
variables are then used in the rest of the logic to create
the CSV output.
HTH
Ian -
Can someone execute this program?
Can someone execute this program for me and tell me if it works correctly? My DOS is acting funny.
look for these things:
- accepts input from keyboard and places them into an array
- continues to accept names until a blank name is entered
- array can contain up to 15 names
- after all names are entered, it displays the contents of the array
and writes them to a file
- output should be in 2 columns
if you see a problem, please tell me how to fix it.
import java.io.*;
* the purpose of this program is to read data from the keyboard
* and put it into a sequential file for processing by ReadFile
* @author Maya Crawford
public class Lab0
* this function will prompt and receive data from the keyboard
* @return String containing the data read from the keyboard
* @param BufferedReader that is connected to System.in
*/ (keyboard)
public static String getData(BufferedReader infile)
throws IOException
System.out.println("enter a name");
return infile.readLine();
* this is the main program which will read from the keyboard and
* display the given input onto the screen and also write the data
* to a file
* @param Array of Strings (not used in this program)
public static void main(String[] args)
throws IOException
int i;
String[] outString = new String[16];
DataOutputStream output=null;
// this code assigns the standard input to a datastream
BufferedReader input= new BufferedReader(new InputStreamReader(System.in));
// this code opens the output file...
try
output= new DataOutputStream(new FileOutputStream("javaapp.dat"));
// handle any open errors
catch (IOException e)
System.err.println("Error in opening output file\n"
+ e.toString());
System.exit(1);
// priming read......
for(i=0;i<outString.length;i++)
outString=getData(input);
// this is the loop to continue while nnonblank data is entered
while (!outString.equals(""))
for(i=0;i<outString.length;i++)
outString[i]=getData(input);
outString[i] = input.readLine();
System.out.println("Name entered was:"+ outString[i]);
output.writeBytes(outString[i]+"\r\n");
int rcol=(outString.length+1)/2;
for(i=0;i<(outString.length)/2;i++)
System.out.println(outString[i]+"\t"+outString[rcol++]);
// flush buffers and close file...
try
output.flush();
output.close();
catch (IOException e)
System.err.println("Error in closing output file\n"
+ e.toString());
// say goodnight Gracie...
System.out.println("all done");Ok, here is what I came up with. I commented most of what I changed and gave a reason for changing it. My changes aren't perfect and it still needs to be tweeked. When you run the program you have to hit the enter key every time once before you type a name. When you are done typing names hit the enter key twice and it will output the names entered into the array. Like I said, it isn't perfect, and that part you will need to fix.
import java.io.*;
* the purpose of this program is to read data from the keyboard
* and put it into a sequential file for processing by ReadFile
* @author Maya Crawford
public class Lab0
* this function will prompt and receive data from the keyboard
* @return String containing the data read from the keyboard
* @param BufferedReader that is connected to System.in
*/ //(keyboard)
//On the above line where you have (keyboard), it wasn't commented out in your
//program and it was throwing a error.
public static String getData(BufferedReader infile)
throws IOException
System.out.println("enter a name");
return infile.readLine();
* this is the main program which will read from the keyboard and
* display the given input onto the screen and also write the data
* to a file
* @param Array of Strings (not used in this program)
public static void main(String[] args)
throws IOException
int i;
String testString; // Created to hold the string entered by the user, because your
// outString array wasn't working for that.
String[] outString = new String[16];
DataOutputStream output=null;
// this code assigns the standard input to a datastream
BufferedReader input= new BufferedReader(new InputStreamReader(System.in));
// this code opens the output file...
try
output= new DataOutputStream(new FileOutputStream("javaapp.dat"));
// handle any open errors
catch (IOException e)
System.err.println("Error in opening output file\n"
+ e.toString());
System.exit(1);
// priming read......
testString = " "; // Initialize testString
int placeMark = 0; // to input the String entered by the user into the outString
// array, it needs to know which position to enter it into.
while (!testString.equals(""))
testString=getData(input);
testString = input.readLine();
System.out.println("Name entered was:"+ testString);
// Put the testString into the outString[] array.
// A lot of the time when you used outString you forgot to use the [x] to indicate
// which position you wanted to access.
outString[placeMark] = testString;
output.writeBytes(testString+"\r\n");
placeMark++;
// Created a do/while loop to display the list of outString.
int nextEntry = 0;
do
System.out.println(outString[nextEntry]);
nextEntry++;
}while(!outString[nextEntry].equals(""));
// flush buffers and close file...
try
output.flush();
output.close();
catch (IOException e)
System.err.println("Error in closing output file\n"
+ e.toString());
// say goodnight Gracie...
System.out.println("all done");
} -
I am updating iphoto 9.1 to 9.3 and every time when I clicked for update aps store asked to open it in the account where you purchased. I am using the same account and its available in the purchased item of this account. But in my purchased item library it indicates that you update iPhoto. I am not sure which account the aps store asking. Can someone resolve this problem.
Contact App Store support. They're the folks who can help with Account issues.
Regards
TD -
Can anybody help me to build an interface that can work with this code
please help me to build an interface that can work with this code
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
public class Translate
public static void main(String [] args) throws IOException
if (args.length != 2)
System.err.println("usage: Translate wordmapfile textfile");
System.exit(1);
try
HashMap words = ReadHashMapFromFile(args[0]);
System.out.println(ProcessFile(words, args[1]));
catch (Exception e)
e.printStackTrace();
// static helper methods
* Reads a file into a HashMap. The file should contain lines of the format
* "key\tvalue\n"
* @returns a hashmap of the given file
@SuppressWarnings("unchecked")
private static HashMap ReadHashMapFromFile(String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
HashMap map = null;
try
in = new BufferedReader(new FileReader(filename));
String line;
map = new HashMap();
while ((line = in.readLine()) != null)
String[] fields = line.split("
t", 2);
if (fields.length != 2) continue; //just ignore "invalid" lines
map.put(fields[0], fields[1]);
finally
if(in!=null) in.close(); //may throw IOException
return(map); //returning a reference to local variable is safe in java (unlike C/C++)
* Process the given file
* @returns String contains the whole file.
private static String ProcessFile(Map words, String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
StringBuffer out = null;
try
in = new BufferedReader(new FileReader(filename));
out = new StringBuffer();
String line = null;
while( (line=in.readLine()) != null )
out.append(SearchAndReplaceWordsInText(words, line)+"\n");
finally
if(in!=null) in.close(); //may throw IOException
return out.toString();
* Replaces all occurrences in text of each key in words with it's value.
* @returns String
private static String SearchAndReplaceWordsInText(Map words, String text)
Iterator it = words.keySet().iterator();
while( it.hasNext() )
String key = (String)it.next();
text = text.replaceAll("\\b"key"
b", (String)words.get(key));
return text;
* @returns: s with the first letter capitalized
String capitalize(String s)
return s.substring(0,0).toUpperCase() + s.substring(1);
}... here's the head of my pirate_words_map.txt
hello ahoy
hi yo-ho-ho
pardon me avast
excuse me arrr
yes aye
my me
friend me bucko
sir matey
madam proud beauty
miss comely wench
where whar
is be
are be
am be
the th'
you ye
your yer
tell be tellin'please help me i don t know how to go about this.my teacher ask me to build an interface that work with the code .
Here is the interface i just build
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.awt.*;
import javax.swing.*;
public class boy extends JFrame
JTextArea englishtxt;
JLabel head,privatetxtwords;
JButton translateengtoprivatewords;
Container c1;
public boy()
super("HAKIMADE");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBackground(Color.white);
setLocationRelativeTo(null);
c1 = getContentPane();
head = new JLabel(" English to private talk Translator");
englishtxt = new JTextArea("Type your text here", 10,50);
translateengtoprivatewords = new JButton("Translate");
privatetxtwords = new JLabel();
JPanel headlabel = new JPanel();
headlabel.setLayout(new FlowLayout(FlowLayout.CENTER));
headlabel.add(head);
JPanel englishtxtpanel = new JPanel();
englishtxtpanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,40));
englishtxtpanel.add(englishtxt);
JPanel panel1 = new JPanel();
panel1.setLayout(new BorderLayout());
panel1.add(headlabel,BorderLayout.NORTH);
panel1.add(englishtxtpanel,BorderLayout.CENTER);
JPanel translateengtoprivatewordspanel = new JPanel();
translateengtoprivatewordspanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,40));
translateengtoprivatewordspanel.add(translateengtoprivatewords);
JPanel panel2 = new JPanel();
panel2.setLayout(new BorderLayout());
panel2.add(translateengtoprivatewordspanel,BorderLayout.NORTH);
panel2.add(privatetxtwords,BorderLayout.CENTER);
JPanel mainpanel = new JPanel();
mainpanel.setLayout(new BorderLayout());
mainpanel.add(panel1,BorderLayout.NORTH);
mainpanel.add(panel2,BorderLayout.CENTER);
c1.add(panel1, BorderLayout.NORTH);
c1.add(panel2);
public static void main(final String args[])
boy mp = new boy();
mp.setVisible(true);
}..............here is the code,please make this interface work with the code
public class Translate
public static void main(String [] args) throws IOException
if (args.length != 2)
System.err.println("usage: Translate wordmapfile textfile");
System.exit(1);
try
HashMap words = ReadHashMapFromFile(args[0]);
System.out.println(ProcessFile(words, args[1]));
catch (Exception e)
e.printStackTrace();
// static helper methods
* Reads a file into a HashMap. The file should contain lines of the format
* "key\tvalue\n"
* @returns a hashmap of the given file
@SuppressWarnings("unchecked")
private static HashMap ReadHashMapFromFile(String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
HashMap map = null;
try
in = new BufferedReader(new FileReader(filename));
String line;
map = new HashMap();
while ((line = in.readLine()) != null)
String[] fields = line.split("
t", 2);
if (fields.length != 2) continue; //just ignore "invalid" lines
map.put(fields[0], fields[1]);
finally
if(in!=null) in.close(); //may throw IOException
return(map); //returning a reference to local variable is safe in java (unlike C/C++)
* Process the given file
* @returns String contains the whole file.
private static String ProcessFile(Map words, String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
StringBuffer out = null;
try
in = new BufferedReader(new FileReader(filename));
out = new StringBuffer();
String line = null;
while( (line=in.readLine()) != null )
out.append(SearchAndReplaceWordsInText(words, line)+"\n");
finally
if(in!=null) in.close(); //may throw IOException
return out.toString();
* Replaces all occurrences in text of each key in words with it's value.
* @returns String
private static String SearchAndReplaceWordsInText(Map words, String text)
Iterator it = words.keySet().iterator();
while( it.hasNext() )
String key = (String)it.next();
text = text.replaceAll("\\b"key"
b", (String)words.get(key));
return text;
* @returns: s with the first letter capitalized
String capitalize(String s)
return s.substring(0,0).toUpperCase() + s.substring(1);
}... here's the head of my pirate_words_map.txt
hello ahoy
hi yo-ho-ho
pardon me avast
excuse me arrr
yes aye
my me
friend me bucko
sir matey
madam proud beauty
miss comely wench
where whar
is be
are be
am be
the th'
you ye
your yer
tell be tellin' -
hi can someone keep this simple for me! my iPhone is due for a renewal. but my old laptop that it is backed up to no longer works! how do i go about saving all my songs pics etc to a new laptop without losing anything? please help!!!
Syncing to a "New" Computer or replacing a "crashed" Hard Drive
-
Can someone explain the code for having the Accordion panels closed?
I located the answer to my own question (how to get all the accordion panels to remain closed when the browser opens) but I still don't understand the answer. Can someone explain this?
This feature is only supported when using variable height panels, so you must pass a false into the Accordion's constructor for the "useFixedPanelHeights" constructor options, and a -1 for the "defaultPanel" option:
<script type="test/javascript">
var acc1 = new Spry.Widget.Accordion ("Acc1", { useFixPanelHeights: false, defaultPanel: -1});
</script>
AngelaGPDMTR25 wrote:
I located the answer to my own question (how to get all the accordion panels to remain closed when the browser opens) but I still don't understand the answer. Can someone explain this?
This feature is only supported when using variable height panels, so you must pass a false into the Accordion's constructor for the "useFixedPanelHeights" constructor options, and a -1 for the "defaultPanel" option:
<script type="test/javascript">
var acc1 = new Spry.Widget.Accordion ("Acc1", { useFixPanelHeights: false, defaultPanel: -1});
</script>
Angela
Hi Angela,
You are right, the only way it will work is by setting the fixed height to false. As for the for the default panel option, -1 is not a panel and if you had 3 panels we could have used the number 3 (panel1 = 0) or 99 or whatever as long as there is no panel with that number. If we had used the number 1 for instance, then the 2nd panel would be opened by default.
Hope this helps.
Ben -
How can i run this code correctly?
hello, everybody:
when i run the code, i found that it dons't work,so ,i hope somebody can help me!
the Ball class is this :
package {
import flash.display.Sprite;
[SWF(width = "550", height = "400")]
public class Ball extends Sprite {
private var radius:Number;
private var color:uint;
private var vx:Number;
private var vy:Number;
public function Ball(radius:Number=40, color:uint=0xff9900,
vx:Number =0, vy:Number =0) {
this.radius= radius;
this.color = color;
this.vx = vx;
this.vy = vy;
init();
private function init():void {
graphics.beginFill(color);
graphics.drawCircle(0,0,radius);
graphics.endFill();
and the Chain class code is :
package {
import flash.display.Sprite;
import flash.events.Event;
[SWF(width = "550", height = "400")]
public class Chain extends Sprite {
private var ball0:Ball;
private var ball1:Ball;
private var ball2:Ball;
private var spring:Number = 0.1;
private var friction:Number = 0.8;
private var gravity:Number = 5;
//private var vx:Number =0;
//private var vy:Number = 0;
public function Chain() {
init();
public function init():void {
ball0 = new Ball(20);
addChild(ball0);
ball1 = new Ball(20);
addChild(ball1);
ball2 = new Ball(20);
addChild(ball2);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
private function onEnterFrame(event:Event):void {
moveBall(ball0, mouseX, mouseY);
moveBall(ball1, ball0.x, ball0.y);
moveBall(ball2, ball1.x, ball1.y);
graphics.clear();
graphics.lineStyle(1);
graphics.moveTo(mouseX, mouseY);
graphics.lineTo(ball0.x, ball0.y);
graphics.lineTo(ball1.x, ball1.y);
graphics.lineTo(ball2.x, ball2.y);
private function moveBall(ball:Ball,
targetX:Number,
targetY:Number):void {
ball.vx += (targetX - ball.x) * spring;
ball.vy += (targetY - ball.y) * spring;
ball.vy += gravity;
ball.vx *= friction;
ball.vy *= friction;
ball.x += vx;
ball.y += vy;
thanks every body's help!ok, thanks for your reply ! I run this code in the Flex builder 3!and the Ball class and the Chain class are all in the same AS project!
and i changed the ball.pv property as public in the Ball class, and the Chain class has no wrong syntactic analysis,but the AS code don't run.so this is the problem.
2010-04-21
Fang
发件人: Ned Murphy <[email protected]>
发送时间: 2010-04-20 23:01
主 题: how can i run this code correctly?
收件人: fang alvin <[email protected]>
I don't see that the Ball class has a pv property, or that you even try to access a pv property in the Chain class. All of the properties in your Ball class are declared as private, so you probably cannot access them directly. They would need to be public. Also, I still don't see where you import Ball in the chain class such that it can use it. -
Can someone perform this speaker test for me please
Hi can someone perform this test for please, play some ipod music through your phone and and cover 1 speaker at a time with you finger, does 1 block out the music as if one speaker is much louder than the other ? just I have tried this on my new iphone 4 as thought it might be a problem but my 3GS is doing it to ??, is it fault or meant to be like that
There's only one speaker.
http://manuals.info.apple.com/enUS/iPhone_iOS4_UserGuide.pdf -
Multithreading - Can someone explain this ...
Hi Java Gurus:
Can someone explain this to me why my multithreading worked in once case and not in the other.
First a little background:
My application lets the user create multiple JInternalFrames. Each frame has an OK button. When the user presses the OK button, the frame goes about it's business in a new thread, thus returning control to the use, so he/she can press the OK button on the second frame .. and so on.
Following is the event handler for the OK button that creates the new thread:
case1 - doesn't work:
btnTranslate.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent e ) {
txtOutput.setText("");
txtBadParts.setText("");
Translation trans = new Translation(inst);
trans.run();
);case2 - works:
btnTranslate.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent e ) {
txtOutput.setText("");
txtBadParts.setText("");
new Translation(inst).start();
);Thanks,
KamranCalling the run method makes the run method run in the current thread. You need to call the start method to get the thread to start its own thread.
-
How can i know how to redeem the code? how can i get this code?
how can i know how to redeem the code? how can i get this code? please i need you help
<Email Edited by Host>You are trying to create a new Apple ID? You don't have one yet? Is that correct?
If so, then see this article on how to creat your Apple ID - and make up a password for it. Remember to write it down immediately.
http://support.apple.com/en-us/HT203993
Maybe you are looking for
-
SAP MM -- error in MIGO & J1ia
The error is that the ( 1.) Excise Invoice of Vendor is not being captured in Migo. MIGO -- Excise Invoice (tab) ( 2.) When we compare the Document Status between the Quality Server & Production Server it is showing as u201CIn Processu201D & u201
-
Podcast episode "Release date" problem
on iTunes podcast screen some of "A state of trance" episodes shiw the release date is 1/1/2001 but when i choose "get info" it shows the correct date for some but for another episodes it is showing "1/1/1904"!!! please help how to solve this so it s
-
How to disable nouveau driver?
Hi I'm trying to install my nvidia graphics drivers, when I close x and run the installer it complains that I need to disable the nouveau driver and run the installer again. It tries to do this itself but it fails. Any idea how to manually disable it
-
HDMI sound problem - Toshiba Satellite L500D-149 (with ATI HD3200)
Hello, I'm fighting with my issue for two days but I'm not able to resolve that... Maybe you will able to help me... ...I bought HDMI cable to connect my laptop to TV. I've got the video but no sound. I tried to re-install drivers -audio and video- f
-
Has a solution been found to the current FaceTime issue?
Has a solution been found on the FaceTime issue?