Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
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
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Java in General
passing string
randy butler
Greenhorn
Posts: 27
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Ranchers, i need to pass a
string
from my main form to my edit form not sure how to start.
private void EditjButton1ActionPerformed(java.awt.event.ActionEvent evt) { EditRecord dialog = new EditRecord(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { int n = PartToolOrderTable.getSelectedRow(); String id = (String)PartToolOrderTable.getValueAt(n, 0); public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); }
so I want to pass id to my edit class.
thanks
Eric Mission
Greenhorn
Posts: 22
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
There are several problems with your code- the first being that you nested a method inside a method.
public void myFirstMethod() { //do stuff plus this other method which is illegal! public void mySecondMethod() { //do stuff } }
If I was going to pass something to you I would do 2 things- 1. call you to tell you 2. pass it
//create main form MyMainForm mform = new MyMainForm("passing value"); //create edit form MyEditForm eform = new MyEditForm(); //call and pass value eform.setValue( mform.getValue() );
Try Sun's tutorial's
Java for beginners
to infinity and beyond
randy butler
Greenhorn
Posts: 27
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
eric, thanks for the reply i fixed the method
private void EditjButton1ActionPerformed(java.awt.event.ActionEvent evt) { try { // TODO add your handling code here: int n = PartToolOrderTable.getSelectedRow(); String id = (String)PartToolOrderTable.getValueAt(n, 0); System.out.print(id); EditRecord dialog = new EditRecord(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { }); dialog.setVisible(true); } catch (Exception ex) { Logger.getLogger(testframe.class.getName()).log(Level.SEVERE, null, ex); } }
just a bit confused with your example dealing with
# //call and pass value
# eform.setValue( mform.getValue() );
thanks
Brendon Randall
Greenhorn
Posts: 10
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Maybe try something like this
in your edit form : -
public class EditRecord extends javax.swing.JFrame { public EditRecord(String id) { initComponents(); }
Then when you want to pass to that form you can pass like : -
new EditRecord(stringToPass).setVisible(true);
randy butler
Greenhorn
Posts: 27
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Bredon, Thanks for the reply
but I figured it out
What's that smell? Hey, sniff this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Dealing with Jlist
Single Application but Multiple Connection problem
Spring MVC + Hibernate: Update one column?
Single Application but Multiple Connection problem
connecting java application to JAVADB database
More...