Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help me out!

 
Mitchell Kave
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i wanna to accept a string, and display it in a arial font,bold style and size of 30.
how can i do that?i have tried so many times already as i new in java.pls help....guide me through this.ok
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mitchell,
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner!
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where do u want to display it?
a frame? an applet?
in a label?
 
Mitchell Kave
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,dirk
what do u wanna?i just wanna some help in it,what's wrong with my publicsy name? jst tell me,ok~ why i can't use my name?it's against the law or what!
 
Mitchell Kave
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,roy,
hi,i wanna to applet it in application,can i do it?but how? can u help me?
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mitchell-
The reason for our naming policy is to keep a professional air around the JavaRanch. You can find further discussion about the naming policy here. If you have any problems with it, you can discuss it there. If you don't feel comfortable using your real name, feel free to use a fake name -- just don't make it 'obviously fictitious' like "Bill Clinton" or "Ben Dover"
 
Pradyumna Hari
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mitchell,
Here is the code that shows how you can use your font to display. This is an applet.
Applet Code

HTML File Code

 
Mitchell Kave
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi pradyumna hari,
anyway,thanks for urs help,it's working correctly.
what i want is in a application?its will accept a string and change size and sytle of it.
is it possible to do that?
 
Mitchell Kave
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,prad hari,
i can't do it in application.for me,it seems to difficult for the first time.do u know how to do it?the code u gave me is correct but i want it in application that i can accept a string. anything from the string, "hello world or "other thing". on the way accepting it,it will changed to arial font,bold style and size of 30.
i have tried so many times already,
thanks for helping.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mitchell,
I like your display name.
Here's a basic outline for an application that does what you're trying to do. Note that nothing really different than what Pradyumna demonstrated is used:

Catching on?
Good Luck.
 
Mitchell Kave
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,dirk
thanks for it
i think i know how to make it done? but,one more thing,how to count each character that i have enter in a each? let say i have type "Hello".
it should have a function to calculate the character, As for "hello" 4 character.
how to do this one?i just doing my learning in java right now,need a lot help from here.
thanks!
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is a link to the java documentation. As a beginner you will soon realize that it is your best friend. How to find all the methods associated with the String class:
on the top left frame of the web page ( link provided above ), find the Package name that the String class belongs to --> java.lang. On the bottom left, the link to the String class should now be in the list of classes. Click on it and look under the method summary. The method you are looking for is there.
Jamie
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Big hint: it's the length method.
 
Mitchell Kave
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hei,dirk
i cannot find any length method to do with my question,can u help me with the length method?
plss....dirk
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mitchell,
Take a look at the links to the API documentation as Jamie has suggested and you will discover that String::length() can be used to determine the number of characters in a String.
For example, given some String called whatever, to determine how many characters are in whatever, your program might include this:Making sense?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic