ganeshjk krishnamurthy

Greenhorn
+ Follow
since Apr 30, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ganeshjk krishnamurthy

Hi ,
I am creating a client server application for which I am developing an applet. I need to display the files in the server directory on clicking on a button in the applet at the client end ( something like the show() method of the FileDialog class). I am new to java programming. So please guide me to a solution.
Thanks in advance.
regards
ganesh.
18 years ago
hi,
Sorry for the previous message posted( was a bit careless).
Thanks a lot for guiding me.But as I am quite new to java please tell me what is this plugin you are talking about ? Also I found a java.policy file in the following path C:\Program Files\j2sdk_nb\j2sdk1.4.2\jre\lib\security.
Is it this java.policy file which I have to edit with the code you gave me ? Can I set the read permission for the whole directory ?
thanks in advance
ganesh.
18 years ago

Originally posted by Michael Morris:
As Gregg said, Applets run in the "sandbox" with very limited access to system resources. The fact that the file permissions are set correctly doesn't do anything for you. The easiset way to handle this is to add a permission to the plugin policy file, java.policy, which is located in the lib/security subdirectory of the plugin's main directory. If your applet's codebase is http://www.mysite.com then you would add an entry like:

That will allow unfettered access to all system resources, which may not be what you want. You can limit it to specific permissions by using different permission types for example:

That would grant read permission to just the file "/home/ganesh/test/j2sdk_nb/bin.

18 years ago
hi,
I am creating an applet using swing.I am working on linux.
In the code below , when I click on JComboBox CB1 and consequently call the dut.show() method I get the following exception
"java.security.AccessControlException access denied (java.io.FilePermission /home/ganesh/test/j2sdk_nb/bin read)
at java.security.AccessController.checkPermission(AccessControlContext java :line number)
and so on ....................."
I checked the directory for permissions and found them to be ok.
Please suggest a solution to overcome this issue.
regards,
ganesh.
public class HelloWorld2 extends JApplet implements ActionListener {

JFrame a = new JFrame("Deembed");
String data[] = { "trans" , "ind" , "kap" , "line" , "none"};

FileDialog open_file = new FileDialog(a, "-open" , FileDialog.LOAD);
FileDialog thr = new FileDialog(a, "-short - thru" , FileDialog.LOAD);
FileDialog dut = new FileDialog(a, "DUT" , FileDialog.LOAD);
JComboBox CB2 = new JComboBox();
public void init()
{
JComboBox CB1 = new JComboBox(data);

CB1.addActionListener(this);
CB2.addActionListener(this);

this.getContentPane().add(CB1);
this.getContentPane().add(CB2);
this.getContentPane().setLayout(new FlowLayout());
}
public void actionPerformed(ActionEvent e) {

JComboBox cb = (JComboBox)e.getSource();
// String data1 = (String)cb.getSource();
System.out.println(cb.getSelectedItem());
//process : Add data to CB2
if(cb.getSelectedItem() == "ind" ) {
CB2.removeAllItems();
CB2.addItem("-ind");
CB2.addItem("none");

dut.show();
}
else if (cb.getSelectedItem() == "kap"){
CB2.removeAllItems();
CB2.addItem("-kap");
CB2.addItem("none");

dut.show();
}
else if ( cb.getSelectedItem() == "trans"){
CB2.removeAllItems();
CB2.addItem("-e");
CB2.addItem("-c");
CB2.addItem("-ipol");
CB2.addItem("-l");
CB2.addItem("none");

dut.show();
}
else if ( cb.getSelectedItem() == "line"){
CB2.removeAllItems();
CB2.addItem("-line");
CB2.addItem("none");

dut.show();
}


}
}
18 years ago
hi,
Thanks for the reply. I implemented the logic , but it doesnot seem to work.
I am pasting the code below for ur perusal.
Thank you once again.
regards,
ganesh.
public class HelloWorld2 extends JApplet implements ActionListener {

Frame a = new Frame("Deembed");
String data_a[] = { "a" , "b" , "c" };
String data_b[] = { "d" , "e" , "f" };
String data_c[] = { "x" , "y", "z" };
String data[] = { "trans" , "ind" , "cap" };
JComboBox CB2 = new JComboBox(data_a);
public void init()
{
JComboBox CB1 = new JComboBox(data);



this.getContentPane().add(CB1);
this.getContentPane().add(CB2);
this.getContentPane().setLayout(new FlowLayout());
}
public void actionPerformed(ActionEvent e) {

JComboBox cb = (JComboBox)e.getSource();
String data = (String)cb.getSelectedItem();
//process : Add data to CB2
if(data == "ind") {
CB2.removeAllItems();
CB2.addItem(data_b);
}
else if (data== "cap"){
CB2.removeAllItems();
CB2.addItem(data_c);
}
}
}
18 years ago

Originally posted by ganeshjk krishnamurthy:
hi,
Thanks for the help. I tried your suggestions , but still am not able to get the result.Here is the code for ur perusal.import java.applet.*;
import java.lang.*;
import java.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class HelloWorld2 extends JApplet implements ActionListener {

Frame a = new Frame("Deembed");
String data_a[] = { "a" , "b" , "c" };
String data_b[] = { "d" , "e" , "f" };
String data_c[] = { "x" , "y", "z" };
String data[] = { "trans" , "ind" , "cap" };
JComboBox CB2 = new JComboBox(data_a);
public void init()
{
JComboBox CB1 = new JComboBox(data);



this.getContentPane().add(CB1);
this.getContentPane().add(CB2);
this.getContentPane().setLayout(new FlowLayout());
}
public void actionPerformed(ActionEvent e) {

JComboBox cb = (JComboBox)e.getSource();
String data = (String)cb.getSelectedItem();
//process : Add data to CB2
if(data == "ind") {
CB2.removeAllItems();
CB2.addItem(data_b);
}
else if (data== "cap"){
CB2.removeAllItems();
CB2.addItem(data_c);
}
}
}

thank you ,
regards,
ganesh.

18 years ago
hi,
Thanks for the help. I tried your suggestions , but still am not able to get the result.Here is the code for ur perusal.import java.applet.*;
import java.lang.*;
import java.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class HelloWorld2 extends JApplet implements ActionListener {

Frame a = new Frame("Deembed");
String data_a[] = { "a" , "b" , "c" };
String data_b[] = { "d" , "e" , "f" };
String data_c[] = { "x" , "y", "z" };
String data[] = { "trans" , "ind" , "cap" };
JComboBox CB2 = new JComboBox(data_a);
public void init()
{
JComboBox CB1 = new JComboBox(data);



this.getContentPane().add(CB1);
this.getContentPane().add(CB2);
this.getContentPane().setLayout(new FlowLayout());
}
public void actionPerformed(ActionEvent e) {

JComboBox cb = (JComboBox)e.getSource();
String data = (String)cb.getSelectedItem();
//process : Add data to CB2
if(data == "ind") {
CB2.removeAllItems();
CB2.addItem(data_b);
}
else if (data== "cap"){
CB2.removeAllItems();
CB2.addItem(data_c);
}
}
}

thank you ,
regards,
ganesh.
18 years ago
hi,
I am new to java and am developing an application . I need suggestions to implement the requirement below.
The application will have a combo box ( CB1) with 3 choices A , B and C. Another combobox (CB2) in the same frame has to reflect the choice selected in CB1. I.e for example if A is selected in CB1 then CB2 has to display D , E , F ..... if B is selected then CB2 has to display G, H and I .....
Please guide me to the solution.
Hoping to hear a solution as quickly as possible.
Thank you.
regards,
ganesh.
18 years ago