server_crash 64 Postaholic

Never mind that post, that might be more complicated than it's worth. I have an easier way that I'll probably post tommorow(don't have time right now,sorry).

server_crash 64 Postaholic

java.sun.com is your friend. :)

I never knew I had any friends?

server_crash 64 Postaholic

One more thing, use this instead of the usual constructor:

public void init()
{
}

also, you don't need a main method, as you will be calling it from an html file.

server_crash 64 Postaholic

It's basicly the same as adding to a framed application, without a few methods such as setDefaultCloseOperation() and setSize().

server_crash 64 Postaholic

What exactly is that rule your talking about?

If you guys find any readings on this, please post URL's.

server_crash 64 Postaholic

Which constructor should the JVM take after all?

The one it likes most?

server_crash 64 Postaholic

I'm not sure how to do that, altought it could be possible. My only worry, would be that it depends on the order in which you added them to a container, and the buttons added last got put on top. I'll be searching the internet for a solution and get back to you if I find one.

p.s - check out my new signature

Looks good, but I think you should bold the part at the bottom if you want more traffic..

server_crash 64 Postaholic

Yep, you can use decimal format, or the Math.round(), but you'll be satisfied with the DecimalFormat class.

server_crash 64 Postaholic

Why don't you post your code, preferably all of it, but most importantly the JDialog inner class and where you call it.

server_crash 64 Postaholic

Thank you very much, server_crash!!!

Your very welcome, and if you need any further help just let me know, or Pm me.

server_crash 64 Postaholic

Here is an example, but remember this is just an inner class.

class processCylinderDialog extends JDialog implements ActionListener
 {
	 JLabel lblRadius;
	 JLabel lblHeight;
	 JTextField txtRadius;
	 JTextField txtHeight;
	 JButton btnDone;
	 
	 JDialog dlg;
	 
	 public processCylinderDialog()
	 {
		
		 JPanel panelOne = new JPanel();
		 lblRadius = new JLabel("Radius");
		 txtRadius = new JTextField(10);
		 panelOne.add(lblRadius);
		 panelOne.add(txtRadius);
	
		 JPanel panelTwo = new JPanel();
		 lblHeight = new JLabel("Height");
		 txtHeight = new JTextField(10);
		 panelOne.add(lblHeight);
		 panelOne.add(txtHeight);
		
		JPanel panelThree = new JPanel();
		btnDone = new JButton("Calculate");
		btnDone.addActionListener(this);
		panelThree.add(btnDone);
		
		 
		 dlg = new JDialog();
		 dlg.setResizable(false);
		 dlg.getContentPane().add(panelOne);
		 dlg.getContentPane().add(panelTwo);
		 dlg.getContentPane().add(panelThree);
		 dlg.setTitle("Cylinder Volume");
		 dlg.getContentPane().setLayout(new FlowLayout());
		 dlg.setSize(350,300);
		 dlg.setVisible(true);
	 }
	 
	 public void actionPerformed(ActionEvent ae)
	 {
		 getInfo();
	 }
	 public void getInfo()
	 {
		 if (txtRadius.getText() != null && txtHeight.getText() != null)
		 {
	   try
	   {
		 double cylRadius = Double.parseDouble(txtRadius.getText());
		 double cylHeight = Double.parseDouble(txtHeight.getText());
		 double cylVolume = Math.PI * cylRadius * cylRadius * cylHeight;
		 txtResult.setText(dec.format(cylVolume) + "");
	   }
	   catch(NumberFormatException nfe)
	   {
	   }
	}
}

You can see that it is just like creating a class that extends JFarme with a few modifications.

When you want to display this dialog, you call it like this:

new className();
server_crash 64 Postaholic

freesoft, I don't really have an alogrothim. I just get the text, send it into a switch statement, and print it back out

A cool algorithm to try, would be using matrices, and multiplying them by a certain "key" matrix, and then you can covert back by using an inverse matrix.

server_crash 64 Postaholic

I think JDialog is the best to use when puting custom components like that in.

server_crash 64 Postaholic

Why are the buttons on top of each other in the first place?

server_crash 64 Postaholic

never mind.

server_crash 64 Postaholic

My applet is not showing up in a web page, and all of the code is correct...
I'll post it and the html code:

// import all need packages
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.applet.*;
 
//extend JFrame for the user interface and actionlistener for events
public class LCalcApplet extends JApplet implements ActionListener
{
	/*  create instance variables so they can be used in every method
	 *  instance variables allow all method to use them, instead of only
	 *  the method you are working in
	 */
	JButton btnCalc;
	JTextField txtAmount;
	JTextField txtAPR;
	JTextField txtMonths;
	JTextField txtPayment;
	JLabel lblAmount;
	JLabel lblAPR;
	JLabel lblMonths;
	JLabel lblPayment;
 
	/*  create a JMenuBar, used to hold the Menu's such
	 *  as file, edit, and that kind of stuff...On top of that,
	 *  you need the MenuItems...These are the actual items that show
	 *  up on the drop down
	 */
    JMenuBar menuBar;
	JMenu fileMenu;
	JMenuItem exitItem;
	JMenuItem resetItem;
	
	//the classes constructor
	public void init()
	{
		//create the menuBar
		menuBar = new JMenuBar();
		//create the items
		fileMenu = new JMenu("File");
		exitItem = new JMenuItem("Exit");
		resetItem = new JMenuItem("Reset");
		/*  add all the items to the Menu, this is 
		 *  done by the add() method coorisponding to 
		 *  the JMenu class
		 */
		fileMenu.add(exitItem);
		fileMenu.add(resetItem);
		/*  add action listeners to the menu items, this
		 *  will enable us to peform action based on what was
		 *  clicked.
		 */
		exitItem.addActionListener(this);
		resetItem.addActionListener(this);
		/*  once all that is done, you add the 
		 *  menu to the menuBar, and then …
server_crash 64 Postaholic

>So that would take longer than having a main method that does the same thing?
If main isn't static then an object of the class must be created first (unless the JVM wants to break its own rules, which isn't unheard of). By requiring main to be static, the environment avoids an unnecessary step. So yes, it would take slightly longer.

Thank you Narue, I believe I understand now.

server_crash 64 Postaholic

server_crash, how'd the SATs go?

It went ok, I did well on the math and the new essay part, but the reading wasn't so friendly to me..Thanks for asking!

server_crash 64 Postaholic

Changing signature:

Go up to control panel...and then on the left hand side is a button that says edit signature, and that will take you to a screen that looks similar to that of making a post.

server_crash 64 Postaholic

Hi everyone,

I really i wish i could show you a screen shot but actually you know we are getting the api's and functions ready and thus the layout is something we left to be done last so actually we are now using flow layout.

Another application that i have developed is an image manipulator. Its something like a mini photo shop but i think it still could use a lot of improvements.

Yours Sincerely

Richard West

It's no problem about the screen shots, I understand about the confidentiality. Anyways, look at this sites image editor, how does your image editor compare to that one.

http://www.jhlabs.com/ip/imageeditor.html

server_crash 64 Postaholic

>why is it static?
Primarily so that the JVM doesn't have to instantiate your controlling class to get an entry point into the program.

So that would take longer than having a main method that does the same thing?

server_crash 64 Postaholic

I promise I will help, but I just took a 4 hour SAT, and don't feel like working right now!

server_crash 64 Postaholic

i think static has to do w/ how its accessed

I already knew that.

server_crash 64 Postaholic

How are you making these forms? Are they modal frames, or just frames?

server_crash 64 Postaholic

Does anyone know a good tutorial on parsing math equations? I would use google, but I don't know what to search.

server_crash 64 Postaholic

I've often pondered over this subject. I know the main method has a special signature the JVM looks for, but why is it static?

server_crash 64 Postaholic

For the love of god any programmer would know that was a careless mistake.

WELL FREE UR RIGHT, ANY PROGRAMMER "SHOULD KNOW"

ALSO, ANYONE WITH 5TH GRADE READING ABILITIES "SHOULD KNOW" THAT I SPECIFICALLY ASKED THAT U NOT SEND ME THE CODE TO MY LAB ASSIGNMENT.

THIS DOES NO GOOD FOR ME, AND THEN IT REALLY DOES NO GOOD WHEN U MAKE A CARELESS MISTAKE WHEN I'M TRYIN TO UNDERSTAND THE CONCEPT.

HOWEVER I DO THANK YOU FOR THE TIME U TOOK TO SHARE YOUR "WHIZ POSTING" WITH ME.

PS no disrespect intended

I also learned how to plug in values for variables and such in third grade. So just posting code should have been as helpful as explaining a beginners concept.

server_crash 64 Postaholic

Mines better than yours :cheesy:

joking!

server_crash 64 Postaholic

Narue I got it done through a little bit of tial and error
but the concept of setting row = to matrix.length-1 is still puzzling
if u could clear this up for me i'd be very thankful.....TY

for (row=matrix.length-1;row>=0;row--)
{
    for (col=matrix[row].length-1;col>=0;col--)
    System.out.print(matrix[row][col] + "\t");
    System.out.println();
}

I just gave you a clear example?

server_crash 64 Postaholic

Here's a way of doing it, works best if you sort the array first, but you don't have to.

import java.util.*;

class DescendingOrder 
{
  public static void main(String[] arguments) 
  {
           String[] names = {"a", "c", "f", "d", "e"};
           Arrays.sort(names);
  
          System.out.println("Descending order:");
        
              for (int a = 0; a < names.length; a++)
              {
                        System.out.println(a + names[names.length
                                        - 1 - a]);
              }
    }
}
server_crash 64 Postaholic

Hi everyone,
If possible please tell people of this thread so i can roughly know what the software market demands are. At this point i only have the views of two people and would really like to have more views.

I'll see what I can do. I think the best way, would be puting something in your signature that points to this thread..I could also put something in my signature if you like.

At this moment in time we are also intending to include apis - something similar to what netscape did in late 1995(not sure if the year is correct).

For example we may start to include printing api's that a developer can use by wrapping his classes around them and for example to print the content of a multi-page JTable would take less than five lines of code. What do you think of selling royalty free apis'. Is it a good idea or a bad one??

What do you think is the reasonable price charge for the above described api?

I think idea of developing API's is great, especially for printing. Printing is one of the hardest concepts in programming, and if you could make an API that simlified it, there is no telling how much you could make. I'm not really good on pricing things like that, but some people will stick with the complicated way instead of paying, so you have to keep that in mind. Is there a way you could make it open …

server_crash 64 Postaholic

Hi everyone,

I can't, i signed a confidientially agreement.

Richard West

Ahh, I see, you work for a company...Sorry!

server_crash 64 Postaholic

I can help you, but I have school right now, but after I'll help you.

server_crash 64 Postaholic

Is this other application one that you made, or just some other window application?

server_crash 64 Postaholic

Sorry, I don't know very much about network programming. Hopefully, someone that knows something about it will come along and help you. sorry!

server_crash 64 Postaholic

Don't think the System class has a method like that. Your probably reading a FileInputStream's method of reading a character.

Now, if you want to get input from the console, which is what it looks like:

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

br.readLine();

but other than that, I don't think you have the correct code, unless you want to post the whole thing, and maybe it's something different.

server_crash 64 Postaholic

Hi everyone,

Here is a thread on roughly what i have done using java.

http://www.daniweb.com/techtalkforums/thread19660.html

Please don't forget to vote

Richard West

Do you have a screenshot of an app you could show?

server_crash 64 Postaholic

I have recently come in touch with the JAVA and I was wondering if somebody can help me with the console window code.

Thanks in advance

P.S - Also, when typing the code into the JBuilder, where does it go? Does it go straightafter:

package XX;

Thanks,

Here code for console window, and yes it goes after all packages declarations, and imports:

class Hello
{
  public static void main(String[] args)
  { 
      [B]System.out.println[/B]("Hello");  //prints out at command line
   }
}

Note: Please don't start out learning java under the help of a IDE(JBuilder), it will make you an extremely lazy programmer(As I know from experience), and you won't always have the chance to use something other than the console. Start out using a simple text editor, set environment variables, and then compile using the command line.

server_crash 64 Postaholic

Passed it today with 87%, yoohoo!

Good Job! What percentage do you need to pass?

Also, give me a nice hard question they had on the exam, so I can see if I know it(if he does, no one answer untill I get it).

server_crash 64 Postaholic

For example the spread sheet is a clone of microsoft's excel written in java swing and i am thing of charging about US$20. Is it too pricey??

Another question i have is what are the kind of software you guys find useful in your workplace or home?
An example for me is Adobe reader but what about the rest of you guys??

Please don't ask me why i have built clones of commercial softwares - maybe i don't have an imagination of my own

Any kind of comments would be helpful

Thank You

Yours Sincerely

Richard West

Hey Richard,
I think it's great that you can build that type of software. I wouldn't sell it seperately at that price...I think a better idea would be, to create a whole suit of applications and selling them as a whole...I think buyers tend to go for that more than a single application. As for creating "clones" of commercial software, I believe that's one of the best ways of learning.

Anyways, software I find helpful at home, is a programmers notepad(V.A.T.E) like JEdit, and I personally like math programs, although I don't use them very much.

server_crash 64 Postaholic

I could be wrong about this, but I would think no matter how you do it, it would be possible to loose some packets due to the quality of the connection, and so forth. Again, I could be wrong, so maybe somone that knows a little more than me can help you.

server_crash 64 Postaholic

Well at least I don't feel so stupid now! ;)

server_crash 64 Postaholic

I think C++ (like me) was being sarcastic :)

Really? I actually thought you were being serious :o

server_crash 64 Postaholic

If it's just calculating the average, do you have to return both of those arrays? I mean, you could just calculate the average and return an int value, instead of returning void. Then you could call the method from main.

server_crash 64 Postaholic

I've also made a pretty good TextEditor, and a Semi-Scientific calculator...I've made a lot more, but those are my best.

server_crash 64 Postaholic

It will graph a polynomial up to the fifth order....not hard math, but getting it to graph that was not very fun, especially if you use the built in java function(drawPolyline());

server_crash 64 Postaholic

Why don't you play around in java a little with this idea, I mean, you could program stuff that will act on certain statements entered by the user, and soforth.

server_crash 64 Postaholic

I'll give you a screenshot of my favorite project, although it didn' take ver long.

server_crash 64 Postaholic

how about making your own programming language (good luck ;) )

uuuuuhhhhh

server_crash 64 Postaholic

Your entire application is butt ugly

I actually did laugh out loud on that one.