ROGENATOR 1 Newbie Poster

Greetings:
It can be done via JNI, i once did that in 2 steps, from java to c++ and then from c++ to c#, in java`s webpage there`s a tutorial on doing this, from java to c++ and viceversa.
For writing c# code in Java code, im pretty sure that`s not possible since they`re different languages but as alc6379 said almost everything you can do in C# can be done in Java.

ROGENATOR 1 Newbie Poster

Greetings:
I was wondering, how can i run a .class from a different location?
For example, supose that i have c:\A.class, in MS-DOS supose that im at d:\whatever\whatever\, if i run java c:\A, i get:
Exception int hread "main" java.lang.No ClassDefFoundError c:\A

I`ve also tried using:

java -cp . c:\A
java c:\\A

But i can`t make them to run, i`writing a compiler for java and i want that you can choose any file in any location, not just in the same folder/location of the app.

ROGENATOR 1 Newbie Poster

Greetings:
You could try with GridBagLayout, it allows you to control a little more the appereance by using weights for the spaces that the components use, something like this:

GridBagLayout gridbag = new GridBagLayout();
this.getContentPane().setLayout(gridbag);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
//to add components you just asign a grid position and a weight
g.gridx=0;c.gridy=0;c.weightx=2;c.weighty=0;this.getContentPane().add(component,c);

Here is the description of GridbagLayout from java.sun, http://java.sun.com/docs/books/tutorial/uiswing/layout/gridbag.html

ROGENATOR 1 Newbie Poster

Greetings:
You could use a process for this:

Process p=new Process();
p.StartInfo.FileName=file;
p.StartInfo.WindowStyle=ProcessWindowStyle.Hidden;
p.Start();p.WaitForExit();p.Close();

Just make sure youre using System.Diagnostics

ROGENATOR 1 Newbie Poster

Greetings:
You should really pay attention at server_crash points, anyway, this should do the trick:

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class Test extends Applet implements ActionListener{
	private Button b1,b2;
	private Label l1,l2;
	public void init()
	{
		GridBagLayout g=new GridBagLayout();setLayout(g);
		GridBagConstraints c=new GridBagConstraints();
		c.fill=GridBagConstraints.HORIZONTAL;
		l1=new Label();l2=new Label();
		b1=new Button("Jhon");b1.addActionListener(this);
		b2=new Button("Smith");b2.addActionListener(this);
		c.gridx=0;c.gridy=0;add(l1,c);c.gridx=1;c.gridy=0;add(b1,c);
		c.gridx=0;c.gridy=1;add(l2,c);c.gridx=1;c.gridy=1;add(b2,c);
	}
	public void actionPerformed(ActionEvent e){
		String s=e.getActionCommand();
		if(s=="Jhon")l1.setText("Jhon");else l2.setText("Smith");
	}
}
ROGENATOR 1 Newbie Poster

Greetings:
Check this link, almost at the bottom there is class named DrawingPanel, they extend JPanel to behave as canvas, hope that helps :cheesy:

SpS commented: Good :SunnyPalSingh +1
ROGENATOR 1 Newbie Poster

Greetings:
Thanks jwenting, it worked like a charm

ROGENATOR 1 Newbie Poster

Greetings:
I don`t quite understand your question, but from reading your other post (I think you should have posted this in the other post), i think that using an array for the bets wouldn`t be the best answer, why dont you create a class that "hosts" the bets with four variables, in case that the user only choose 3 you can set the other one to null, then you just create as many objects as you need of that class for the bets and use any method you prefer to keep track of them, like a Vector

ROGENATOR 1 Newbie Poster

Greetings:
I`m starting in Java and i`m having problems with compatibility between versions, in school they have an older version(I believe its 1.4.0 but i`m not completely sure) than the one i have at home(1.5.0_04), so almost every time i try to open a applet/application at school i get errors, so i have to change some parts of code, i was wondering, is there a way to convert from newer versions to older version?, or any thoughts on how to ensure compatibility?.
for example:
At home i can use:

frame.add(X)

At school i must use:

frame.getContentPane().add(X)

At school i can`t use:

JFrame.setDefaultLookAndFeelDecorated(true);
ROGENATOR 1 Newbie Poster

Greetings:
That`s my question, until know i`ve been doing it by a batch file that i execute then read, is there a way to do it without the batch?, what i need is to list all of the Word (.doc) files of a given directory
Thanks in advance

ROGENATOR 1 Newbie Poster

Greetings:
There are two ways for manipulating pdf files, the hard way is to develop a library to read an write pdf files (easier said than done) you can find everything you`ll need for writing one here, the easier way is to use PDFKit.net, from tallcomponents, in there you can find lot`s of code samples to get started.

Hope that helps.

ROGENATOR 1 Newbie Poster

Greeting:
That a usual problem with random number, the best way to minimize this to use a seed for the random based on the actual time, something like this:

DateTime x=DateTime.Now();
float mins=x.Minute;
float secs=x.Second;
float hour=x.Hour;
Random r=new Random((secs*mins)+hour);

This way unless you run your program at the exact same hour every time, you`ll have different random numbers each time.

ROGENATOR 1 Newbie Poster

Grretings:
Just remove that part from the string:

s.Remove(0,3);

the remove method takes two parameter, the index where you want to start removing and length you wish to remove

ROGENATOR 1 Newbie Poster

Greeting:
Thanks, that was what i was missing

ROGENATOR 1 Newbie Poster

Greetings:
I developed a simple application for text encryption, i managed to register the new extension, my question is how to open this files from outside the program?(when you double click on them), i know that you need to pass some parameters to the main method but im not sure how,
If possible could you post a sample code or a snippet?.
Thanks in advance

ROGENATOR 1 Newbie Poster

Greetings:
You could use a loop for the number of the table on your DataTable to update all, there`s a way of updating all in one pass but i think this method gives you more control on the values that you pass to the database, other thing that i just realize is that in this part

DataTable update=new DataTable("name of your table");
update=contenedor.Tables[0];

you could specify all of the tables and refer to them as you need them, but im not sure exactly how, as soon as i get home i`ll give it a go

ROGENATOR 1 Newbie Poster

Greetings:
Actually i spent a lot of time trying to do this with the default updateCommand, but, with no satisfactory results, my suggestion is to use sql commands with an OleDbCommand, what you need is to check if there was an update and if so enter a sql instruction:

if(myDataSet.HasChanges()){
   DataTable update=new DataTable("name of your table");
   update=contenedor.Tables[0];
   int len=0;
   //Check the length of the table rows
   foreach(DataRow myRow in update.Rows)
   {
    len++;
   }
   conexion.Open();
   for(int i=lenI;i<len;i++)
   {
    Object linea=update.Rows[i].ItemArray;
             comandos1=new OleDbCommand("INSERT INTO tabla1"+" VALUES ("+linea[0]+","+linea[1]+","+linea[2]+")",conexion);
    comandos1.ExecuteNonQuery();

  }
  conexion.Close();
}

This is the easy way, overwrite all of them with the new stored values, the beauty of this is that you also insert new records, the problem is that you first need to check that the values are valid and you are not changing protected values, if you want to do it correctly just check wich of the fields was changed by comparing your object (in this case linea) to the db and just change where they don't match.
Hope this helps and sorry for my bad English, it's not my native language :o