Need combobox with a Jtable to view client & server files

Hellow Everybody,
I am quite new to Java, although I have experience with other
programming languages.
I have searched for tutorials, code, examples etc. but have not found
much that can help me so far. I am a BCA student & I am appearing for my last year exams. I studied about various Java programs in my course and I decided to make a Swing based FTP Server. Although I not expert in Java , but I have learnt the network programming very much clearly, and that�s why by the help these I wrote a program but it not complete. I have given the program below.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.StringTokenizer;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.border.BevelBorder;
import javax.swing.border.EmptyBorder;
import sun.net.TelnetInputStream;
import sun.net.ftp.FtpClient;
public class Client extends JFrame {
public static int BUFFER_SIZE = 10240;
protected JTextField userNameTextField = new JTextField("anonymous");
protected JPasswordField passwordTextField = new JPasswordField(10);
protected JTextField urlTextField = new JTextField(20);
protected JTextField fileTextField = new JTextField(10);
protected JTextArea monitorTextArea = new JTextArea(5, 20);
protected JProgressBar m_progress = new JProgressBar();
protected JButton putButton = new JButton("Upload <<");
protected JButton getButton;
protected JButton fileButton = new JButton("File");
protected JButton closeButton = new JButton("Close");
protected JFileChooser fileChooser = new JFileChooser();
protected FtpClient ftpClient;
protected String localFileName;
protected String remoteFileName;
public Client() {
super("FTP Client");
JPanel p = new JPanel();
p.setBorder(new EmptyBorder(5, 5, 5, 5));
p.add(new JLabel("User name:"));
p.add(userNameTextField);
p.add(new JLabel("Password:"));
p.add(passwordTextField);
p.add(new JLabel("URL:"));
p.add(urlTextField);
p.add(new JLabel("File:"));
p.add(fileTextField);
monitorTextArea.setEditable(false);
JScrollPane ps = new JScrollPane(monitorTextArea);
p.add(ps);
m_progress.setStringPainted(true);
m_progress.setBorder(new BevelBorder(BevelBorder.LOWERED, Color.white,
Color.gray));
m_progress.setMinimum(0);
JPanel p1 = new JPanel(new BorderLayout());
p1.add(m_progress, BorderLayout.CENTER);
p.add(p1);
ActionListener lst = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (connect()) {
Thread uploader = new Thread() {
public void run() {
putFile();
disconnect();
uploader.start();
putButton.addActionListener(lst);
putButton.setMnemonic('U');
p.add(putButton);
getButton = new JButton("Download >>");
lst = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (connect()) {
Thread downloader = new Thread() {
public void run() {
getFile();
disconnect();
downloader.start();
getButton.addActionListener(lst);
getButton.setMnemonic('D');
p.add(getButton);
lst = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (fileChooser.showSaveDialog(Client.this) != JFileChooser.APPROVE_OPTION)
return;
File f = fileChooser.getSelectedFile();
fileTextField.setText(f.getPath());
fileButton.addActionListener(lst);
fileButton.setMnemonic('f');
p.add(fileButton);
lst = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (ftpClient != null)
disconnect();
else
System.exit(0);
closeButton.addActionListener(lst);
closeButton.setDefaultCapable(true);
closeButton.setMnemonic('g');
p.add(closeButton);
getContentPane().add(p, BorderLayout.CENTER);
fileChooser.setCurrentDirectory(new File("."));
fileChooser
.setApproveButtonToolTipText("Select file for upload/download");
WindowListener wndCloser = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
disconnect();
System.exit(0);
addWindowListener(wndCloser);
setSize(720, 240);
setVisible(true);
public void setButtonStates(boolean state) {
putButton.setEnabled(state);
getButton.setEnabled(state);
fileButton.setEnabled(state);
protected boolean connect() {
monitorTextArea.setText("");
setButtonStates(false);
closeButton.setText("Cancel");
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
String user = userNameTextField.getText();
if (user.length() == 0) {
setMessage("Please enter user name");
setButtonStates(true);
return false;
String password = new String(passwordTextField.getPassword());
String sUrl = urlTextField.getText();
if (sUrl.length() == 0) {
setMessage("Please enter URL");
setButtonStates(true);
return false;
localFileName = fileTextField.getText();
// Parse URL
int index = sUrl.indexOf("//");
if (index >= 0)
sUrl = sUrl.substring(index + 2);
index = sUrl.indexOf("/");
String host = sUrl.substring(0, index);
sUrl = sUrl.substring(index + 1);
String sDir = "";
index = sUrl.lastIndexOf("/");
if (index >= 0) {
sDir = sUrl.substring(0, index);
sUrl = sUrl.substring(index + 1);
remoteFileName = sUrl;
try {
setMessage("Connecting to host " + host);
ftpClient = new FtpClient(host);
ftpClient.login(user, password);
setMessage("User " + user + " login OK");
setMessage(ftpClient.welcomeMsg);
ftpClient.cd(sDir);
setMessage("Directory: " + sDir);
ftpClient.binary();
return true;
} catch (Exception ex) {
setMessage("Error: " + ex.toString());
setButtonStates(true);
return false;
protected void disconnect() {
if (ftpClient != null) {
try {
ftpClient.closeServer();
} catch (IOException ex) {
ftpClient = null;
Runnable runner = new Runnable() {
public void run() {
m_progress.setValue(0);
putButton.setEnabled(true);
getButton.setEnabled(true);
fileButton.setEnabled(true);
closeButton.setText("Close");
Client.this.setCursor(Cursor
.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
SwingUtilities.invokeLater(runner);
protected void getFile() {
if (localFileName.length() == 0) {
localFileName = remoteFileName;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
fileTextField.setText(localFileName);
byte[] buffer = new byte[BUFFER_SIZE];
try {
int size = getFileSize(ftpClient, remoteFileName);
if (size > 0) {
setMessage("File " + remoteFileName + ": " + size + " bytes");
setProgressMaximum(size);
} else
setMessage("File " + remoteFileName + ": size unknown");
FileOutputStream out = new FileOutputStream(localFileName);
InputStream in = ftpClient.get(remoteFileName);
int counter = 0;
while (true) {
int bytes = in.read(buffer);
if (bytes < 0)
break;
out.write(buffer, 0, bytes);
counter += bytes;
if (size > 0) {
setProgressValue(counter);
int proc = (int) Math
.round(m_progress.getPercentComplete() * 100);
setProgressString(proc + " %");
} else {
int kb = counter / 1024;
setProgressString(kb + " KB");
out.close();
in.close();
} catch (Exception ex) {
setMessage("Error: " + ex.toString());
protected void putFile() {
if (localFileName.length() == 0) {
setMessage("Please enter file name");
byte[] buffer = new byte[BUFFER_SIZE];
try {
File f = new File(localFileName);
int size = (int) f.length();
setMessage("File " + localFileName + ": " + size + " bytes");
setProgressMaximum(size);
FileInputStream in = new FileInputStream(localFileName);
OutputStream out = ftpClient.put(remoteFileName);
int counter = 0;
while (true) {
int bytes = in.read(buffer);
if (bytes < 0)
break;
out.write(buffer, 0, bytes);
counter += bytes;
setProgressValue(counter);
int proc = (int) Math
.round(m_progress.getPercentComplete() * 100);
setProgressString(proc + " %");
out.close();
in.close();
} catch (Exception ex) {
setMessage("Error: " + ex.toString());
protected void setMessage(final String str) {
if (str != null) {
Runnable runner = new Runnable() {
public void run() {
monitorTextArea.append(str + '\n');
monitorTextArea.repaint();
SwingUtilities.invokeLater(runner);
protected void setProgressValue(final int value) {
Runnable runner = new Runnable() {
public void run() {
m_progress.setValue(value);
SwingUtilities.invokeLater(runner);
protected void setProgressMaximum(final int value) {
Runnable runner = new Runnable() {
public void run() {
m_progress.setMaximum(value);
SwingUtilities.invokeLater(runner);
protected void setProgressString(final String string) {
Runnable runner = new Runnable() {
public void run() {
m_progress.setString(string);
SwingUtilities.invokeLater(runner);
public static int getFileSize(FtpClient client, String fileName)
throws IOException {
TelnetInputStream lst = client.list();
String str = "";
fileName = fileName.toLowerCase();
while (true) {
int c = lst.read();
char ch = (char) c;
if (c < 0 || ch == '\n') {
str = str.toLowerCase();
if (str.indexOf(fileName) >= 0) {
StringTokenizer tk = new StringTokenizer(str);
int index = 0;
while (tk.hasMoreTokens()) {
String token = tk.nextToken();
if (index == 4)
try {
return Integer.parseInt(token);
} catch (NumberFormatException ex) {
return -1;
index++;
str = "";
if (c <= 0)
break;
str += ch;
return -1;
public static void main(String argv[]) {
new Client();
The above given code is not yet complete. I want some specific features to be implemented in this code that is given below.
1.     A login Gridlayout or Borderlayout & within it the username & password textfield.
2.     When the username and password will request to server and if it will success then the textfields of the username & password have to be disable.
3 . Two Combobox. One will give client directories and files and another
will give the server directories and files.
4 . Below the Combobox two JTable will be given & the tables wll show the
client and server directories and files.
Could anybody give me the codes that I want. If anybody check this code please help me????
With Regards,
DILLU

Well Mr Michael_Dunn,
Thanks for responding my query. First of all I would like to tell that
this FTP server is going to be my project and that's why I am submmiting my question. I told in my points that I want a Jcombobox & a JTable for displaying that files & directories. whenever I set the directories in the combobox the files will be displayed in the JTable
I hope you understand my point

Similar Messages

  • Need Help with a very simple view transition scenario

    Hello All,
    I am trying to learn how view transitions work and I am having a very hard time with the sample apps (like transition view app etc)...I need something much more simple at first. Can you please provide me a little guidelines on how to set up this following scenario:
    App loads up and shows a title screen with a button that says go. When you click on the go button the title screen fades out and a new view fades in (or slides in, or anything at all).
    Right now I have 3 nib files. There is the main one that is called on application start (tied with MainViewController, a subclass of IUViewcontroller just like in the hello world app. After the app loads the app delegate object tells the MainViewController object to load in another view controller object (via addSubview) which is tied with the second nib file; my title screen with the button. When I press the button I was thinking in the IBAction function to tell the MainViewController object to remove (or transition out somehow) the title screen view controller object then add the other view (third nib file in). This is the part I can't get working. Am I on the right track or have a gone hideously astray? Thank you!

    hi,
    i managed to do this for my app. (think i referred to viewTransitions sample code and modified quite a bit)
    i can't remember this well cos i did this quite a while back, but i will try to help as much as possible
    1) from the appdelegate i initialize a root controller (view controller class)
    2) this root controller actually contains two other view controllers, let's call it viewAController and viewBController, for the screens which u are going to toggle in between. and there's also a function, let's call it toggleMenu, which will set the menus to and fro. i copied this whole chunk from the sample code. it actually defines the code on what to do, i.e. if current view is A switch to B and vice versa.
    3) inside the controller files, you need to implement the toggleMenu function too, which basically calls the rootController's toggleMenu
    4) we also need viewA and viewB files(view class)
    5) need to add the .xib files for the respective views and link them up to the controller class. i did not use the .xib files for ui layout though, because of my app's needs. however, it will not work properly without the .xib files.
    5) inside the view class of both views, i.e. viewA.m and viewB.m, you need to create a button, that will call the toggleMenu function inside the respective controller class.
    it will look something like this:
    [Button addTarget:ViewAController action:@selector(toggleMenu:) forControlEvents:UIControlEventTouchUpInside];
    so the flow is really button (in view)-> toggleMenu(viewController) -> toggleMenu(rootController)
    i'm sorry it sounds pretty hazy, i did this part weeks before and can't really remember. i hope it helps.

  • Need help with URL Redirect in Sun Web Server 7 u5

    All I am trying to do is redirect to a static URL and for the life of me I can not get it to behave the way I would expect. I am new to Sun Web Server so I am just trying to use the Admin Console to set this up.
    Here is what I'm trying to do:
    Redirect from - http://www.oldsite.com/store/store.html?store_id=2154
    To - http://www.newsite.com/Stores/StoreFront.aspx?StoreId=2154
    Here's what I tried in the console.
    Added a new URL Redirect
    Set the Source to be Condition and set it to: '^/store_id=2154$' (quotes included)
    Then set the Target to: http://www.newsite.com/Stores/StoreFront.aspx?StoreId=2154
    Then for the URL Type I checked Fixed URL
    When I tested with: http://www.oldsite.com/store/store.html?store_id=2154 it did redirect as desired
    BUT
    When I tested with: "http://www.oldsite.com/store/store.html?store_id=5555" it too got redirected to the Target and I can't figure out how this second URL can satisfy the condition to get redirected.
    Any help is most appreciated.

    thanks for choosing sun web server 7
    it is simpler if you just edit the configuration files manually
    cd <ws7-install-root>/https-<hostname>/config/
    edit obj.conf or <hostname>-obj.conf (if there is one for you depending on your configuration so that it look something like)
    <Object name="default">
    AuthTrans..
    #add the folllowing line here
    <If defined $query>
    <If $urlhost =~ "/oldsite.com" and
    $uri =~ "/store/store.html" and
    $query =~ "store_id=2154" >
    NameTrans fn="redirect" from="/" http://www.newsite.com/Stores/StoreFront.aspx?StoreId=2154
    </If>
    </If>
    ..rest of the existing obj.conf. continues
    NameTrans...
    now, you can either do <ws7-install-root>/https-<hostname>/bin/reconfig -> to reload your configuration without any server downtime or <ws7-install-root>/https-<hostname>/bin/restart -> to restart the server
    if it did work out for your, you will need to run the following so that admin server is aware of what you just did
    <ws7-install-root>/bin/wadm pull-config user=admin config=<hostname> <hostname.domainname>
    hope this helps

  • Need help with Outlook 2013 connecting to Exchange server(2010)

    Hi
    I need help with Outlook 2013 and with my exchange server(2010) email account
    After setting up account initially emails come in and than after an hour or two stop. My OWA is working fine with no issues. I have even created a forward rule in OWA to my GMAIL account whch works fine
    However Outlook 2013 is not syncing messages, have difficulty in sending emails sometimes as it takes too long.  In fact the connection also is intermittent. Even if the task bar shows connected to exchange, it seems that is not the case since new emails
    and any emails I compose dont work.  I have trouble shot the issue with my ISP and email service provide, but they havent resolved the issue  I have also done a TraceRoute and that shows no drops or problems to he exchange server.
    Can someone please help me resolve this matter so I can continue to use Outlook 2013( running Windows 8.1) in both my computers which have the identical problem
    Look forward to a solution soon
    Thanks

    Hi Angela
    Thanks for your message
    To answer your questions, please note the following
    a) My account is set up in Cache Mode( not online mode)
    b) I am the only other user on the account
    c) When the connection to the exchange server is broken, I see upon clicking connection tab that there is no information in the box, and when I press reconnect it starts showing "connecting"
    d) When the connection to the server is there, it shows  connection as "established"
    e) Sorry I dont understand th meaning of CAS array in your environment?  Can you pls explain
    Since yday I have been using Outlook 2010 on desktop and Outlook 2013 on my laptop using Exchange 2013 account.  So far all emails are syncing, and I can send emails from both computers. However, I am concerned that the connection can break-off anytime,
    as it has done that in the past on both outlook versions.  The max time it has worked without any problem is 48 hrs and than after that the same issue of not connection, not syncing and unable to send emails happens
    My ISP has checked and there is no network connectivity issues. My email service provider has trouble shot the issue many times, but to no positive results.  I have also changed the profile a few times, but the intermittent connectivity problem hasn't
    been resolved.
    Can you identify the possible causes and more importantly a working permanent solution please
    Thanks
    Mahesh

  • Sending a value associated with a checkbox across a client/server connectio

    Hello everyone,
    I've been working on a coursework for uni which simulates a very simple pizza ordering system. I've built the GUI and got the prices to calculate in a single applet. I'm now required to advance my application to perform a client/server connection, and to to my limited knowledge of java, have stumped myself! Please can someone help. I need to take the value of the 5 chech boxes in the client GUI and pass them to the server, which needs to calculate the total and pass it back to the client to show in a text box. My code thus far is:
    //client
    import java.applet.Applet;
    import java.awt.event.*;
    import java.awt.*;
    import java.io.*;
    import java.net.*;
    public class A3ClientClass_1 extends A4 {
         CheckboxGroup z;
         Checkbox tpizza, mpizza, ppizza, prpizza;
         Checkbox tomato, pepper, cheese, pepperoni, mushroom;
         String a = "";
         String b = "";
         TextField size, toppings, cost;
         double c;
    Scrollbar xAxis, yAxis;
    ScrollablePanel p;
    public void init() {
              setBackground(Color.orange);
    setLayout(new BorderLayout());
              Panel north = new Panel();
              north.add(new Label("SELECT THE PIZZA YOU WANT"));
              add(north, BorderLayout.NORTH);
              Panel outside = new Panel();
              outside.setBackground(Color.orange);
              z = new CheckboxGroup();
              tpizza = new Checkbox("Tomato Pizza", z, false);
              outside.add(tpizza);
              tpizza.addItemListener(this);
              mpizza = new Checkbox("Mushroom Pizza", z, false);
              outside.add(mpizza);
              mpizza.addItemListener(this);
              ppizza = new Checkbox("Pepper Pizza", z, false);
              outside.add(ppizza);
              ppizza.addItemListener(this);
              prpizza = new Checkbox("Pepperoni Pizza", z, false);
              outside.add(prpizza);
              prpizza.addItemListener(this);
              tomato = new Checkbox(" Tomatoes ");
              outside.add(tomato);
              tomato.addItemListener(this);
              pepper = new Checkbox(" Peppers ");
              outside.add(pepper);
              pepper.addItemListener(this);
              cheese = new Checkbox(" Cheese ");
              outside.add(cheese);
              cheese.addItemListener(this);
              pepperoni = new Checkbox(" Pepperoni ");
              outside.add(pepperoni);
              pepperoni.addItemListener(this);
              mushroom = new Checkbox(" Mushrooms");
              outside.add(mushroom);
              mushroom.addItemListener(this);
              size = new TextField(40);
              toppings = new TextField(40);
              cost = new TextField(40);
              outside.add(size);
              outside.add(toppings);
              outside.add(cost);
              tomato.disable();
              cheese.disable();
              pepper.disable();
              pepperoni.disable();
              mushroom.disable();
    p = new ScrollablePanel(outside);
    xAxis = new Scrollbar(Scrollbar.HORIZONTAL, 0, 50, 0, 100);
    yAxis = new Scrollbar(Scrollbar.VERTICAL, 0, 50, 0, 100);
    add("Center", p);
    add("East", yAxis);
    add("South", xAxis);
    public boolean handleEvent(Event e) {
    if (e.target instanceof Scrollbar) {
    p.transxy(xAxis.getValue(), yAxis.getValue());
    return true;
    return super.handleEvent(e);
         public void itemStateChanged(ItemEvent e) {
              b = "";
              c = 0;
              if (tpizza.getState() == true) {
                   a = tpizza.getLabel();
                   c = c + 3.00;
                   tomato.setState(true);
                   cheese.setState(true);
                   pepper.setState(false);
                   pepperoni.setState(false);
                   mushroom.setState(false);
              else if (mpizza.getState() == true) {
                   a = mpizza.getLabel();
                   c = c + 3.50;
                   tomato.setState(false);
                   cheese.setState(false);
                   pepper.setState(false);
                   pepperoni.setState(false);
                   mushroom.setState(true);
              else if (ppizza.getState() == true) {
                   a = ppizza.getLabel();
                   c = c + 4.00;
                   tomato.setState(false);
                   cheese.setState(true);
                   pepper.setState(true);
                   pepperoni.setState(false);
                   mushroom.setState(false);
              else if (prpizza.getState() == true) {
                   a = prpizza.getLabel();
                   c = c + 5.00;
                   tomato.setState(false);
                   cheese.setState(true);
                   pepper.setState(false);
                   pepperoni.setState(true);
                   mushroom.setState(false);
              if (tomato.getState() == true) {
                   b = b + tomato.getLabel() + " ";
                   c = c + 0.25;
              if (pepper.getState() == true) {
                   b = b + pepper.getLabel() + " ";
                   c = c + 0.5;
              if (cheese.getState() == true) {
                   b = b + cheese.getLabel() + " ";
                   c = c + 0.5;
              if (pepperoni.getState() == true) {
                   b = b + pepperoni.getLabel() + " ";
                   c = c + 1.0;
              if (mushroom.getState() == true) {
                   b = b + mushroom.getLabel() + " ";
                   c = c + 0.5;
              size.setText("Pizza Type: " + a);
              toppings.setText("Toppings: " + b);
              cost.setText("Total: �" + c);
         try{
                   Socket cts = new Socket(InetAddress.getLocalHost(), 6000);
                   DataInputStream isfs = new DataInputStream(cts.getInputStream());
                   DataOutputStream osts = new DataOutputStream(cts.getOutputStream());
                   while(true) {
                        //code here
              catch (IOException e) {
                        System.out.println(e);
    class ScrollablePanel extends Panel {
    int transx = 0;
    int transy = 0;
    Panel outside;
    public ScrollablePanel(Panel p) {
         setLayout(new BorderLayout());
         outside = p;
         add(outside);
    public void transxy(int x, int y) {
    transx = -x;
    transy = -y;
         outside.move(transx, transy);
    //Server
    import java.io.*;
    import java.net.*;
    public class A3ServerClass_1 {
         public static void main(String[] args) {
              try
                   ServerSocket ss = new ServerSocket(6000);
                   Socket ssconnect = ss.accept();
                   DataInputStream isfc = new DataInputStream(ctc.getInputStream());
                   DataOutputStream ostc = new DataOutputStream(ctc.getOutputStream());
                   while(true) {
    //code here
              catch (IOException e) {
                   System.out.println(e);
    Thanks

    Can't help ya there, I've never done socket programming. However, it comes up on these forums all the time. Try searching for some keywords about your problem.

  • Need help with advanced JTable

    The application I am converting to Java has a string grid (table) with special behavior that I need to be able to bring to the Java version. It let's users filter the column data (that I know how to do) using a locked first row (just below the column header) that always stays in place and that shows what filter is applied to each column (by showing a combo box).
    I usually write server apps and have only been trying to grasp Swing for about a week, and I find myself stuck :(
    Is this at all possible in Java? If not, can I make the header respond to mouse events and show a popup menu for each column? If so how?
    Please help!

    I have made an attempt as follows (to show where I am stuck).
    I have two TableModels that contain rows and data;
    a) the grid data that's coming from our EJB session facade
    b) the filter settings (a String[] with initially empty strings) which show what filter is used for each column.
    The two table models are shown in two tables that share a common TableColumnModel so that whenever i move or resize a column both tables are updated.
    The filter table shows it's header and the row of empty cells. The Table Model I've used for it is ripped from the Sorted Table example from Sun, so that I can capture mouse events, set the sort order for each column and notify the grid table that it needs to update accordingly.
    I attempted to use the filter table as a header view in a JScrollPane, which would keep it in place all the time while the user would be able to scroll and resize the grid table.
    This is where I fail - I can't even get it to show up in the header. And if I only put the two tables on a JPanel it seems impossible to get them to stick together when the pane is resized (aside from the fact that I no longer can capture the mouse events).
    I'd be happy to send someone the code fragments if you think you have a solution to this - that will allow users to resize, edit and move columns in a table where you initially have no clue as to how many columns it will contain.
    Please please continue to help me :)

  • Hi, i need help with a jtable

    hi, iam new here, i try to read an excel file, and put the rows and columns in a jtable, i dont have the code exactly but maybe someone can help me.

    You can use this
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    //String myDB ="myExcel";
    String myDB =  "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=c:/book.xls;"
        + "DriverID=22;READONLY=false";
    //con=DriverManager.getConnection("jdbc:odbc:myExcel");
    con=DriverManager.getConnection(myDB,"","");
    dbmd=con.getMetaData();
    stat=con.createStatement();
    rs=stat.executeQuery("Select * from `Sheet1$`");//[Sheet1$]
    ResultSetMetaData rsmd = rs.getMetaData();
    int numberOfColumns = rsmd.getColumnCount();
    while (rs.next()) {
    for (int i = 1; i <= numberOfColumns; i++) {
    if (i > 1) System.out.print(", ");
    String columnValue = rs.getString(i);
    System.out.print(columnValue);
    System.out.println("");
    for (int j = 1; j <= numberOfColumns; j++)
      System.out.println(rsmd.getColumnName(j));
    rsTable=dbmd.getTables(null,null,"%",null);
    while (rsTable.next())
    //String tableCatalog = rsTable.getString(1);
    //String tableSchema = rsTable.getString(2);
    System.out.println("Table Name "+rsTable.getString(3)+" Table catalog "+rsTable.getString(1)+" Table Schema "+rsTable.getString(2));
    rsTable.close();You can store Column Names,data in the String Array.
    To generate a JTable with this check this
    http://www.codetoad.com/java_JTable.asp.
    There at method createBlankElement()
    put values from the data array or if you want, from the database.
    For the Columns, pass columnNames array to addColumns method.

  • Need help with pushview for multiple view files

    Does anyone know how to create a pushview function or changeHandler function that would allow each item on a list when selected to change to a different view?
    Example is that if like has 1, 2, 3 on it selecting 1 would take user to view1.mxml, selecting 2 would send user to view2.mxml, etc.  I do not want to send all list items to the same view and just load different information.
    Thanks!

    I will check that out thanks! 
    In the mean time I did get the answer - see here: http://stackoverflow.com/questions/8936115/how-to-create-multiple-events-in-a-single-list- in-flex

  • Need help with network user accounts on Mac server App on Yosemite, any tips?

    I've been trying to set up a small network with the Server app on Yosemite. I don't want to do anything crazy with the server, I'd just like to know how I can set up network user accounts so that they can login from other Mac computers on the same network. I already have Open directory set up, the Macs that will be used on the network with the server have already been joined to the server under login options. I have created the network user account, I have also joined the user account to a group that I created. When I try to login to the network account from one of the Macs, it doesn't work. I'm pretty rookie with Mac server, can anyway give me any pointers of what I should be doing? Or if I am doing something wrong. Thanks guys.

    The most important step, once you've got Open Directory and DNS set up, with Local Network Users set up in Server.app, is to make sure that all client Macs are using the server's IP address as the primary DNS server in System Preferences > Network, and that they have joined the Network server in System Preferences > Users and Groups > Login Options.
    Having said all that, I have just spent hours setting this all up only to find out that Mail doesn't currently work with Network Homes in 10.10.3 / Server.app 4.1.
    I will be hoping that Apple recognise the bug, and put out a fix soon.

  • Deploying Oracle Forms with Plss and dlls in Client/Server

    Hi,
    I have a form application which has two plls libraries attached to it - d2kwutil.pll and d2kcomn.pll and one dll - d2kwutil.dll. All these libraries are necssary for the app to work. The issue come when I am trying to deploy them in different environments like dev,test,qa,prod. The users access the forms applications from a shared drive and all the users have forms runtime client installed on their local machines.
    If I just post my fmx in the shared drive it doesn't work as its unable to find the plls and the dll. I will really appreciate if someone can provide some feedback on this. How this should be done so that we can place these plls and dll in central location without chaning the paths etc.
    Thanks

    Oracle Application Server Release 3 can not be used to deploy forms and reports.
    If you want forms and reports you need to stay on Oracle Application Server 10g Release 2

  • Need help with setting up a photolibrary on server that can be accessed/edited by multiple users

    Hi:
    I would like to develop an in-house photolibrary for our graphics department. The goal is to be able to add keywords to all our images so that we could have a more dynamic means of searching through our countless scanned images. Lightroom works great with regards to keywording and searching.
    To make it so all the computers in our office could have access to the images, I created a photolibrary on our server that can be accessed by any of the computers in our graphics dept. However, when one computer adds keywords to an image, that info does not show up on any of the other computers. Perhaps this is an issue with the trial version and we need to get the license? A few other people suggested that it might have something to do with my export settings - I tried to play around with the settings but had little luck...Any Advise?
    Thanks,
    Leo

    Thanks for your thorough reply. Is there a way to have one MASTER computer that could create the keywords and have the other computers access the master computer's catlogues - or something of that sort. We are small graphics dept. with three people so even that would suffice.
    Lightroom is not a networked application, and cannot be set up so that multiple computers can access LR via a network.
    The only real workaround with LR is to put the catalog and photos on an external HD and then physically connect the external HD to the computer of the person wanting to use it. So only one person can use the catalog at one time.
    You can look up Digital Asset Management (DAM) software on Google if you really need to have multi-user access and networked.

  • Need help with an automator workflow to convert AAC files to MP3

    Hi
    I am trying to work out a way to automatically convert voice memos which I dictate on my iPhone to MP3 files when they are added to my iTunes library during a sync. Then I need the converted files to be in a specific folder so that they will trigger an auto-transcription program that I have running.
    From my limited knowledge of automating processes on my Mac it would seem that I need to design a workflow or a folder action in Automator. Probably a folder action would be best, as I could attach it to the 'Voice Memos' folder in my iTunes Music Folder. The converted MP3 files would be saved in the same folder and would then be recognised by the transcription program. I have tried to design a workflow/folder action using Doug's iTunes automator actions as follows, but it is not working as I would like. The workflow is as follows:
    Folder Action/Get Folder Contents/Choose encoder (MP3)/Convert Tracks/Choose encoder (apple lossless)/Restore Encoder.
    The folder action is triggered when I add AAC files to the folder I have attached the action to, but then I get an error message stating that 'no tracks have been sent to this action'.
    i would be grateful for any help to get this working using the automator method or another method
    thanks
    nick

    Start with http://discussions.apple.com/thread.jspa?threadID=2039384 and Introduction to Automator tutorial at http://automator.us/leopard/video/index.html

  • Need help with an AU instrument install w/Key File

    hey guys, i have a problem. i bought a new AU called Filterbank3 from Tone2. It uses a "Key File" which i have but i don't know where to "put" it. i don't think i have ever purchased and AU that has one. most are serial number type you know, when you open the plugin for the first time the screen pops up you type in the number and you are good to go. i have downloaded the plugin and it shows up in the availible list but when i try to open it it says "key file missing copy (the key file) to Library/audio units/plug ins. i have the key file as sent to me by the publisher and have done this but it doesn't seem to work. i really need some "hand holding" with this one. could anyone give me a walk through of what i should do? thanx-gospel

    Yeah Sampleconstruct thats the FIRST thing i did. The plug-in is there and i put the keyfile in as well. Maybe i wasn't really clear in earlier posts the problem i am having is with the Key File copy protection. In addition to the plug in Componenet File there is a .cfg file (which i don't know what that is) and the t2k. file (which is the key file). I have put all of them in the what i think is the correct place. Since it ran off an installer it is in Program HD/Library/Audio/Plug-Ins and thats where i put the .cfg and t2k.files. I tried to create a sub folder for just Filterbank in the Components folder and put all the stuff in there but it didn't help. i even tried to set up Application Support Folder in Program HD/Library/Application Supportfor FilterBank this did not help either. I do not know what to do the keyfile at all. maybe Tone2 will get back to me. but as always any help from true Mac heads is appreciated.-gos
    (to clarify i have 2 HDs one for programs and one for recording, also i have two plugin folders one manual one under users and one general where installers put stuff, i try not to move the individual plug-ins around )

  • I need help with the processes running a media server.

    Hi there!   I need some help with the following log please.  The processes listed I am assuming are the current processes being used from my MacBook Pro to the media server?  Is that correct?  Are these common processes?
    Incident Identifier: EC931B64-E141-4C64-B428-427DF014C7E8
    CrashReporter Key:   b16be41bf16206d8f231e7e71676ab2a9c4dd25e
    Hardware Model:      iPhone4,1
    OS Version:          iPhone OS 5.0.1 (9A405)
    Kernel Version:      Darwin Kernel Version 11.0.0: Tue Nov  1 20:34:16 PDT 2011; root:xnu-1878.4.46~1/RELEASE_ARM_S5L8940X
    Date:                2012-08-24 16:06:18 -0400
    Time since snapshot: 152 ms
    Free pages:        1195
    Wired pages:       88383
    Purgeable pages:   0
    Largest process:   mediaserverd
    Processes
             Name                 UUID                    Count resident pages
                 atc <2271ed33ec773eeb9f381bf1baac9dee>     390
           securityd <e31a714c227a3d1c98ef8aacd44d91ee>     243
             assetsd <281396d3e7d831fbb6a5374157663dbc>    1370
          MobileMail <7064f2baf3f23db987bc8ec99855fe53>    1438 (jettisoned)
            mstreamd <cbe9881735043a389e7cdad3b5bcf5ce>    1099 (jettisoned)
              Camera <88291709452932ac9cbd0f1c06902214>    3105 (active)
         dataaccessd <b4f61f117ee635c48329af8572733d30>    1760
         MobilePhone <fe38c6944a053c9187b41ee50aa151b0>    5549
            networkd <6ee7a78e56073f6e8db4c2cc3265fdb4>     170
          aosnotifyd <58089d732ab43bbea0aec4a6f812f446>     320
            BTServer <e03baab8e0103188979ce54b87591065>     261
          aggregated <68a25a1690cb372096543a46abed14d7>     337
                apsd <e4b6e6e4f31e36f79815747ecbf52907>     291
       fairplayd.N94 <2c0105776e393b39ba95edffaf3bdd17>     294
           fseventsd <78af02202422321885dfc85c24534b0e>     170
                iapd <3ee7f82879033b4fb93b9cf1f4ecae29>     366
             imagent <8e2042f2ec9e3af9ba400f031f1bbfa7>     416
       mDNSResponder <b75f43f012ad3d9ea172d37491994e22>     265
        mediaremoted <b9fa7d1381013c2fa90ea134ff905f59>     258
        mediaserverd <478e5e8345c83be5ba1868906813bb75>    6774
                 ubd <7eaf0b0ca5b83afabecb0dfaa38c7a19>     389
               wifid <e176ab123beb3000bdb89e020612c1d6>     284
           locationd <91c84ab19dd03e4ab1b4cc30178ab1c0>     831
              powerd <25ddef6b52e4385b819e777dd2eeed3c>     167
           lockdownd <a68aa1526ef13a9bb4426bb71ffc1e3c>     250
          CommCenter <51922c9a50e73fe3badccaa4b1b1123b>     781
             syslogd <dd3766bcb1213e91b66283635db09773>     107
         SpringBoard <7506c20d86da3f1dbe9bf38f8bda253d>    5673 (active)
             configd <3430c0025ed13f56800a329b7254d2ae>     418
             notifyd <3793fabace3a385687b3c29c1fa1fcac>     252
      UserEventAgent <6e1cabc1ec6d372c90a6bdeaa7b258fa>     433
             launchd <cc35dd7a872334319ed028e6bbeae081>     133
    **End**
    Thanks a bunch!!!

    COULD NOT OF BEEN BOUGHT BRANDNEW IN 2011** apologies

  • I need help with Compressor 4 settings to convert .mp4 files to .m4v for iBooks Author

    I'm a curriculum design guy with no video background. I have Compressor 4, but don't really know much about how to best use it.  I'd appreciate some help with getting the right setting for my project. Screen shots of settings would be much appreciated, since I don't know much video terminology.
    I'm making an free iBook for students on WWII propaganda using old videos from the Internet archive.
    I'd plan to use Compressor to:
    1. Convert the .mp4 files to a .m4v that iBooks Author will accept. (I know I can use QT for that, but it increases file size)
    2. Use Compressor to reduce file size so my iBook doesn't get too big
    3. Get videos that look & sound the best, given the poor quality of the original source videos.
    Here's some sample videos that I'll use:
    http://www.archive.org/download/OutOfTheFryingPanIntoTheFiringLine/OutOfTheFryin gPanIntoTheFiringLine.mp
    http://archive.org/download/AvengeDe1942/AvengeDe1942_edit.mp4
    PS - I will also be editing some of the original videos in iMovie - if I use different settings to prep those videos for iBook Author, let me know.
    Much thanks in advance for any help

    Compressor is half the size compared to QtX encoding, 17 MBs...
    File Format... H.264 for Apple Devices...
    Device: iPhone Local/WiFi
    Aspect Ratio: 4:3 480x368
    Data Rate: 700
    Uncheck Multi-pass

Maybe you are looking for

  • Exporting to excel properties

    Post Author: skootsu CA Forum: Crystal Reports Is there any way to export information that is in the Report Summary (like Name of report, Manager, etc) to the properties of the excel spreadsheet that is created from exporting?  Example, I have lots o

  • Empty file not cleaned out by the cleaner

    Another day, another post about cleaner. Let me describe a problem on this sample dataset I have. I have a small BDB with the following 4 files -rw-rw-r-- 1 apps apps 34M Jul 18 21:58 00000061.jdb -rw-rw-r-- 1 apps apps 53K Jul 18 22:00 00000062.jdb

  • Map_request not using size_hint

    Hi, we'd like to query mapviewer using an xml map_request. The output is supposed to use some sort of a fixed zoom. To achieve this we tried to use the size_hint parameter with a bounding_theme. <?xml version="1.0" standalone="yes"?> <map_request dat

  • Error code:sec_error_unknown_Issuer

    Yesterday, several other files were bundled with a file I downloaded. I may have uninstalled or deleted something necessary to access my snet email account. Internet access (www. sites) is still mostly intact.

  • Clearing Oracle Parameters to call diferent stored procs

    Sub Main Do While i < 3 make_excel(i) i = i + 1 Loop end Sub Sub make_excel(ByVal array As Integer) objCmd.Parameters.Add(New OracleParameter("p_cursor", OracleType.Cursor)).Direction = ParameterDirection.Output end Sub objCmd.Parameters.Clear() objC