peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Use actionListener on checkbox to see if any changes happends, if yes than change status from non-editable to editable and oposite

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I expect you have constractor for your book class something like this

public void Book1(String str1, String str2, String str3, int num)
{
   author = srt1;
   title = str2;
   status = str3;
   isbn = num;
}

some get methods

public String getAuthor() { return author;}
public String getTitle() { return title;}
public String getStatus() { return status;}
public int getIsbn() { return isbn;}

so you create method printMe for example

public void printMe( Book1 toPrint)
{
   System.out.println( toPrint.getAuthor() + " - " + toPrint.getTitle()
   + " - " + toPrint.getStatus() + " - " + toPrint.getIsbn() );
}

to call this method you just do this

toPrint(a);
   toPrint(b);
   toPrint(c);

Hope that is any help to you

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

you have to "hard code it" with use of array for example

String[] myArray={"zero", "one", two", "three"};
int num = 0;
System.out.println(myArray[num]);
num = 3;
System.out.println(myArray[num]);

first return will be string zero and second one will be three

Nahiyan commented: It didn't solve the problem +0
Salem commented: Useful hints +17
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

lol, no grandMaster, I'm studing and working with java only 3 years and still have lot to learn,
if somebody should be called GrandMaster here than jwenting is my choise

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

never had problem like this.
Did you check SAVE checkbox just next to password in advance/ remote settings ?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

no-argument constructor is your one

public Circle()
{
diameter = 30;
xPosition = 20;
yPosition = 60;
color = "blue";
isVisible = false;
}

constructor with argument is something like this dude

public Circle( int d, int x, int y, String str, boolean b)
{
diameter = d;
xPosition = x;
yPosition = y;
color = str;
isVisible = b;
}

you want to past values and not to set them default only... :mrgreen:

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

hi alll
(1):- i have make site thus this www.lia-ali0.tripod.com
i want to added background musc at this but i have not know the code of html:lol: any one tell me .

www.w3schools.com is good source of basic information for webdesign here
is direct link to topic on playing sonds in the browser, from basic bgsound to more complex objets. Also full documentation can be found on www.w3.org

(2):- i want to make a game just like as rasing game are action game what i do when i am not know about c++ and other lang .:rolleyes: any body tell me how do i .or some one send a sample of game write how he write .

You either have to know programing language (C/C++/JAVA) or know scripting language for Flash such as JavaScript or ActionScript or for Director there is also some sort of scripting language but I can't remember

(3):-any body send me this information i allways pray with best wishes. thx

No comment on last :mrgreen:

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

what are you talking about? is it a response that i need .

You asked for advice for topic on your final year project. I give you topics which refused seems to me. I don't know how the things where you come from are going but here in London university school year start in middle of September and end first or second week in June. 3rd year student (which include me), get they project supervisor in first week of October and throughout the year are having meeting with this person to talk about they project.

Im sorry you must be unmatured to say that.

Dear friend

does age of 29 seems to you unmatured? Not to me.

you should think before you join to this forum

Befor joining forum you should read rules which state "Do not flood the forum by posting the same question more than once (ie in multiple forums)." Link to rules is
here
You posted in 3 different forums this, JAVA and VB.Net ( one, in JAVA section, got deleted as been find as multiposting)

i think you don't understand the purpose of the forum.

Does it look like that I made 284 post for nothing?

And i know you know nothing.

How did you get that, you don't even know me, you don't know what I do, so please do not judge me
Hope you find some topic Mr.Perfect
Kind regards Peter

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

1. there is good example of vending machine in this(JAVA) section

2. if you have problem you don't post what shall I do, you provide code or problematic part of code with error message and we will try to help you

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

ahh this is already 3rd post with same topic from you abexander.
Final year project, hmm? What is dificult about it? Me in my final year, working on my final project for last 2 months think you are little late about it now.
There are so many things you can do. Do you have part-time job? Do you use there an application you don't like? Make your own one!
Your parents job. What they do? Do they use application which are confusing, hopeless? Build new one for them!
You have friends ask them. Do they need something, database to organise they CD's, DVD's, contacts?
What ever you do, it should not be base only on things you already learned at school, you should add it new dimention, new development techniques, new language

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I use Deitel edition, JAVA How to program, 6th edition, from basic application, to complex, components for basic graphic, work with MySQL, JAVA web base services and threads on the end, include also CD with all th ecodes and additional stuff

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
import java.util.*;
import java.text.DateFormat;

public class Cas
{
	public static void main(String[] agrs)
	{
		Calendar calendar = null;
		calendar = new GregorianCalendar();
		
		//Set date to 1st June 2008
		calendar.setTime(new Date(2008-1900, 5, 1));
		
		System.out.println("Integer of day in the week " + calendar.get(GregorianCalendar.DAY_OF_WEEK) );
		System.out.println("Month integer " + calendar.get(GregorianCalendar.MONTH));
		System.out.println("Last day in the month " + calendar.getActualMaximum(GregorianCalendar.DAY_OF_MONTH));
		System.out.println("Week of year " + calendar.get(GregorianCalendar.WEEK_OF_YEAR) );
	}
}

GregorianCalendar is answer to my troubles :cheesy:

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

sorry jwenting, you wrong in this point. Try to run that program and you will see. 1st January 2007 week number is 1, 31st May 2008(Sunday) is week number 22 and 1st June 2008(Monday) is week number 22

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Just have small program to practice with Calendar. However I come accross something unusual. Once you set date for 1st April 2007 or 1st June 2008 for example you get wrong number of the week.

example bellow show code set to date 1st June 2008

import java.util.*;
import java.text.DateFormat;

public class Cas
{
	public static void main(String[] agrs)
	{
		Calendar calendar = null;
		calendar = new GregorianCalendar();
		
		//Set date to 1st June 2008
		calendar.setTime(new Date(2008-1900, 5, 1));
		
		System.out.println("Integer of day in the week " + calendar.get(Calendar.DAY_OF_WEEK) );
		System.out.println("Month integer " + calendar.get(Calendar.MONTH));
		System.out.println("Last day in the month " + calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
		System.out.println("Week of year " + calendar.get(Calendar.WEEK_OF_YEAR) );
	}
}

output is

Integer of day in the week 1
Month integer 5
Last day in the month 30
Week of year [B]22[/B]

Week number should be 23

Any idea how to get around this problem?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

It took me some time to remember how to do it

On the end I saw the headlights of knowledge[IMG]http://www.msprotege.com:8080/smilies/yellowprotege5smiley.gif[/IMG]

javac beans/*.java :p

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I'm working on calendar application, similar to one provided with instalation of Tomcat. There you have class1 with methods which provide data for class 2. I have no problem to compile class1, but getting errors while compiling class2. This apply also to Tomcat examples if you try to recompile them.

cannot find symbol
symbol  : class Class1
location: class beans.Class2
        Class1 class1;

how do I get aroubd this? How shall I compile them?

Sorry for poor naming, in hurry to do more work

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You can do proper dice game, such as Yum or similar, not just simple dice roling till same numbers occure. That is too simple and pointless. Do a game where you have towo players, and based on program output decide which one is winner

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

interesting I never thought of it. Yes we learn that mulithreading is design to speed up work especialy on multicore machines, but us non of has had chance to run pc with more then one cpu we don't give consideration to it. Will write to Santa get me new pc then...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

you can run it without main method, but then it have to be Applet

Am'I correct jwenting?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I have Deitel &Deitel book JAVA How to Program 6th edition happy with it. Also cover threads and I got more out of it then from my teach at university(he just love to complain about java)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

if you can post it what exactly you looking for we can help you, but com libraries is huge subject
other think to do is type library name in google and search for it, don't be lazy m8

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

ehh don't want to be rude guys but this problem is all long sorted if you read whole topic you may find I posted solution over there plus small tip

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

OK, I got it now, will deal with it as soon I get some break from university

thank you for advice, will pm you with result

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

what do I have to do in order to get "MoveSelectedFiles" working?

I know it sounds dump but at uni we only extend it dialog boxes, never put together frame of different components declared in seperated class files

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

and how do you call this http://itextdocs.lowagie.com/tutorial/

MIRACLE ? ? ? :lol:

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
if(string1.compareTo(string2) == 0)
             STRING EQUALS
else
             STRINGS DO NOT MATCH

be aware this method can return three values less then zero, zero, or greater then zero. Only equal to zero is string are same

more info on string

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

not much difference

open file
read line by line
and do your character count
then don't forget to close file once finished with reading

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

here you go, as you read whole line you also get return character and you need to get rid of it, there are various way how to do it but as you already use charAt() I used again to just get first (zero position) character in string. this is not bullet prove as somebody can press space and then add character so think about it

import java.util.*;

public class Letter
 {
   public static void main(String[] args)
   {
      
     //needed for scanner class
      Scanner kb = new Scanner(System.in);
      
      int charCount = 0;
      
      // get users string
      System.out.print("Please enter a string: ");
      String userString = kb.nextLine();
      // get users character
      System.out.print("Please enter a character: ");
      char userChar = kb.nextLine().charAt(0);
      // tell the user what the program does
      System.out.println("\n****This program will return how many times" +
                          " the character you entered showed up in" +
                          " the string you entered.****");
                     
      for(int i= 0;i<userString.length();i++)
      {
              if (userString.charAt(i) == userChar)
                  {
                  charCount++;
                  }
      }
      System.out.println("\nThe specified character " +"\"" + userChar +
                          "\" is inside the string " + userString +
                          " " + charCount +   " times.\n");            
    }
}
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

that code is absolutly fine only think you need to change is give it location of existing image

my_gif = getImage(base,"NAME_AND LOCATION _OF_MY IMAGE.gif");

plus create simple html file somethink like this where width and height should be at least size of image which you try to display

<html>
<head>

<title>Untitled Document</title>
</head>

<body>
<applet code="ImageExample.class" width="100" height="100" alt="Applet doesn't work">
</applet>
</body>
</html>
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

now you complitely lost me. First you say I need to attach JTextArea to JPanel for example, but when I point to peace of code you say movedTextArea is not JTextArea
so let do it again if we can

public class MoveSelectedFiles extends JTextArea
{
	private JTextArea area;
	
	public MoveSelectedFiles()
	{		
		area = new JTextArea(10, 40);
	}
...
}

this is part of the code where I declare MovedSelectedFiles and provide constructor(some parts I exclude it)

...
MoveSelectedFiles movedTextArea;
MyComponent()
	{
		frame.add(component1, BorderLayout.WEST);
		frame.add(component2, BorderLayout.CENTER);

                // add TextArea to frame
		movedTextArea = new MoveSelectedFiles();
		JPanel panelTextArea = new JPanel();
		panelTextArea.add(movedTextArea);
		frame.add(panelTextArea, BorderLayout.EAST);
        }

bring in MoveSelectedFiles
add two components to frame
add movedTextArea to panelTextArea ( I do understand i'm adding extended JTextArea, am I wrong?)
add panelTextArea to frame

can you please explain where I'm going wrong?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You create a JTextArea but you don't add it to anything.
As a result it's never displayed.
Setting visible to true isn't going to do it, you need to add the actual JTextArea component to a container (like a JPanel).

don't I do that whit

MovedSelectedFiles movedTextArea = new MoveSelectedFiles();
		JPanel panelTextArea = new JPanel();
		panelTextArea.add(movedTextArea);
		frame.add(panelTextArea, BorderLayout.EAST);

I thought that is corect approche....

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I have class which extends JTextArea which I want to attach to JFrame.

here is constructor for for JTextArea

public MoveSelectedFiles()
	{
		area = new JTextArea(10, 40);
		setVisible(true);
	}

and here is JTextArea is added to JFrame

MovedSelectedFiles movedTextArea = new MoveSelectedFiles();
		JPanel panelTextArea = new JPanel();
		panelTextArea.add(movedTextArea);
		frame.add(panelTextArea, BorderLayout.EAST);

The JFrame is build of other 3 components where other 2 are showing OK.
Any suggestions/solutions?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

onclick="document.answer.Tim10.value = 'Having papers from the registering body that attest to their ancestry. A tracking registry.';"

IS NOT a JavaScript, it is only action taken once button pressed, which will triget this action. So as it is on its own that code will do nothing

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Secondly what you provided is not JavaScript only onClick action which take place on press of submit button. So put one and one together you are trying to steal somebody's work and have no idea what JavaScript is

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I had problem with JAR sometime ago, bellow you find link to my original question and solution to it

LINK

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

what did you done so far???

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

yeah that's correct forgot about it :mrgreen:

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

ever heard of Pythagoras' Theorem " a on power of two plus b on power of two equals to c on power of two"?
just example

(x1 - x2 ) = x           // your a
(y1 - y2) = y            // your b

if ( x < 0) then x * (-1)
if ( y < 0) then y * (-1)

x^2 + y^2 = z^2       // z is your c distance between pixels    this ^2 on power of two

then get square root
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

mate, the url which you provided doesn't work by the look seems to me like it is your local tomcat = running on your desktop/laptop and not proper server, so we will not be able to run it. You better post here your code and state what do you use to run it on

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

mate don't be lazy, this is simple

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I'm customizing JFileChooser for application atwork. One of the thinks I want it to do is open it as default directory My Computer with list of all hard drives, optical drives or nay other storage which you get once you open it.
Why I want to do it? Every b***y computer here has diferent setings for default directory and I would prefert to start from My Computer option to avoide any diffulties for user using this application on somebody else pc.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

if take out +1 this will generate numbers in the interval between 0-5 inclusive

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Think like a thinking person and look around in the API docs.
You can do it with a single method call.

no need for this mate, I know you all try to help, I try to do so too if I can, but sometimes you people ( prefesional programers) forget that there are people which just learning, following lecture notes or a book. Going around java api docs and looking for functions in early stage is imposible. You don't know what you looking for, you don't know where to start. Can you remember your self in early stages, learning any language

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

people don't you see that person is just learning ! ! !

Has no clue about buffers, streams, etc

think as beginners, not like overworked crazy programmers

for(int i = normal.length; i < 0; i--)
{
	last = normal.charAt( i);
	reversed += last;
}
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

thanks alot let me try that

mate get copy of Deitel & Deitel JAVA How to Program 6th Edition and look up chapter 24 Case Study (but don't try to cheat your teach will know it :twisted: )

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

check that you have semicolom after java home directory in path variable

c:\program files\java\jdk1.5.0_0.6\bin;

I had problem with that once, on some pc's will run it whitout this semicolom , but other refuse

ps:
not

publlic static void main(String a[])

but

public static void main(String args[])
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

nice job you nearly there here is your missing peace :cheesy:

//Calculate the change
String command = event.getActionCommand();
if(command == "Coca-Cola 1,15 Û")
{
change = (cents + euros) - 115;
}
else
{
change = (cents + euros) - 85;
}

KEEP UP YOUR WORK :p

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

to be fair you got more then 1 error and you will hate me for this :sad:

import java.util.Multiplesof5;there is no class Multiplesoft5 in java official package
/**
This program tests the Multiplesof5.
*/
public class Multiplesof5
{
	public static void main(string[]args)
	{
		ArrayList<multipesof5> multiples
		= new ArrayList<multiplesof5>();
		where did you declare multiple???multiple.add(new multiple(5));
		multiple.add(new multiple(10));
		multiple.add(new multiple(20));
		multiple.add(new multiple(50));
		multiple.add(new multiple(100));
		multiple.add(new multiple(200));
		multiple.add(new multiple(500));
		multiple.add(new multiple(1000));
		multiple.add(new multiple(2000));
		multiple.add(new multiple(5000));
		
		System.out.primtln(multiple());
		Multiplesof5 first = multiple.get(5);
		System.out.println("first multiple number="
		+ first.getMultipleNumber());
		Multiplesof5 last = multiple.get((); what you trying to get
		System.out.println("last multiple number="
		+ last.getMultiplesof5());
	}
}
import java.io.*;

public class multiplesof5
{
ONLY ONE MAIN so which???
	public static void main(String[] args)
	{
	int multiples[] = {0,5,1000,2500,2505,4995,5000,5001};
	why this bracklet}
	
	
	why this bracklet{
	what is this for???read BufferReader;
	try [B]catch[/B] something first if error then trow expresion throw IOException();
	
	{
	BufferReader infile = new BufferReader(new FileReader("Willia9a.dat"));
	
	inputLine = infile.readLine();
	
	shouldn't be below the brackletwhile(inputLine != null)?;
	}
	
	{
	FileInputStream inputStream =
	new FileInputStream("input.bin");
	}
	
	what is this???{
	IllegalArgumentException exception
	= new IllegalArgumentException("multiple doesn't match input");
	throw exception;
	}
	
	
	if (isMultiple)
	{
		System.out.println(multiple);
		System.out.println(numpasses/numseconds + "calls per second");
	}
	else
	{
		System.out.println("not found");
		System.out.println(numpasses/numseconds + "calls per second");
	}
	
	why bracklet{
		numpasses = Integer.parseInt(args[args.lenght-1]);
	why bracklet}
	
	why bracklet{
	long TimeRequired = multiple.getTime();
	double numseconds = TimeRequired/1000.0;
	System.out.println("Complete" + numpasses + "passes in"
	+ numseconds + "seconds" );
	System.out.println(numpasses/numseconds + "calls per second");
	}
	missing closing bracklet

Sorry mate you better to get started again on classes/lectures which …

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

you put your braclets in wrong place, opening bracked before if statement, plus you had extra bracklet on the end. Also you don't have to do if this do this, if this do that, use else if or switch. But I belive you going by book so you get there. For future use code tag for pasting code( the # character)

import java.util.Scanner;

public class triangles1
{
	public static void main(String [] args)
	{
		Scanner input = new Scanner(System.in);
		int ang_1 = input.nextInt();
		int ang_2 = input.nextInt();
		int ang_3 = input.nextInt();
		int total = ang_1+ang_2+ang_3;

		if(total!=180)
		{
			System.out.println("please re-enter angles so as they equal 180");
		}
	
		else if(ang_1==90||ang_2==90||ang_3==90)
		{
			System.out.println("right triangle");
		}
	
		else if((ang_1==ang_2&&ang_1!=ang_3)||(ang_1==ang_3&&ang_1!=ang_2)||(ang_2==ang_3&&ang_2!=ang_1))
		{
			System.out.println("isosceles triangle");
		}
		
		else if(ang_1==ang_2&&ang_2==ang_3)
		{
			System.out.println("equilateral triangle");
		}
	}
}// end class

I use sometimes JCreator, but now more NetBeans because of uni project, but you can switch auto bracklets in the "OPTIONS/EDITOR/JAVA/COMPATIBILITY/ uncheck Auto insert bracklet"
Well that what i did with my one, i don't like to do extra check for bracklets if I try some example from books/internet

Good luck with your study of JAVA :cheesy: