• Post Reply Bookmark Topic Watch Topic
  • New Topic

nend some help on  RSS feed

 
Per kermel
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.net.*;
import java.util.*;
public class Panel extends JPanel
{
public Panel()
{
String testfil = "tsjekkisk.n2a"; -- need to import this file from a server! HOW? How can a make 2 buttons 1 for web and 1 for file?
try{
setLayout(new BorderLayout());
// Et panel som innholder 2 knapper som skal lese en ordliste
JPanel nPan = new JPanel(new GridLayout(0,2));
add(nPan,BorderLayout.NORTH);
JButton lesFilFraKnapp = new JButton("ordliste lokalt");
JButton lesWebFraKnapp = new JButton("ordliste web");
nPan.add(lesFilFraKnapp);
nPan.add(lesFilWebKnapp);
//Norsk ord med forklaringer
JPanel cPan = new JPanel();
add(cPan,BorderLayout.CENTER);
JLabel FNorskOrd = new JLabel("Hva betyr dette");
JTextField KNorskOrd = new JTextField("hus",20);
c.Pan.add(FNorskOrd);
c.Pan.add(KNorskOrd);
//panel som har knapper som henter ord
JPanel sPan = new JPanel(new GridLayout(0,3));
add(sPan,BorderLayout.SOUTH);
JButton ordKnapp1 = new ordKnapp();
JButton ordKnapp2 = new ordKnapp();
JButton ordKnapp3 = new ordKnapp();

sPan.add(ordKnapp1);
sPan.add(ordKnapp2);
sPan.add(ordKnapp3);
Properties p = new Properties();
p.load(new FileInputStream(testfil));
}
catch(IOException fnf) {}
Properties p = System.getProperties();
p.list(System.out);
}
}
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[due to niceness standards intentionally left blank - self censoring: me]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stefan --
Nicely done. Thanks
Per --
There are a couple of different aspects to your question. One is how to open the remote file. If it's on a web server (i.e., an HTTP server) then you could just use the URLConnection class to easily get an InputStream which you could hand to the Properties class. If it's some other kind of server, well, the answer might be more complicated. You can get more details, if you need them, in the "Sockets and Internet Protocols" forum.
As to the button part, are you asking how to handle button-press events and react to them? You might go ask that question in the Swing/AWT/JFC forum.
Finally, Per, let me please ask you to, in the future, try to trim down code that you post to the minimum required to illustrate a problem (here, I'm not sure any code was needed!) and to please use the UBB [CODE] tag so that the formatting of your code will show up in your post. See here to learn more about UBB.
 
Per kermel
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thx
so its somtinge like
 
Per kermel
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jhave a frame on the frame u have 3 choises web,hd, close.
if u pick web.. it shall download a file form http:// into the form..
the web thing is another java file. that has buttons on it
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!