Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

nend some help on

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
}
}
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[due to niceness standards intentionally left blank - self censoring: me]
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thx
so its somtinge like
 
Per kermel
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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's a pleasure to see superheros taking such an interest in science. And this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic