aspose file tools*
The moose likes Applets and the fly likes New to java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "New to java" Watch "New to java" New topic
Author

New to java

puni doms
Greenhorn

Joined: Feb 06, 2012
Posts: 6
I am new to java...
i am working in server and client... Its like 1 server send message to many client.
in this i want to make as tree message.the programm is in eclipse and answer must be in APPlet.
i have some coding and with this coding , i want to make it as in tree form......

while ((allLine = in.readLine()) != null) {
allLine = allLine.trim();

if(allLine.indexOf("=Lang=")!=-1&&allLine.indexOf("Set=0")==-1){
JLabel j=new JLabel(allLine.substring(0,allLine.indexOf("=")));
jp.add(j);
if(allLine.indexOf("Set=1")!=-1){
JCheckBox cb=new JCheckBox();
jp.add(cb);
cb.setSelected(true);
bestinformedclient.channBox.add(cb);
}
else{
JCheckBox cb=new JCheckBox();
jp.add(cb);
cb.setSelected(false);
bestinformedclient.channBox.add(cb);
}
}

}
in.close();

JScrollPane sp = new JScrollPane(jp);
sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZO NTAL_SCROLLBAR_ALWAYS);
sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL _SCROLLBAR_ALWAYS);

content.add(sp);
}

}
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
I'm not sure what "make it in a tree" means. What does this code do, and how does that differ from what you wanted it to do?

As as aside, Eclipse is an IDE, not a server; will you be using some homegrown server that you created, or do you have an app server or servlet container of some kind?
puni doms
Greenhorn

Joined: Feb 06, 2012
Posts: 6
This is like in Web page . When ever you add some thing For eg : createing channel english . Then it will be connected to client.

When ever we are running eclipse , the client will show the java client.

the client and java client are in Applet.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Sorry, I have absolutely no idea what you intend to do. Maybe you can rephrase it while also giving more detail.
puni doms
Greenhorn

Joined: Feb 06, 2012
Posts: 6
import java.awt.Container;
import java.awt.GridLayout;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.net.URL;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class ChannW extends JFrame{
private static final long serialVersionUID = 1L;

ChannW() throws Exception{
setSize(325,375);
setLocation(225,225);
setTitle(" Channels");

Container content=getContentPane();
JPanel jp = new JPanel();
jp.setLayout(new GridLayout(0,2));

URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
String decodepath=java.net.URLDecoder.decode(url.getPath(),"UTF-8");
File file = new File(decodepath+"Infoclient.ini");
BufferedReader in = new BufferedReader(new FileReader(file));
String allLine="";

bestinformedclient.channBox.removeAllElements();

while ((allLine = in.readLine()) != null) {
allLine = allLine.trim();

if(allLine.indexOf("=Lang=")!=-1&&allLine.indexOf("Set=0")==-1){
JLabel j=new JLabel(allLine.substring(0,allLine.indexOf("=")));
jp.add(j);
if(allLine.indexOf("Set=1")!=-1){
JCheckBox cb=new JCheckBox();
jp.add(cb);
cb.setSelected(true);
bestinformedclient.channBox.add(cb);
}
else{
JCheckBox cb=new JCheckBox();
jp.add(cb);
cb.setSelected(false);
bestinformedclient.channBox.add(cb);
}
}

}
in.close();

JScrollPane sp = new JScrollPane(jp);
sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

content.add(sp);
}

}

Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
This doesn't really help, as it explains nothing about what it's intended to do, nor is it an executable piece of code. Posting an SSCCE would help.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4544
    
    5

puni, please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/new-java/55189-help-java-tree.html


luck, db
There are no new questions, but there may be new answers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New to java