This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New to java

 
puni doms
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2849
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2849
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I have absolutely no idea what you intend to do. Maybe you can rephrase it while also giving more detail.
 
puni doms
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2849
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
puni, please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/new-java/55189-help-java-tree.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic